Skip to content

Commit 35296d3

Browse files
committed
Build/link to Rust iceberg-c library
1 parent cd82335 commit 35296d3

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

cmake_modules/IcebergThirdpartyToolchain.cmake

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,38 @@ endfunction()
198198
if(ICEBERG_AVRO)
199199
resolve_avro_dependency()
200200
endif()
201+
202+
# ----------------------------------------------------------------------
203+
# Apache Iceberg (Rust)
204+
205+
function(resolve_iceberg_c_dependency)
206+
prepare_fetchcontent()
207+
208+
fetchcontent_declare(IcebergC
209+
${FC_DECLARE_COMMON_OPTIONS}
210+
GIT_REPOSITORY https://github.com/lidavidm/iceberg-rust.git
211+
GIT_TAG add-c-binding
212+
SOURCE_SUBDIR
213+
bindings/c
214+
FIND_PACKAGE_ARGS)
215+
216+
fetchcontent_makeavailable(IcebergC)
217+
218+
if(icebergc_SOURCE_DIR)
219+
message(STATUS "Using vendored Iceberg C library")
220+
set(ICEBERG_C_VENDORED TRUE)
221+
else()
222+
message(STATUS "Using system Iceberg C library")
223+
set(ICEBERG_C_VENDORED FALSE)
224+
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES IcebergC)
225+
endif()
226+
227+
set(ICEBERG_SYSTEM_DEPENDENCIES
228+
${ICEBERG_SYSTEM_DEPENDENCIES}
229+
PARENT_SCOPE)
230+
set(ICEBERG_C_VENDORED
231+
${ICEBERG_C_VENDORED}
232+
PARENT_SCOPE)
233+
endfunction()
234+
235+
resolve_iceberg_c_dependency()

src/iceberg/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ add_iceberg_lib(iceberg
2121
SOURCES
2222
${ICEBERG_SOURCES}
2323
PRIVATE_INCLUDES
24-
${ICEBERG_INCLUDES})
24+
${ICEBERG_INCLUDES}
25+
SHARED_LINK_LIBS
26+
IcebergC::iceberg_c_shared
27+
STATIC_LINK_LIBS
28+
IcebergC::iceberg_c_static)
2529

2630
iceberg_install_all_headers(iceberg)
2731

0 commit comments

Comments
 (0)