Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Install ZLIB
- name: Install dependencies
shell: cmd
run: |
vcpkg install zlib:x64-windows
vcpkg install zlib:x64-windows nlohmann-json:x64-windows nanoarrow:x64-windows
- name: Build Iceberg
shell: cmd
run: |
Expand Down
90 changes: 69 additions & 21 deletions cmake_modules/IcebergThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,41 @@ function(resolve_nanoarrow_dependency)
fetchcontent_declare(nanoarrow
${FC_DECLARE_COMMON_OPTIONS}
URL "https://dlcdn.apache.org/arrow/apache-arrow-nanoarrow-0.7.0/apache-arrow-nanoarrow-0.7.0.tar.gz"
)
FIND_PACKAGE_ARGS
NAMES
nanoarrow
CONFIG)
fetchcontent_makeavailable(nanoarrow)

set_target_properties(nanoarrow_static
PROPERTIES OUTPUT_NAME "iceberg_vendored_nanoarrow"
POSITION_INDEPENDENT_CODE ON)
install(TARGETS nanoarrow_static
EXPORT iceberg_targets
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
if(nanoarrow_SOURCE_DIR)
if(NOT TARGET nanoarrow::nanoarrow_static)
add_library(nanoarrow::nanoarrow_static INTERFACE IMPORTED)
target_link_libraries(nanoarrow::nanoarrow_static INTERFACE nanoarrow_static)
target_include_directories(nanoarrow::nanoarrow_static
INTERFACE ${nanoarrow_BINARY_DIR}
${nanoarrow_SOURCE_DIR})
endif()

set(NANOARROW_VENDORED TRUE)
set_target_properties(nanoarrow_static
PROPERTIES OUTPUT_NAME "iceberg_vendored_nanoarrow"
POSITION_INDEPENDENT_CODE ON)
install(TARGETS nanoarrow_static
EXPORT iceberg_targets
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
else()
set(NANOARROW_VENDORED FALSE)
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES nanoarrow)
endif()

set(ICEBERG_SYSTEM_DEPENDENCIES
${ICEBERG_SYSTEM_DEPENDENCIES}
PARENT_SCOPE)
set(NANOARROW_VENDORED
${NANOARROW_VENDORED}
PARENT_SCOPE)
endfunction()

# ----------------------------------------------------------------------
Expand All @@ -264,22 +288,46 @@ function(resolve_nlohmann_json_dependency)
fetchcontent_declare(nlohmann_json
${FC_DECLARE_COMMON_OPTIONS}
URL "https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz"
)
FIND_PACKAGE_ARGS
NAMES
nlohmann_json
CONFIG)
fetchcontent_makeavailable(nlohmann_json)

set_target_properties(nlohmann_json
PROPERTIES OUTPUT_NAME "iceberg_vendored_nlohmann_json"
POSITION_INDEPENDENT_CODE ON)
if(MSVC_TOOLCHAIN)
set(NLOHMANN_NATVIS_FILE ${nlohmann_json_SOURCE_DIR}/nlohmann_json.natvis)
install(FILES ${NLOHMANN_NATVIS_FILE} DESTINATION .)
if(nlohmann_json_SOURCE_DIR)
if(NOT TARGET nlohmann_json::nlohmann_json)
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
target_link_libraries(nlohmann_json::nlohmann_json INTERFACE nlohmann_json)
target_include_directories(nlohmann_json::nlohmann_json
INTERFACE ${nlohmann_json_BINARY_DIR}
${nlohmann_json_SOURCE_DIR})
endif()

set(NLOHMANN_JSON_VENDORED TRUE)
set_target_properties(nlohmann_json
PROPERTIES OUTPUT_NAME "iceberg_vendored_nlohmann_json"
POSITION_INDEPENDENT_CODE ON)
if(MSVC_TOOLCHAIN)
set(NLOHMANN_NATVIS_FILE ${nlohmann_json_SOURCE_DIR}/nlohmann_json.natvis)
install(FILES ${NLOHMANN_NATVIS_FILE} DESTINATION .)
endif()

install(TARGETS nlohmann_json
EXPORT iceberg_targets
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
else()
set(NLOHMANN_JSON_VENDORED FALSE)
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES nlohmann_json)
endif()

install(TARGETS nlohmann_json
EXPORT iceberg_targets
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
set(ICEBERG_SYSTEM_DEPENDENCIES
${ICEBERG_SYSTEM_DEPENDENCIES}
PARENT_SCOPE)
set(NLOHMANN_JSON_VENDORED
${NLOHMANN_JSON_VENDORED}
PARENT_SCOPE)
endfunction()

# ----------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions src/iceberg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ list(APPEND
ZLIB::ZLIB)
list(APPEND
ICEBERG_STATIC_INSTALL_INTERFACE_LIBS
"Iceberg::nanoarrow_static"
"Iceberg::nlohmann_json"
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,Iceberg::nanoarrow_static,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_static>,nanoarrow::nanoarrow_static,nanoarrow::nanoarrow_shared>>"
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,Iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>"
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,Iceberg::spdlog,spdlog::spdlog>")
list(APPEND
ICEBERG_SHARED_INSTALL_INTERFACE_LIBS
"Iceberg::nanoarrow_shared"
"Iceberg::nlohmann_json"
"$<IF:$<BOOL:${NANOARROW_VENDORED}>,Iceberg::nanoarrow_shared,$<IF:$<TARGET_EXISTS:nanoarrow::nanoarrow_shared>,nanoarrow::nanoarrow_shared,nanoarrow::nanoarrow_static>>"
"$<IF:$<BOOL:${NLOHMANN_JSON_VENDORED}>,Iceberg::nlohmann_json,$<IF:$<TARGET_EXISTS:nlohmann_json::nlohmann_json>,nlohmann_json::nlohmann_json,nlohmann_json::nlohmann_json>>"
"$<IF:$<BOOL:${SPDLOG_VENDORED}>,Iceberg::spdlog,spdlog::spdlog>")

add_iceberg_lib(iceberg
Expand Down
Loading