Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions cmake_modules/IcebergThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,31 @@ function(resolve_nanoarrow_dependency)
endfunction()

resolve_nanoarrow_dependency()

# ----------------------------------------------------------------------
# nlohmann-json

function(resolve_nlohmann_json_dependency)
prepare_fetchcontent()

set(JSON_BuildTests
OFF
CACHE BOOL "" FORCE)

fetchcontent_declare(nlohmann_json
${FC_DECLARE_COMMON_OPTIONS}
URL "https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz"
)
fetchcontent_makeavailable(nlohmann_json)

set_target_properties(nlohmann_json
PROPERTIES OUTPUT_NAME "iceberg_vendored_nlohmann_json"
POSITION_INDEPENDENT_CODE ON)
install(TARGETS nlohmann_json
EXPORT iceberg_targets
RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
endfunction()

resolve_nlohmann_json_dependency()
12 changes: 8 additions & 4 deletions src/iceberg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ set(ICEBERG_SHARED_BUILD_INTERFACE_LIBS)
set(ICEBERG_STATIC_INSTALL_INTERFACE_LIBS)
set(ICEBERG_SHARED_INSTALL_INTERFACE_LIBS)

list(APPEND ICEBERG_STATIC_BUILD_INTERFACE_LIBS nanoarrow::nanoarrow)
list(APPEND ICEBERG_SHARED_BUILD_INTERFACE_LIBS nanoarrow::nanoarrow)
list(APPEND ICEBERG_STATIC_INSTALL_INTERFACE_LIBS "Iceberg::nanoarrow")
list(APPEND ICEBERG_SHARED_INSTALL_INTERFACE_LIBS "Iceberg::nanoarrow")
list(APPEND ICEBERG_STATIC_BUILD_INTERFACE_LIBS nanoarrow::nanoarrow
nlohmann_json::nlohmann_json)
list(APPEND ICEBERG_SHARED_BUILD_INTERFACE_LIBS nanoarrow::nanoarrow
nlohmann_json::nlohmann_json)
list(APPEND ICEBERG_STATIC_INSTALL_INTERFACE_LIBS "Iceberg::nanoarrow"
"Iceberg::nlohmann_json")
list(APPEND ICEBERG_SHARED_INSTALL_INTERFACE_LIBS "Iceberg::nanoarrow"
"Iceberg::nlohmann_json")

add_iceberg_lib(iceberg
SOURCES
Expand Down
9 changes: 9 additions & 0 deletions src/iceberg/arrow_c_data_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <string>
#include <utility>

#include <nlohmann/json.hpp>

namespace iceberg::internal {

std::pair<ArrowSchema, ArrowArray> CreateExampleArrowSchemaAndArrayByNanoarrow() {
Expand Down Expand Up @@ -73,4 +75,11 @@ std::pair<ArrowSchema, ArrowArray> CreateExampleArrowSchemaAndArrayByNanoarrow()
return {out_schema, out_array};
}

void TestNlohmannJsonCompile() {
nlohmann::json j;
j["name"] = "foo";
j["age"] = 30;
j["city"] = "New York";
}

} // namespace iceberg::internal
Loading