From 2652f4c138b590e38286328bd8c5eb09e9548d2f Mon Sep 17 00:00:00 2001 From: "xiao.dong" Date: Mon, 19 May 2025 15:27:53 +0800 Subject: [PATCH 1/3] feat: add zlib dependency --- .../IcebergThirdpartyToolchain.cmake | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/cmake_modules/IcebergThirdpartyToolchain.cmake b/cmake_modules/IcebergThirdpartyToolchain.cmake index b4b456305..6d0a830ae 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,25 @@ 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}") + endif() + +endfunction() + +resolve_zlib_dependency() +resolve_nanoarrow_dependency() resolve_nlohmann_json_dependency() + +if(ICEBERG_BUILD_BUNDLE) + resolve_arrow_dependency() + resolve_avro_dependency() +endif() + From d01396135d9ff1ced67bf0a649656c04502d6d53 Mon Sep 17 00:00:00 2001 From: "xiao.dong" Date: Mon, 19 May 2025 17:37:38 +0800 Subject: [PATCH 2/3] feat: modify ICEBERG_SYSTEM_DEPENDENCIES after found zlib --- cmake_modules/IcebergThirdpartyToolchain.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake_modules/IcebergThirdpartyToolchain.cmake b/cmake_modules/IcebergThirdpartyToolchain.cmake index 6d0a830ae..63d1f0b2c 100644 --- a/cmake_modules/IcebergThirdpartyToolchain.cmake +++ b/cmake_modules/IcebergThirdpartyToolchain.cmake @@ -288,6 +288,9 @@ function(resolve_zlib_dependency) 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() From ccfb41cd6f221810cb558998c0d4c864e19a908b Mon Sep 17 00:00:00 2001 From: "xiao.dong" Date: Mon, 19 May 2025 18:13:21 +0800 Subject: [PATCH 3/3] fix cmake format --- cmake_modules/IcebergThirdpartyToolchain.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake_modules/IcebergThirdpartyToolchain.cmake b/cmake_modules/IcebergThirdpartyToolchain.cmake index 63d1f0b2c..9b4eccd56 100644 --- a/cmake_modules/IcebergThirdpartyToolchain.cmake +++ b/cmake_modules/IcebergThirdpartyToolchain.cmake @@ -287,7 +287,8 @@ function(resolve_zlib_dependency) 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}") + message(STATUS "ZLIB_FOUND ZLIB_LIBRARIES:${ZLIB_LIBRARIES} ZLIB_INCLUDE_DIR:${ZLIB_INCLUDE_DIR}" + ) set(ICEBERG_SYSTEM_DEPENDENCIES ${ICEBERG_SYSTEM_DEPENDENCIES} PARENT_SCOPE) @@ -303,4 +304,3 @@ if(ICEBERG_BUILD_BUNDLE) resolve_arrow_dependency() resolve_avro_dependency() endif() -