-
Notifications
You must be signed in to change notification settings - Fork 67
Add iceberg_arrow library #6
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
Changes from 28 commits
65021dc
f84b307
2cfd715
10ef3e5
200bd2f
b750758
4e766d9
2866d6e
5183981
312b13d
3c5bdfb
a6abfd4
8c09208
80e0a4b
5a064c9
93c4228
fdc0294
3f6df87
cbd661d
38a9259
59bb135
64c8e29
0d337bd
149ed21
2cb3dc9
d88b5ee
79bba23
be17441
254bebe
24acdac
e31ae78
4553485
9c065c6
343aa9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,8 @@ | |
| # Borrowed the file from Apache Arrow: | ||
| # https://github.com/apache/arrow/blob/main/cpp/cmake_modules/BuildUtils.cmake | ||
|
|
||
| include(CMakePackageConfigHelpers) | ||
|
|
||
| function(iceberg_install_cmake_package PACKAGE_NAME EXPORT_NAME) | ||
| set(CONFIG_CMAKE "${PACKAGE_NAME}Config.cmake") | ||
| set(BUILT_CONFIG_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_CMAKE}") | ||
|
|
@@ -37,12 +39,11 @@ function(iceberg_install_cmake_package PACKAGE_NAME EXPORT_NAME) | |
| FILE "${TARGETS_CMAKE}") | ||
| endfunction() | ||
|
|
||
| function(ADD_ICEBERG_LIB LIB_NAME) | ||
| function(add_iceberg_lib LIB_NAME) | ||
| set(options) | ||
| set(one_value_args | ||
| BUILD_SHARED | ||
| BUILD_STATIC | ||
| CMAKE_PACKAGE_NAME | ||
| INSTALL_ARCHIVE_DIR | ||
| INSTALL_LIBRARY_DIR | ||
| INSTALL_RUNTIME_DIR | ||
|
|
@@ -146,8 +147,8 @@ function(ADD_ICEBERG_LIB LIB_NAME) | |
| "$<INSTALL_INTERFACE:${ARG_SHARED_INSTALL_INTERFACE_LIBS}>" | ||
| PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS}) | ||
|
|
||
| install(TARGETS ${LIB_NAME}_shared ${INSTALL_IS_OPTIONAL} | ||
| EXPORT ${LIB_NAME}_targets | ||
| install(TARGETS ${LIB_NAME}_shared | ||
| EXPORT iceberg_targets | ||
| ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} | ||
| LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | ||
| RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} | ||
|
|
@@ -201,17 +202,26 @@ function(ADD_ICEBERG_LIB LIB_NAME) | |
| PUBLIC "$<BUILD_INTERFACE:${ARG_STATIC_LINK_LIBS}>") | ||
| endif() | ||
|
|
||
| install(TARGETS ${LIB_NAME}_static ${INSTALL_IS_OPTIONAL} | ||
| EXPORT ${LIB_NAME}_targets | ||
| install(TARGETS ${LIB_NAME}_static | ||
| EXPORT iceberg_targets | ||
| ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} | ||
| LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | ||
| RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} | ||
| INCLUDES | ||
| DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
| endif() | ||
|
|
||
| if(ARG_CMAKE_PACKAGE_NAME) | ||
| iceberg_install_cmake_package(${ARG_CMAKE_PACKAGE_NAME} ${LIB_NAME}_targets) | ||
| # generate export header file | ||
| string(TOUPPER ${LIB_NAME} LIB_NAME_UPPER) | ||
| if(BUILD_SHARED) | ||
| generate_export_header(${LIB_NAME}_shared BASE_NAME ${LIB_NAME_UPPER}) | ||
| target_compile_definitions(${LIB_NAME}_shared PUBLIC ${LIB_NAME}_shared_EXPORTS) | ||
|
||
| if(BUILD_STATIC) | ||
| target_compile_definitions(${LIB_NAME}_static | ||
| PUBLIC ${LIB_NAME_UPPER}_STATIC_DEFINE) | ||
| endif() | ||
| elseif(BUILD_STATIC) | ||
| generate_export_header(${LIB_NAME}_static BASE_NAME ${LIB_NAME_UPPER}) | ||
wgtmac marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| endif() | ||
|
|
||
| # Modify variable in calling scope | ||
|
|
@@ -221,3 +231,28 @@ function(ADD_ICEBERG_LIB LIB_NAME) | |
| PARENT_SCOPE) | ||
| endif() | ||
| endfunction() | ||
|
|
||
| function(iceberg_install_all_headers PATH) | ||
| set(options) | ||
| set(one_value_args) | ||
| set(multi_value_args PATTERN) | ||
| cmake_parse_arguments(ARG | ||
| "${options}" | ||
| "${one_value_args}" | ||
| "${multi_value_args}" | ||
| ${ARGN}) | ||
| if(NOT ARG_PATTERN) | ||
| set(ARG_PATTERN "*.h" "*.hpp") | ||
| endif() | ||
| file(GLOB CURRENT_DIRECTORY_HEADERS ${ARG_PATTERN}) | ||
|
|
||
| set(PUBLIC_HEADERS) | ||
| foreach(HEADER ${CURRENT_DIRECTORY_HEADERS}) | ||
| get_filename_component(HEADER_BASENAME ${HEADER} NAME) | ||
| if(HEADER_BASENAME MATCHES "internal") | ||
| continue() | ||
| endif() | ||
| list(APPEND PUBLIC_HEADERS ${HEADER}) | ||
| endforeach() | ||
| install(FILES ${PUBLIC_HEADERS} DESTINATION "${ICEBERG_INSTALL_INCLUDEDIR}/${PATH}") | ||
| endfunction() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # Accumulate all dependencies to provide suitable static link parameters to the | ||
| # third party libraries. | ||
| set(ICEBERG_SYSTEM_DEPENDENCIES) | ||
| set(ICEBERG_ARROW_INSTALL_INTERFACE_LIBS) | ||
|
|
||
| # ---------------------------------------------------------------------- | ||
| # Versions and URLs for toolchain builds | ||
|
|
||
| set(ICEBERG_ARROW_BUILD_VERSION "18.1.0") | ||
| set(ICEBERG_ARROW_BUILD_SHA256_CHECKSUM | ||
| "2dc8da5f8796afe213ecc5e5aba85bb82d91520eff3cf315784a52d0fa61d7fc") | ||
|
|
||
| if(DEFINED ENV{ICEBERG_ARROW_URL}) | ||
| set(ARROW_SOURCE_URL "$ENV{ICEBERG_ARROW_URL}") | ||
| else() | ||
| set(ARROW_SOURCE_URL | ||
| "https://www.apache.org/dyn/closer.lua?action=download&filename=/arrow/arrow-${ICEBERG_ARROW_BUILD_VERSION}/apache-arrow-${ICEBERG_ARROW_BUILD_VERSION}.tar.gz" | ||
| "https://downloads.apache.org/arrow/arrow-${ICEBERG_ARROW_BUILD_VERSION}/apache-arrow-${ICEBERG_ARROW_BUILD_VERSION}.tar.gz" | ||
| ) | ||
| endif() | ||
|
|
||
| # ---------------------------------------------------------------------- | ||
| # FetchContent | ||
|
|
||
| include(FetchContent) | ||
| set(FC_DECLARE_COMMON_OPTIONS) | ||
| if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28) | ||
| list(APPEND FC_DECLARE_COMMON_OPTIONS EXCLUDE_FROM_ALL TRUE) | ||
| endif() | ||
|
|
||
| macro(prepare_fetchcontent) | ||
| set(BUILD_SHARED_LIBS OFF) | ||
| set(BUILD_STATIC_LIBS ON) | ||
| set(CMAKE_COMPILE_WARNING_AS_ERROR FALSE) | ||
| set(CMAKE_EXPORT_NO_PACKAGE_REGISTRY TRUE) | ||
| set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
| endmacro() | ||
|
|
||
| # ---------------------------------------------------------------------- | ||
| # Apache Arrow | ||
|
|
||
| function(resolve_arrow_dependency) | ||
| prepare_fetchcontent() | ||
|
|
||
| set(ARROW_BUILD_SHARED | ||
| OFF | ||
| CACHE BOOL "" FORCE) | ||
| set(ARROW_BUILD_STATIC | ||
| ON | ||
| CACHE BOOL "" FORCE) | ||
| set(ARROW_FILESYSTEM | ||
| OFF | ||
| CACHE BOOL "" FORCE) | ||
| set(ARROW_SIMD_LEVEL | ||
| "NONE" | ||
| CACHE STRING "" FORCE) | ||
| set(ARROW_RUNTIME_SIMD_LEVEL | ||
| "NONE" | ||
| CACHE STRING "" FORCE) | ||
| set(ARROW_POSITION_INDEPENDENT_CODE | ||
| ON | ||
| CACHE BOOL "" FORCE) | ||
| set(ARROW_DEPENDENCY_SOURCE | ||
| "AUTO" | ||
| CACHE STRING "" FORCE) | ||
|
|
||
| fetchcontent_declare(Arrow | ||
wgtmac marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ${FC_DECLARE_COMMON_OPTIONS} | ||
| URL ${ARROW_SOURCE_URL} | ||
| URL_HASH "SHA256=${ICEBERG_ARROW_BUILD_SHA256_CHECKSUM}" | ||
| SOURCE_SUBDIR | ||
| cpp | ||
| FIND_PACKAGE_ARGS | ||
| NAMES | ||
| Arrow | ||
| CONFIG) | ||
|
|
||
| # Add Arrow cmake modules to the search path | ||
| list(PREPEND CMAKE_MODULE_PATH | ||
| ${CMAKE_CURRENT_BINARY_DIR}/_deps/arrow-src/cpp/cmake_modules) | ||
wgtmac marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| fetchcontent_makeavailable(Arrow) | ||
|
|
||
| if(arrow_SOURCE_DIR) | ||
| if(NOT TARGET Arrow::arrow_static) | ||
| add_library(Arrow::arrow_static INTERFACE IMPORTED) | ||
| target_link_libraries(Arrow::arrow_static INTERFACE arrow_static) | ||
| target_include_directories(Arrow::arrow_static | ||
| INTERFACE ${arrow_BINARY_DIR}/src | ||
| ${arrow_SOURCE_DIR}/cpp/src) | ||
| endif() | ||
|
|
||
| set(ARROW_VENDORED TRUE) | ||
| set_target_properties(arrow_static PROPERTIES OUTPUT_NAME "iceberg_vendored_arrow") | ||
| install(TARGETS arrow_static | ||
| EXPORT iceberg_targets | ||
| RUNTIME DESTINATION "${ICEBERG_INSTALL_BINDIR}" | ||
| ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}" | ||
| LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}") | ||
| else() | ||
| set(ARROW_VENDORED FALSE) | ||
| list(APPEND ICEBERG_SYSTEM_DEPENDENCIES Arrow) | ||
| endif() | ||
|
|
||
| set(ICEBERG_SYSTEM_DEPENDENCIES | ||
| ${ICEBERG_SYSTEM_DEPENDENCIES} | ||
| PARENT_SCOPE) | ||
| set(ARROW_VENDORED | ||
| ${ARROW_VENDORED} | ||
| PARENT_SCOPE) | ||
| endfunction() | ||
|
|
||
| if(ICEBERG_ARROW) | ||
| resolve_arrow_dependency() | ||
| endif() | ||
Uh oh!
There was an error while loading. Please reload this page.