You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by fo...@apache.org on 2025/05/19 19:32:20 UTC

(iceberg-cpp) branch main updated: feat: add zlib dependency (#101)

This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 1c4c047  feat: add zlib dependency (#101)
1c4c047 is described below

commit 1c4c047d712443eecee0ac35ba52a7c43abee180
Author: dongxiao <52...@qq.com>
AuthorDate: Tue May 20 03:32:16 2025 +0800

    feat: add zlib dependency (#101)
    
    find zlib package in ThirdpartyToolchain.cmake and enable
    ARROW_WITH_ZLIB
    
    ---------
    
    Co-authored-by: xiao.dong <xi...@clickzetta.com>
---
 cmake_modules/IcebergThirdpartyToolchain.cmake | 41 +++++++++++++++++++-------
 1 file changed, 30 insertions(+), 11 deletions(-)

diff --git a/cmake_modules/IcebergThirdpartyToolchain.cmake b/cmake_modules/IcebergThirdpartyToolchain.cmake
index b4b4563..9b4eccd 100644
--- a/cmake_modules/IcebergThirdpartyToolchain.cmake
+++ b/cmake_modules/IcebergThirdpartyToolchain.cmake
@@ -86,6 +86,12 @@ function(resolve_arrow_dependency)
   set(ARROW_DEPENDENCY_SOURCE
       "BUNDLED"
       CACHE STRING "" FORCE)
+  set(ARROW_WITH_ZLIB
+      ON
+      CACHE BOOL "" FORCE)
+  set(ZLIB_SOURCE
+      "SYSTEM"
+      CACHE STRING "" FORCE)
 
   fetchcontent_declare(VendoredArrow
                        ${FC_DECLARE_COMMON_OPTIONS}
@@ -153,10 +159,6 @@ function(resolve_arrow_dependency)
       PARENT_SCOPE)
 endfunction()
 
-if(ICEBERG_BUILD_BUNDLE)
-  resolve_arrow_dependency()
-endif()
-
 # ----------------------------------------------------------------------
 # Apache Avro
 
@@ -211,7 +213,6 @@ function(resolve_avro_dependency)
     if(Snappy_FOUND)
       list(APPEND ICEBERG_SYSTEM_DEPENDENCIES Snappy)
     endif()
-    list(APPEND ICEBERG_SYSTEM_DEPENDENCIES ZLIB)
   else()
     set(AVRO_VENDORED FALSE)
     list(APPEND ICEBERG_SYSTEM_DEPENDENCIES Avro)
@@ -225,10 +226,6 @@ function(resolve_avro_dependency)
       PARENT_SCOPE)
 endfunction()
 
-if(ICEBERG_BUILD_BUNDLE)
-  resolve_avro_dependency()
-endif()
-
 # ----------------------------------------------------------------------
 # Nanoarrow
 
@@ -251,8 +248,6 @@ function(resolve_nanoarrow_dependency)
           LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
 endfunction()
 
-resolve_nanoarrow_dependency()
-
 # ----------------------------------------------------------------------
 # nlohmann-json
 
@@ -284,4 +279,28 @@ function(resolve_nlohmann_json_dependency)
           LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}")
 endfunction()
 
+# ----------------------------------------------------------------------
+# zlib
+
+function(resolve_zlib_dependency)
+  # use system zlib, zlib is required by arrow and avro
+  find_package(ZLIB REQUIRED)
+  if(ZLIB_FOUND)
+    list(APPEND ICEBERG_SYSTEM_DEPENDENCIES ZLIB)
+    message(STATUS "ZLIB_FOUND ZLIB_LIBRARIES:${ZLIB_LIBRARIES} ZLIB_INCLUDE_DIR:${ZLIB_INCLUDE_DIR}"
+    )
+    set(ICEBERG_SYSTEM_DEPENDENCIES
+        ${ICEBERG_SYSTEM_DEPENDENCIES}
+        PARENT_SCOPE)
+  endif()
+
+endfunction()
+
+resolve_zlib_dependency()
+resolve_nanoarrow_dependency()
 resolve_nlohmann_json_dependency()
+
+if(ICEBERG_BUILD_BUNDLE)
+  resolve_arrow_dependency()
+  resolve_avro_dependency()
+endif()