Skip to content

Commit ef76fea

Browse files
committed
Add support for shared build for xeus
1 parent feaf8d0 commit ef76fea

File tree

3 files changed

+42
-19
lines changed

3 files changed

+42
-19
lines changed

recipes/recipes_emscripten/xeus/build.sh

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,14 @@
22
mkdir build
33
cd build
44

5-
if [[ $target_platform == "emscripten-wasm32" ]]; then
6-
export USE_WASM=ON
7-
else
8-
export USE_WASM=OFF
9-
fi
10-
115
# Configure step
12-
cmake ${CMAKE_ARGS} .. \
13-
-GNinja \
14-
-DCMAKE_BUILD_TYPE=Release \
15-
-DCMAKE_PREFIX_PATH=$PREFIX \
6+
emcmake cmake .. \
7+
-DCMAKE_BUILD_TYPE=Release \
8+
-DCMAKE_PREFIX_PATH=$PREFIX \
169
-DCMAKE_INSTALL_PREFIX=$PREFIX \
17-
-DXEUS_EMSCRIPTEN_WASM_BUILD=$USE_WASM \
18-
-DCMAKE_FIND_DEBUG_MODE=OFF \
19-
20-
# -Dnlohmann_json_DIR=$PREFIX/lib/cmake/nlohmann_json \
21-
# -Dxtl_DIR=$PREFIX/share/cmake/xtl \
10+
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
11+
-DXEUS_BUILD_SHARED_LIBS=ON \
12+
-DXEUS_BUILD_STATIC_LIBS=ON
2213

23-
# Build step
24-
ninja install
14+
# Build & Install step
15+
emmake make -j8 install
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index a8147d3..12cee40 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -59,8 +59,12 @@ option(XEUS_BUILD_TESTS "xeus test suite" OFF)
6+
# ===================================
7+
8+
if(EMSCRIPTEN)
9+
- SET(XEUS_BUILD_SHARED_LIBS OFF)
10+
- SET(XEUS_BUILD_STATIC_LIBS ON)
11+
+ if (XEUS_BUILD_SHARED_LIBS)
12+
+ set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
13+
+ set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-s SIDE_MODULE=1")
14+
+ set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-s SIDE_MODULE=1")
15+
+ set(CMAKE_STRIP FALSE)
16+
+ endif ()
17+
endif()
18+
19+
# Print build configuration
20+
@@ -258,6 +262,9 @@ macro(xeus_create_target target_name linkage output_name)
21+
22+
if (EMSCRIPTEN)
23+
target_compile_definitions(${target_name} PRIVATE XEUS_EMSCRIPTEN_WASM_BUILD)
24+
+ if (XEUS_BUILD_SHARED_LIBS)
25+
+ set_target_properties(${target_name} PROPERTIES NO_SONAME 1)
26+
+ endif ()
27+
xeus_wasm_compile_options(${target_name})
28+
endif()
29+
endmacro()

recipes/recipes_emscripten/xeus/recipe.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,24 @@ package:
88
source:
99
url: https://github.com/jupyter-xeus/xeus/archive/refs/tags/${{ version }}.tar.gz
1010
sha256: c94008416ae5a54b1fee80a004ecea70cd041e6bd5942e6acebcb878b96c1ec1
11+
patches:
12+
- patches/shared.patch
1113

1214
build:
13-
number: 0
15+
number: 1
1416

1517
requirements:
1618
build:
1719
- ${{ compiler("cxx") }}
1820
- cmake
19-
- ninja
21+
- make
2022
host:
2123
- nlohmann_json
2224

2325
tests:
2426
- script:
2527
- test -f $PREFIX/lib/libxeus.a
28+
- test -f $PREFIX/lib/libxeus.so
2629
- test -f $PREFIX/include/xeus/xeus.hpp
2730
about:
2831
license: BSD-3-Clause

0 commit comments

Comments
 (0)