Skip to content

Build/link to Rust iceberg-c library #45

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

Closed
wants to merge 1 commit into from
Closed
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
35 changes: 35 additions & 0 deletions cmake_modules/IcebergThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,38 @@ endfunction()
if(ICEBERG_AVRO)
resolve_avro_dependency()
endif()

# ----------------------------------------------------------------------
# Apache Iceberg (Rust)

function(resolve_iceberg_c_dependency)
prepare_fetchcontent()

fetchcontent_declare(IcebergC
${FC_DECLARE_COMMON_OPTIONS}
GIT_REPOSITORY https://github.com/lidavidm/iceberg-rust.git
GIT_TAG add-c-binding
SOURCE_SUBDIR
bindings/c
FIND_PACKAGE_ARGS)

fetchcontent_makeavailable(IcebergC)

if(icebergc_SOURCE_DIR)
message(STATUS "Using vendored Iceberg C library")
set(ICEBERG_C_VENDORED TRUE)
else()
message(STATUS "Using system Iceberg C library")
set(ICEBERG_C_VENDORED FALSE)
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES IcebergC)
endif()

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

resolve_iceberg_c_dependency()
6 changes: 5 additions & 1 deletion src/iceberg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ add_iceberg_lib(iceberg
SOURCES
${ICEBERG_SOURCES}
PRIVATE_INCLUDES
${ICEBERG_INCLUDES})
${ICEBERG_INCLUDES}
SHARED_LINK_LIBS
IcebergC::iceberg_c_shared
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to make iceberg library mainly interface-oriented and add a new iceberg-rust-cxx-binding library to plug in the implementation? It is still unclear to me the extent of plug-ability in this approach.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on if we want to use Rust definitions for things like data types too, or if we just want to use it to implement talking to catalogs etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that leveraging rust library is a good approach to move fast. However, there are still users that don't have a rust toolchain, or do not want to add extra dependencies introduced by the rust library.

STATIC_LINK_LIBS
IcebergC::iceberg_c_static)

iceberg_install_all_headers(iceberg)

Expand Down
Loading