Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid bundling any parquet/json or fts code when building for loadable extensions #1860

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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