@@ -23,6 +23,14 @@ set(CMAKE_FIND_APPBUNDLE NEVER)
2323set (CMAKE_PROGRAM_PATH ${CMAKE_PREFIX_PATH} )
2424set (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)
7785find_package (SQLite3 REQUIRED )
7886find_package (SQLiteCpp REQUIRED )
7987find_package (Threads REQUIRED )
80- find_package (xvega REQUIRED )
8188find_package (xvega-bindings ${xvega_bindings_REQUIRED_VERSION} REQUIRED )
8289find_package (tabulate ${tabulate_REQUIRED_VERSION} REQUIRED )
83- find_package (nlohmann_json REQUIRED )
8490
8591add_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)
305315endif ()
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 ()
0 commit comments