-
Notifications
You must be signed in to change notification settings - Fork 28
/
CMakeLists.txt
528 lines (437 loc) · 19 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
#############################################################################
# Copyright (c) 2023, xeus-cpp contributors #
# #
# Distributed under the terms of the BSD 3-Clause License. #
# #
# The full license is in the file LICENSE, distributed with this software. #
#############################################################################
cmake_minimum_required(VERSION 3.24)
project(xeus-cpp)
enable_language(CXX)
set(CMAKE_CXX_EXTENSIONS NO)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(GNUInstallDirs)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
set(XEUS_CPP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
# xeus-cpp tag files
set(XEUS_CPP_DATA_DIR "share/xeus-cpp")
set(XCPP_TAGFILES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/share/xeus-cpp/tagfiles)
set(XEUS_CPP_CONF_DIR "etc/xeus-cpp")
set(XCPP_TAGCONFS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/etc/xeus-cpp/tags.d)
file(COPY "${XCPP_TAGFILES_DIR}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/share/xeus-cpp")
file(COPY "${XCPP_TAGCONFS_DIR}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/etc/xeus-cpp")
# Versionning
# ===========
file(STRINGS "${XEUS_CPP_INCLUDE_DIR}/xeus-cpp/xeus_cpp_config.hpp" version_defines
REGEX "#define XEUS_CPP_VERSION_(MAJOR|MINOR|PATCH|LABEL)")
foreach (ver ${version_defines})
if (ver MATCHES "#define XEUS_CPP_VERSION_(MAJOR|MINOR|PATCH|LABEL) +([^ ]+)$")
set(XEUS_CPP_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
endif ()
endforeach ()
set(${PROJECT_NAME}_VERSION
${XEUS_CPP_VERSION_MAJOR}.${XEUS_CPP_VERSION_MINOR}.${XEUS_CPP_VERSION_PATCH}${XEUS_CPP_VERSION_LABEL})
message(STATUS "Building xeus-cpp v${${PROJECT_NAME}_VERSION}")
# Build options
# =============
option(XEUS_CPP_BUILD_STATIC "Build xeus-cpp static library" ON)
option(XEUS_CPP_BUILD_SHARED "Split xcpp build into executable and library" ON)
option(XEUS_CPP_BUILD_EXECUTABLE "Build the xcpp executable" ON)
option(XEUS_CPP_USE_SHARED_XEUS "Link xcpp with the xeus shared library (instead of the static library)" ON)
option(XEUS_CPP_USE_SHARED_XEUS_CPP "Link xcpp with the xeus shared library (instead of the static library)" ON)
option(XEUS_CPP_EMSCRIPTEN_WASM_BUILD "Build for wasm with emscripten" OFF)
# Test options
option(XEUS_CPP_BUILD_TESTS "xeus-cpp test suite" ON)
option(XEUS_CPP_ENABLE_CODE_COVERAGE "xeus-cpp test suite" OFF)
if(XEUS_CPP_ENABLE_CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
if(NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
message(FATAL_ERROR "CodeCov enabled on non-debug build!")
endif()
set(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
set(GCC_COVERAGE_LINK_FLAGS "--coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHAREDLINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
endif()
if(EMSCRIPTEN)
add_compile_definitions(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
message("Build with emscripten")
set(XEUS_CPP_BUILD_STATIC ON)
set(XEUS_CPP_BUILD_SHARED OFF)
set(XEUS_CPP_BUILD_EXECUTABLE OFF)
set(XEUS_CPP_USE_SHARED_XEUS OFF)
set(XEUS_CPP_USE_SHARED_XEUS_CPP OFF)
set(XEUS_CPP_BUILD_TESTS OFF)
# ENV (https://github.com/emscripten-core/emscripten/commit/6d9681ad04f60b41ef6345ab06c29bbc9eeb84e0)
set(EMSCRIPTEN_FEATURES "${EMSCRIPTEN_FEATURES} -s \"EXPORTED_RUNTIME_METHODS=[ENV']\"")
endif()
# Dependencies
# ============
set(xeus_REQUIRED_VERSION 5.0.0)
set(xeus_zmq_REQUIRED_VERSION 3.0.0)
set(CppInterOp_REQUIRED_VERSION 1.5.0)
if (NOT TARGET xeus AND NOT TARGET xeus-static)
find_package(xeus ${xeus_REQUIRED_VERSION} REQUIRED)
if (xeus_FOUND)
message(STATUS "Found compatible xeus version: ${xeus_VERSION}")
endif()
endif ()
find_package(CppInterOp ${CppInterOp_REQUIRED_VERSION} REQUIRED)
if(CppInterOp_FOUND)
message(STATUS "Found CppInterOp: config=${CPPINTEROP_CMAKE_DIR} dir=${CPPINTEROP_INSTALL_PREFIX} (found version=${CPPINTEROP_VERSION} compatible with Clang ${CPPINTEROP_LLVM_VERSION_MAJOR}.x)")
endif()
find_package(argparse REQUIRED)
find_package(pugixml REQUIRED)
# Configuration
# =============
if (NOT DEFINED XEUS_CPP_KERNELSPEC_PATH)
set(XEUS_CPP_KERNELSPEC_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/")
endif ()
function(configure_kernel kernel)
set(XEUS_CPP_PATH "$ENV{PATH}")
set(XEUS_CPP_LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}")
set(XEUS_CPP_RESOURCE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/clang/${CPPINTEROP_LLVM_VERSION_MAJOR})
set(XEUS_CPP_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
if (WIN32)
string(REPLACE "\\" "/" kernel "${kernel}")
string(REPLACE "\\" "/" XEUS_CPP_PATH "${XEUS_CPP_PATH}")
string(REPLACE "\\" "/" XEUS_CPP_LD_LIBRARY_PATH "${XEUS_CPP_LD_LIBRARY_PATH}")
string(REPLACE "\\" "/" XEUS_CPP_RESOURCE_DIR "${XEUS_CPP_RESOURCE_DIR}")
string(REPLACE "\\" "/" XEUS_CPP_INCLUDE_DIR "${XEUS_CPP_INCLUDE_DIR}")
endif()
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}${kernel}kernel.json.in"
"${CMAKE_CURRENT_BINARY_DIR}${kernel}kernel.json")
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}${kernel}logo-32x32.png"
"${CMAKE_CURRENT_BINARY_DIR}${kernel}"
COPYONLY)
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}${kernel}logo-64x64.png"
"${CMAKE_CURRENT_BINARY_DIR}${kernel}"
COPYONLY)
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}${kernel}logo-svg.svg"
"${CMAKE_CURRENT_BINARY_DIR}${kernel}"
COPYONLY)
endfunction()
message("Configure kernels: ...")
if(EMSCRIPTEN)
# TODO: Currently jupyterlite-xeus and xeus-lite do not provide
# methods to fetch information from the arguments present in the
# generated emscripten kernel.
# The following needs to be done here :
# 1) We need to configure the kernel properly
# Check issue https://github.com/compiler-research/xeus-cpp/issues/185.
# 2) Once the above is done we need to add support in jupyterlite-xeus & xeus-lite
# to be able to deal with arguments present in kernel.json
# 3) Finally we should fetch the C++ version from the kernel.json file and
# be able to pass it to our wasm interpreter rather than forcing a version.
configure_kernel("/share/jupyter/kernels/xcpp20/")
else()
configure_kernel("/share/jupyter/kernels/xcpp17/")
configure_kernel("/share/jupyter/kernels/xcpp20/")
endif()
# Source files
# ============
set(XEUS_CPP_HEADERS
include/xeus-cpp/xbuffer.hpp
include/xeus-cpp/xholder.hpp
include/xeus-cpp/xoptions.hpp
include/xeus-cpp/xeus_cpp_config.hpp
include/xeus-cpp/xholder.hpp
include/xeus-cpp/xinterpreter.hpp
include/xeus-cpp/xmanager.hpp
include/xeus-cpp/xmagics.hpp
include/xeus-cpp/xoptions.hpp
include/xeus-cpp/xpreamble.hpp
#src/xinspect.hpp
#src/xsystem.hpp
#src/xparser.hpp
)
set(XEUS_CPP_SRC
src/xholder.cpp
src/xinput.cpp
src/xinterpreter.cpp
src/xoptions.cpp
src/xparser.cpp
src/xutils.cpp
)
if(NOT EMSCRIPTEN)
list(APPEND XEUS_CPP_SRC
src/xmagics/xassist.cpp
src/xmagics/os.cpp
)
endif()
if(EMSCRIPTEN)
list(APPEND XEUS_CPP_SRC src/xinterpreter_wasm.cpp)
endif()
set(XEUS_CPP_MAIN_SRC
src/main.cpp
)
# Targets and link - Macros
# =========================
include(CheckCXXCompilerFlag)
string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
list(REMOVE_DUPLICATES CMAKE_INSTALL_RPATH)
macro(xeus_cpp_set_common_options target_name)
if (MSVC)
target_compile_options(${target_name} PUBLIC /wd4251 /wd4141)
target_compile_options(${target_name} PUBLIC /wd4018 /wd4267 /wd4715 /wd4146 /wd4129)
target_compile_options(${target_name} PUBLIC /EHsc)
else ()
target_compile_options(${target_name} PUBLIC -fexceptions)
endif ()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
CMAKE_CXX_COMPILER_ID MATCHES "Intel")
if (EMSCRIPTEN)
target_compile_options(${target_name} PRIVATE -fPIC)
else ()
target_compile_options(${target_name} PUBLIC -Wunused-parameter -Wextra -Wreorder)
endif()
# C++17 flag
CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP_17_FLAG)
if (HAS_CPP_17_FLAG)
target_compile_features(${target_name} PRIVATE cxx_std_17)
else ()
message(FATAL_ERROR "Unsupported compiler -- xeus-cpp requires C++17 support!")
endif ()
endif ()
if (APPLE)
set_target_properties(${target_name} PROPERTIES
MACOSX_RPATH ON
)
else ()
set_target_properties(${target_name} PROPERTIES
BUILD_WITH_INSTALL_RPATH 1
SKIP_BUILD_RPATH FALSE
)
endif ()
set_target_properties(${target_name} PROPERTIES
INSTALL_RPATH_USE_LINK_PATH TRUE
)
endmacro()
# Common macro kernels (xcpp)
macro(xeus_cpp_set_kernel_options target_name)
if (XEUS_CPP_USE_SHARED_XEUS_CPP)
target_link_libraries(${target_name} PRIVATE xeus-cpp)
if(CMAKE_DL_LIBS)
target_link_libraries(${target_name} PRIVATE ${CMAKE_DL_LIBS} util)
endif()
else ()
target_link_libraries(${target_name} PRIVATE xeus-cpp-static)
endif()
if(NOT EMSCRIPTEN)
find_package(Threads)
target_link_libraries(${target_name} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endif()
endmacro()
# Common macro for shared and static library
macro(xeus_cpp_create_target target_name linkage output_name)
string(TOUPPER "${linkage}" linkage_upper)
if (NOT ${linkage_upper} MATCHES "^(SHARED|STATIC)$")
message(FATAL_ERROR "Invalid library linkage: ${linkage}")
endif ()
add_library(${target_name} ${linkage_upper} ${XEUS_CPP_SRC} ${XEUS_CPP_HEADERS})
xeus_cpp_set_common_options(${target_name})
set_target_properties(${target_name} PROPERTIES
PUBLIC_HEADER "${XEUS_CPP_HEADERS}"
PREFIX ""
VERSION ${${PROJECT_NAME}_VERSION}
SOVERSION ${XEUS_CPP_VERSION_MAJOR}
OUTPUT_NAME "lib${output_name}")
target_compile_definitions(${target_name} PUBLIC "XEUS_CPP_EXPORTS")
target_compile_features(${target_name} PRIVATE cxx_std_17)
target_include_directories(${target_name}
PUBLIC
$<BUILD_INTERFACE:${XEUS_CPP_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)
if (XEUS_CPP_USE_SHARED_XEUS)
set(XEUS_CPP_XEUS_TARGET xeus)
else ()
set(XEUS_CPP_XEUS_TARGET xeus-static)
endif ()
#This is a workaround for the issue with the libcurl target on Windows specifically for xassist
if (WIN32)
# Set the MSVC runtime library
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
# Find libcurl
find_package(CURL REQUIRED)
# Add CURL_STATICLIB definition if linking statically
if (CURL_STATICLIB)
target_compile_definitions(${target_name} PUBLIC CURL_STATICLIB)
endif()
# Link against the correct libcurl target
if (CURL_FOUND)
target_include_directories(${target_name} PRIVATE ${CURL_INCLUDE_DIRS})
target_link_libraries(${target_name} PRIVATE ${CURL_LIBRARIES})
endif()
# Existing target_link_libraries call, adjusted for clarity
target_link_libraries(${target_name} PUBLIC ${XEUS_CPP_XEUS_TARGET} clangCppInterOp pugixml argparse::argparse)
# Ensure all linked libraries use the same runtime library
if (MSVC)
target_compile_options(${target_name} PRIVATE "/MD$<$<CONFIG:Debug>:d>")
endif()
elseif (NOT EMSCRIPTEN)
# Curl initialised specifically for xassist
target_link_libraries(${target_name} PUBLIC ${XEUS_CPP_XEUS_TARGET} clangCppInterOp pugixml argparse::argparse curl)
else ()
target_link_libraries(${target_name} PUBLIC ${XEUS_CPP_XEUS_TARGET} clangCppInterOp pugixml argparse::argparse)
endif()
if (WIN32 OR CYGWIN)
#
elseif (APPLE)
target_link_libraries(${target_name} PRIVATE "-undefined dynamic_lookup")
endif ()
if(NOT EMSCRIPTEN)
find_package(Threads) # TODO: add Threads as a dependence of xeus-static?
target_link_libraries(${target_name} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endif()
endmacro()
# xeus-cpp-headers
# ================
set(XCPP_HEADERS
include/xcpp/xmime.hpp
include/xcpp/xdisplay.hpp
)
add_library(xeus-cpp-headers INTERFACE)
set_target_properties(xeus-cpp-headers PROPERTIES PUBLIC_HEADER "${XCPP_HEADERS}")
install(TARGETS xeus-cpp-headers PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/xcpp)
# xeus-cpp
# ========
set(XEUS_CPP_TARGETS "")
if (XEUS_CPP_BUILD_SHARED)
# Build libraries
xeus_cpp_create_target(xeus-cpp SHARED xeus-cpp)
list(APPEND XEUS_CPP_TARGETS xeus-cpp)
endif ()
if (XEUS_CPP_BUILD_STATIC)
# On Windows, a static library should use a different output name
# to avoid the conflict with the import library of a shared one.
if (CMAKE_HOST_WIN32)
xeus_cpp_create_target(xeus-cpp-static STATIC xeus-cpp-static)
else ()
xeus_cpp_create_target(xeus-cpp-static STATIC xeus-cpp)
endif ()
list(APPEND XEUS_CPP_TARGETS xeus-cpp-static)
endif ()
# xcpp
# ====
if (XEUS_CPP_BUILD_EXECUTABLE)
find_package(xeus-zmq ${xeus_zmq_REQUIRED_VERSION} REQUIRED)
add_executable(xcpp ${XEUS_CPP_MAIN_SRC})
target_compile_features(xcpp PRIVATE cxx_std_17)
xeus_cpp_set_common_options(xcpp)
xeus_cpp_set_kernel_options(xcpp)
target_link_libraries(xcpp PRIVATE xeus-zmq)
endif()
if(EMSCRIPTEN)
include(WasmBuildOptions)
find_package(xeus-lite REQUIRED)
add_executable(xcpp src/main_emscripten_kernel.cpp )
target_link_libraries(xcpp PRIVATE xeus-lite)
xeus_cpp_set_kernel_options(xcpp)
xeus_wasm_compile_options(xcpp)
xeus_wasm_link_options(xcpp "web,worker")
# TODO: Remove the exported runtime methods
# after the next xeus release.
target_link_options(xcpp PUBLIC
-sEXPORTED_RUNTIME_METHODS=FS,PATH,ERRNO_CODES
# add sysroot location here
--preload-file ${SYSROOT_PATH}/include@/include
)
# TODO: Emscripten supports preloading files just once before it generates
# the xcpp.data file (containing the binary representation of the file(s) we
# want to include in our application).
# Hence although we are adding support for Standard Headers, Libraries etc
# through emscripten's sysroot for now, we need to do the following:
# 1) Enable CppInterOp to provide us with a resource dir.
# 2) If the above cannot be done, we can use the resource dir provided
# by llvm on emscripten-forge but would involve adding a dependency.
# 3) Shift the resource dir and the sysroot to a common location.
# 4) Preload everything required together.
endif()
# Tests
# =====
if(XEUS_CPP_BUILD_TESTS)
add_subdirectory(test)
endif()
# Installation
# ============
include(CMakePackageConfigHelpers)
set(XEUS_CPP_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE STRING "install path for xeus-cppConfig.cmake")
install(DIRECTORY ${XCPP_TAGFILES_DIR}
DESTINATION ${XEUS_CPP_DATA_DIR})
install(DIRECTORY ${XCPP_TAGCONFS_DIR}
DESTINATION ${XEUS_CPP_CONF_DIR})
# Install xeus-cpp and xeus-cpp-static
if (XEUS_CPP_BUILD_SHARED)
install(TARGETS ${XEUS_CPP_TARGETS}
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/xeus-cpp)
# Makes the project importable from the build directory
export(EXPORT ${PROJECT_NAME}-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
endif ()
# Install xcpp
if (XEUS_CPP_BUILD_EXECUTABLE)
install(TARGETS xcpp
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
if(XEUS_CPP_BUILD_EXECUTABLE OR EMSCRIPTEN)
# Configuration and data directories for jupyter and xeus-cpp
set(XJUPYTER_DATA_DIR "share/jupyter" CACHE STRING "Jupyter data directory")
# Install xcpp Jupyter kernelspec
set(KERNELSPEC_DIR ${CMAKE_CURRENT_BINARY_DIR}/share/jupyter/kernels)
install(DIRECTORY ${KERNELSPEC_DIR}
DESTINATION ${XJUPYTER_DATA_DIR}
PATTERN "*.in" EXCLUDE)
# Extra path for installing Jupyter kernelspec
if (XEXTRA_JUPYTER_DATA_DIR)
install(DIRECTORY ${KERNELSPEC_DIR}
DESTINATION ${XEXTRA_JUPYTER_DATA_DIR}
PATTERN "*.in" EXCLUDE)
endif ()
endif ()
# Configure 'xeus-cppConfig.cmake' for a build tree
set(XEUS_CPP_CONFIG_CODE "####### Expanded from \@XEUS_CPP_CONFIG_CODE\@ #######\n")
set(XEUS_CPP_CONFIG_CODE "${XEUS_CPP_CONFIG_CODE}set(CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/cmake;\${CMAKE_MODULE_PATH}\")\n")
set(XEUS_CPP_CONFIG_CODE "${XEUS_CPP_CONFIG_CODE}##################################################")
configure_package_config_file(${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${PROJECT_BINARY_DIR})
# Configure 'xeus-cppConfig.cmake.in for an install tree
set(XEUS_CPP_CONFIG_CODE "")
configure_package_config_file(${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${XEUS_CPP_CMAKECONFIG_INSTALL_DIR})
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${XEUS_CPP_CMAKECONFIG_INSTALL_DIR})
if (XEUS_CPP_BUILD_SHARED)
install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${XEUS_CPP_CMAKECONFIG_INSTALL_DIR})
endif ()
if(EMSCRIPTEN)
install(FILES
"$<TARGET_FILE_DIR:xcpp>/xcpp.js"
"$<TARGET_FILE_DIR:xcpp>/xcpp.wasm"
"$<TARGET_FILE_DIR:xcpp>/xcpp.data"
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif ()
if(XEUS_CPP_INCLUDE_DOCS)
add_subdirectory(docs)
endif()