Skip to content

Commit

Permalink
Avoid bundling any parquet/json or fts code when building for loadabl…
Browse files Browse the repository at this point in the history
…e extensions
  • Loading branch information
carlopi committed Sep 20, 2024
1 parent 0245fd9 commit cbac44c
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cbac44c

Please sign in to comment.