Skip to content

Commit 2226ca0

Browse files
authored
Switch to a shared xeus for the emscripten build (#334)
* Switch to a shared xeus for the emscripten build * Add libxeus.so to the test directory * add libxeus.so to kernelspec * Update CMakeLists.txt
1 parent c0d4edc commit 2226ca0

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ option(XEUS_CPP_BUILD_STATIC "Build xeus-cpp static library" ON)
5454
option(XEUS_CPP_BUILD_SHARED "Split xcpp build into executable and library" ON)
5555
option(XEUS_CPP_BUILD_EXECUTABLE "Build the xcpp executable" ON)
5656

57-
option(XEUS_CPP_USE_SHARED_XEUS "Link xcpp with the xeus shared library (instead of the static library)" ON)
58-
option(XEUS_CPP_USE_SHARED_XEUS_CPP "Link xcpp with the xeus shared library (instead of the static library)" ON)
57+
option(XEUS_CPP_USE_SHARED_XEUS "Link xcpp with the xeus shared library (instead of the static library)" ON)
58+
option(XEUS_CPP_USE_SHARED_XEUS_CPP "Link xcpp with the xeus-cpp shared library (instead of the static library)" ON)
5959
option(XEUS_CPP_EMSCRIPTEN_WASM_BUILD "Build for wasm with emscripten" OFF)
6060

6161
# Test options
@@ -77,10 +77,11 @@ endif()
7777
if(EMSCRIPTEN)
7878
add_compile_definitions(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)
7979
message("Build with emscripten")
80+
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
8081
set(XEUS_CPP_BUILD_STATIC ON)
8182
set(XEUS_CPP_BUILD_SHARED OFF)
8283
set(XEUS_CPP_BUILD_EXECUTABLE OFF)
83-
set(XEUS_CPP_USE_SHARED_XEUS OFF)
84+
set(XEUS_CPP_USE_SHARED_XEUS ON)
8485
set(XEUS_CPP_USE_SHARED_XEUS_CPP OFF)
8586
# ENV (https://github.com/emscripten-core/emscripten/commit/6d9681ad04f60b41ef6345ab06c29bbc9eeb84e0)
8687
set(EMSCRIPTEN_FEATURES "${EMSCRIPTEN_FEATURES} -s \"EXPORTED_RUNTIME_METHODS=[ENV']\"")
@@ -546,4 +547,4 @@ if(EMSCRIPTEN)
546547
"$<TARGET_FILE_DIR:xcpp>/xcpp.wasm"
547548
"$<TARGET_FILE_DIR:xcpp>/xcpp.data"
548549
DESTINATION ${CMAKE_INSTALL_BINDIR})
549-
endif ()
550+
endif ()

share/jupyter/kernels/xcpp17/wasm_kernel.json.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"metadata": {
1111
"debugger": false,
1212
"shared": {
13+
"libxeus.so": "lib/libxeus.so",
1314
"libclangCppInterOp.so": "lib/libclangCppInterOp.so"
1415
}
1516
}

share/jupyter/kernels/xcpp20/wasm_kernel.json.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"metadata": {
1111
"debugger": false,
1212
"shared": {
13+
"libxeus.so": "lib/libxeus.so",
1314
"libclangCppInterOp.so": "lib/libclangCppInterOp.so"
1415
}
1516
}

share/jupyter/kernels/xcpp23/wasm_kernel.json.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"metadata": {
1111
"debugger": false,
1212
"shared": {
13+
"libxeus.so": "lib/libxeus.so",
1314
"libclangCppInterOp.so": "lib/libclangCppInterOp.so"
1415
}
1516
}

test/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ if(EMSCRIPTEN)
9090
${CMAKE_CURRENT_BINARY_DIR}/libclangCppInterOp.so
9191
COMMENT "Copying libclangCppInterOp.so to the test directory"
9292
)
93+
94+
add_custom_command(TARGET test_xeus_cpp POST_BUILD
95+
COMMAND ${CMAKE_COMMAND} -E copy
96+
${CMAKE_INSTALL_PREFIX}/lib/libxeus.so
97+
${CMAKE_CURRENT_BINARY_DIR}/libxeus.so
98+
COMMENT "Copying libxeus.so to the test directory"
99+
)
93100
else()
94101
find_package(Threads)
95102

0 commit comments

Comments
 (0)