-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add libiceberg_arrow - use single config file with three separate targets to support components - add fetchcontent support
- Loading branch information
Showing
15 changed files
with
443 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# 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_VENDOR_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") | ||
set(ARROW_VENDORED TRUE) | ||
|
||
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.cgi?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" | ||
"https://github.com/apache/arrow/releases/download/apache-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) | ||
endmacro() | ||
|
||
# ---------------------------------------------------------------------- | ||
# Apache Arrow | ||
|
||
function(resolve_arrow_dependency) | ||
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) | ||
|
||
fetchcontent_declare(Arrow | ||
${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) | ||
|
||
fetchcontent_makeavailable(Arrow) | ||
|
||
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_SOURCE_DIR}/cpp/src | ||
${arrow_BINARY_DIR}/src) | ||
endif() | ||
|
||
fetchcontent_getproperties(Arrow) | ||
if(arrow_SOURCE_DIR) | ||
set(ARROW_VENDORED TRUE) | ||
install(TARGETS arrow_static | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | ||
ARCHIVE DESTINATION "${ICEBERG_INSTALL_LIBDIR}" | ||
LIBRARY DESTINATION "${ICEBERG_INSTALL_LIBDIR}") | ||
|
||
get_target_property(ARROW_STATIC_LIB arrow_static OUTPUT_NAME) | ||
set(ARROW_STATIC_LIB_NAME | ||
"${CMAKE_STATIC_LIBRARY_PREFIX}${ARROW_STATIC_LIB}${CMAKE_STATIC_LIBRARY_SUFFIX}") | ||
list(APPEND ICEBERG_VENDOR_DEPENDENCIES | ||
"Iceberg::arrow_vendored|${ARROW_STATIC_LIB_NAME}") | ||
else() | ||
set(ARROW_VENDORED FALSE) | ||
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES Arrow) | ||
endif() | ||
|
||
set(ICEBERG_VENDOR_DEPENDENCIES | ||
${ICEBERG_VENDOR_DEPENDENCIES} | ||
PARENT_SCOPE) | ||
set(ICEBERG_SYSTEM_DEPENDENCIES | ||
${ICEBERG_SYSTEM_DEPENDENCIES} | ||
PARENT_SCOPE) | ||
set(ARROW_VENDORED | ||
${ARROW_VENDORED} | ||
PARENT_SCOPE) | ||
endfunction() | ||
|
||
if(ICEBERG_ARROW) | ||
resolve_arrow_dependency() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# 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. | ||
|
||
if(NOT ICEBERG_ARROW) | ||
return() | ||
endif() | ||
|
||
set(ICEBERG_ARROW_SOURCES demo_arrow.cc) | ||
set(ICEBERG_ARROW_INCLUDES "${ICEBERG_API_DIR}") | ||
|
||
# Libraries to link with exported libiceberg_arrow.{so,a}. | ||
set(ICEBERG_ARROW_STATIC_BUILD_INTERFACE_LIBS) | ||
set(ICEBERG_ARROW_SHARED_BUILD_INTERFACE_LIBS) | ||
set(ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS) | ||
set(ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS) | ||
|
||
list(APPEND ICEBERG_ARROW_STATIC_BUILD_INTERFACE_LIBS | ||
"$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>") | ||
list(APPEND ICEBERG_ARROW_SHARED_BUILD_INTERFACE_LIBS | ||
"$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>") | ||
|
||
if(ARROW_VENDORED) | ||
list(APPEND ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS Iceberg::arrow_vendored) | ||
list(APPEND ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS Iceberg::arrow_vendored) | ||
else() | ||
list(APPEND | ||
ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS | ||
"$<IF:$<TARGET_EXISTS:Arrow::arrow_static>,Arrow::arrow_static,Arrow::arrow_shared>" | ||
) | ||
list(APPEND | ||
ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS | ||
"$<IF:$<TARGET_EXISTS:Arrow::arrow_shared>,Arrow::arrow_shared,Arrow::arrow_static>" | ||
) | ||
endif() | ||
|
||
add_iceberg_lib(iceberg_arrow | ||
SOURCES | ||
${ICEBERG_ARROW_SOURCES} | ||
PRIVATE_INCLUDES | ||
${ICEBERG_ARROW_INCLUDES} | ||
SHARED_LINK_LIBS | ||
${ICEBERG_ARROW_SHARED_BUILD_INTERFACE_LIBS} | ||
STATIC_LINK_LIBS | ||
${ICEBERG_ARROW_STATIC_BUILD_INTERFACE_LIBS} | ||
STATIC_INSTALL_INTERFACE_LIBS | ||
${ICEBERG_ARROW_STATIC_INSTALL_INTERFACE_LIBS} | ||
SHARED_INSTALL_INTERFACE_LIBS | ||
${ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS}) | ||
|
||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/demo_arrow.h" | ||
DESTINATION "${ICEBERG_INSTALL_INCLUDEDIR}/iceberg/arrow") |
Oops, something went wrong.