Skip to content

Commit 652791b

Browse files
authored
make xeus-sqlite a main module (emscripten-forge#2504)
* make xeus-sqlite a main module * Update build.sh * Update recipe.yaml * Update CMakeLists.txt * Update CMakeLists.txt * Update recipe.yaml * Update build.sh
1 parent 4be0d78 commit 652791b

3 files changed

Lines changed: 22 additions & 13 deletions

File tree

recipes/recipes_emscripten/xeus-sqlite/CMakeLists.txt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ set(CMAKE_FIND_APPBUNDLE NEVER)
2323
set(CMAKE_PROGRAM_PATH ${CMAKE_PREFIX_PATH})
2424
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2525

26+
message(STATUS "using custom cmakelists")
27+
28+
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) # does not need to be global :)
29+
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-s SIDE_MODULE=1")
30+
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-s SIDE_MODULE=1")
31+
set(CMAKE_STRIP FALSE) # used by default in pybind11 on .so modules # only for needed when using pybind11
32+
33+
2634
# Versioning
2735
# ==========
2836

@@ -77,10 +85,8 @@ set(tabulate_REQUIRED_VERSION 1.5)
7785
find_package(SQLite3 REQUIRED)
7886
find_package(SQLiteCpp REQUIRED)
7987
find_package(Threads REQUIRED)
80-
find_package(xvega REQUIRED)
8188
find_package(xvega-bindings ${xvega_bindings_REQUIRED_VERSION} REQUIRED)
8289
find_package(tabulate ${tabulate_REQUIRED_VERSION} REQUIRED)
83-
find_package(nlohmann_json REQUIRED)
8490

8591
add_definitions(-DSQLITE_ENABLE_EXPLAIN_COMMENTS=1 -DSQLITE_DEBUG=1 -DSQLITE_MEMDEBUG=1)
8692

@@ -215,12 +221,10 @@ macro(xsql_create_target target_name linkage output_name)
215221
set(XSQL_XEUS_TARGET xeus-static)
216222
endif ()
217223

218-
message("XVEGA_STATIC_LIBRARY= ${XVEGA_STATIC_LIBRARY}")
219224
target_link_libraries(${target_name} PUBLIC
220225
${XSQL_XEUS_TARGET}
221-
${XVEGA_STATIC_LIBRARY}
226+
xvega
222227
SQLiteCpp
223-
nlohmann_json::nlohmann_json
224228
)
225229

226230
if(NOT EMSCRIPTEN)
@@ -290,18 +294,24 @@ if(EMSCRIPTEN)
290294
find_package(xeus-lite REQUIRED)
291295
include(WasmBuildOptions)
292296
add_executable(xsqlite src/main_emscripten_kernel.cpp )
293-
target_link_libraries(xsqlite PRIVATE xeus-sqlite-static xeus-lite nlohmann_json::nlohmann_json)
297+
target_link_libraries(xsqlite PRIVATE xeus-sqlite-static xeus-lite)
294298
target_compile_features(xsqlite PRIVATE cxx_std_17)
295299

296300
xeus_wasm_compile_options(xsqlite)
297301
xeus_wasm_link_options(xsqlite "web,worker")
302+
303+
target_compile_options(xsqlite
304+
PUBLIC "SHELL: -s MAIN_MODULE=1"
305+
)
298306

299307
target_link_options(xsqlite
300308
PUBLIC "SHELL: -s FETCH=1"
301309
PUBLIC "SHELL: -s NO_EXIT_RUNTIME=1"
302310
PUBLIC "SHELL: -s 'ASYNCIFY_IMPORTS=[\"async_ems_init_idbfs\", \"async_ems_sync_db\"]'"
303311
PUBLIC "SHELL: -s FORCE_FILESYSTEM=1"
312+
PUBLIC "SHELL: -s MAIN_MODULE=1"
304313
)
314+
# target_link_libraries(xsqlite idbfs.js)
305315
endif()
306316

307317
# Installation
@@ -382,5 +392,4 @@ if(EMSCRIPTEN)
382392
"$<TARGET_FILE_DIR:xsqlite>/xsqlite.js"
383393
"$<TARGET_FILE_DIR:xsqlite>/xsqlite.wasm"
384394
DESTINATION ${CMAKE_INSTALL_BINDIR})
385-
386-
endif()
395+
endif()

recipes/recipes_emscripten/xeus-sqlite/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export CMAKE_PREFIX_PATH=$PREFIX
55
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
66

77
# # todo move to xeus-sqlite itself
8-
# cp $RECIPE_DIR/CMakeLists.txt .
8+
#cp $RECIPE_DIR/CMakeLists.txt .
99

1010
ls $PREFIX/lib
1111
echo "BUILDING"

recipes/recipes_emscripten/xeus-sqlite/recipe.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ package:
66
version: ${{ version }}
77

88
source:
9-
- url: https://github.com/jupyter-xeus/xeus-sqlite/archive/refs/tags/${{ version }}.tar.gz
10-
sha256: afe48c1808e8268dcfbdffc3b6deacbd8ac1d16ca23e3c0c7680371b61a295ba
11-
9+
- url: https://github.com/jupyter-xeus/xeus-sqlite/archive/refs/tags/${{ version }}.tar.gz
10+
sha256: afe48c1808e8268dcfbdffc3b6deacbd8ac1d16ca23e3c0c7680371b61a295ba
11+
- path: CMakeLists.txt
1212
build:
13-
number: 0
13+
number: 1
1414

1515
requirements:
1616
build:

0 commit comments

Comments
 (0)