diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 2e24d4eb8..b42cb25a0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -236,31 +236,39 @@ add_library( ${CMAKE_SOURCE_DIR}/src/webdb.cc ${CMAKE_SOURCE_DIR}/src/webdb_api.cc) -add_library( - duckdb_web_fts - ${CMAKE_SOURCE_DIR}/src/extensions/fts_extension.cc) +if (DUCKDB_WASM_LOADABLE_EXTENSIONS) + set(EXTENSION_CACHE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.ccache/extension") + set(JSON_EXTENSION_CACHE_FILE "${EXTENSION_CACHE_DIR}/json") + set(DUCKDB_WEB_JSON "") -add_library( - duckdb_web_parquet - ${CMAKE_SOURCE_DIR}/src/extensions/parquet_extension.cc) + target_link_libraries(duckdb_web duckdb arrow rapidjson ${THREAD_LIBS}) +else() + add_library( + duckdb_web_fts + ${CMAKE_SOURCE_DIR}/src/extensions/fts_extension.cc) -add_library( - duckdb_web_json - ${CMAKE_SOURCE_DIR}/src/extensions/json_extension.cc) + add_library( + duckdb_web_parquet + ${CMAKE_SOURCE_DIR}/src/extensions/parquet_extension.cc) -set(EXTENSION_CACHE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.ccache/extension") -set(JSON_EXTENSION_CACHE_FILE "${EXTENSION_CACHE_DIR}/json") + add_library( + duckdb_web_json + ${CMAKE_SOURCE_DIR}/src/extensions/json_extension.cc) -set(DUCKDB_WEB_JSON "") -if(EXISTS "${JSON_EXTENSION_CACHE_FILE}") - set(DUCKDB_WEB_JSON "duckdb_web_json") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDUCKDB_JSON_EXTENSION") -endif() + set(EXTENSION_CACHE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.ccache/extension") + set(JSON_EXTENSION_CACHE_FILE "${EXTENSION_CACHE_DIR}/json") + + set(DUCKDB_WEB_JSON "") + if(EXISTS "${JSON_EXTENSION_CACHE_FILE}") + set(DUCKDB_WEB_JSON "duckdb_web_json") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDUCKDB_JSON_EXTENSION") + endif() -target_link_libraries(duckdb_web duckdb duckdb_web_fts duckdb_web_parquet ${DUCKDB_WEB_JSON} arrow rapidjson ${THREAD_LIBS}) -target_link_libraries(duckdb_web_fts duckdb duckdb_fts) -target_link_libraries(duckdb_web_parquet duckdb duckdb_parquet) -target_link_libraries(duckdb_web_json duckdb duckdb_json) + target_link_libraries(duckdb_web duckdb duckdb_web_fts duckdb_web_parquet ${DUCKDB_WEB_JSON} arrow rapidjson ${THREAD_LIBS}) + target_link_libraries(duckdb_web_fts duckdb duckdb_fts) + target_link_libraries(duckdb_web_parquet duckdb duckdb_parquet) + target_link_libraries(duckdb_web_json duckdb duckdb_json) +endif() # --------------------------------------------------------------------------- # Emscripten