Skip to content

Commit

Permalink
feat(c++): Deprecate the deprecate the building arrow dependency from…
Browse files Browse the repository at this point in the history
… source building strategy (apache#506)


Signed-off-by: acezen <[email protected]>
  • Loading branch information
acezen authored and Elssky committed Oct 8, 2024
1 parent 2676d10 commit 441fa8e
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 217 deletions.
67 changes: 0 additions & 67 deletions .github/workflows/ci-nightly.yml

This file was deleted.

41 changes: 39 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ concurrency:
cancel-in-progress: true

jobs:
GraphAr-ubuntu-arrow-installed:
ubuntu:
name: Ubuntu 22.04 C++
runs-on: ubuntu-latest
env:
GAR_TEST_DATA: ${{ github.workspace }}/testing/
Expand Down Expand Up @@ -143,7 +144,8 @@ jobs:
./graph_info_benchmark
./arrow_chunk_reader_benchmark
GraphAr-centos-arrow-installed:
centoo:
name: CentOS 7 C++
runs-on: ubuntu-latest
container:
image: centos:7
Expand Down Expand Up @@ -184,3 +186,38 @@ jobs:
cmake ..
make -j$(nproc)
popd
macos:
name: ${{ matrix.architecture }} macOS ${{ matrix.macos-version }} C++
runs-on: macos-${{ matrix.macos-version }}
strategy:
fail-fast: false
matrix:
include:
- architecture: AMD64
macos-version: "12"
- architecture: ARM64
macos-version: "14"
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install dependencies
run: |
brew bundle --file=cpp/Brewfile
- name: Build GraphAr
working-directory: "cpp"
run: |
mkdir build
pushd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_BENCHMARKS=ON
make -j$(nproc)
popd
- name: Running Test
working-directory: "cpp/build"
run: |
export ASAN_OPTIONS=detect_leaks=0
ctest --output-on-failure
24 changes: 24 additions & 0 deletions cpp/Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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.

brew "cmake"
brew "google-benchmark"
brew "apache-arrow"
brew "boost"
brew "doxygen"
brew "git"
brew "ccache"
156 changes: 31 additions & 125 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,34 +182,26 @@ endmacro()
# ------------------------------------------------------------------------------
# building or find third party library
# ------------------------------------------------------------------------------
find_package(Threads REQUIRED)
find_package(OpenSSL QUIET)
find_package(CURL REQUIRED)
if(OPENSSL_FOUND)
if(OPENSSL_VERSION LESS "1.1.0")
message(ERROR "The OpenSSL must be greater than or equal to 1.1.0, current version is ${OPENSSL_VERSION}")
endif()
endif()

# check if arrow is installed
find_package(Arrow QUIET)
if (NOT ${Arrow_FOUND})
message(FATAL_ERROR "apache-arrow is required, please install it and retry")
endif()
find_package(ArrowDataset QUIET)
find_package(ArrowAcero QUIET)
find_package(Parquet QUIET)

if (NOT Arrow_FOUND OR NOT ArrowDataset_FOUND OR NOT ArrowAcero_FOUND OR NOT Parquet_FOUND)
message(STATUS "Arrow is not installed, will build from source.")
set(BUILD_ARROW_FROM_SOURCE ON)
else()
message(STATUS "-- Found Arrow: ${Arrow_VERSION}")
set(BUILD_ARROW_FROM_SOURCE OFF)
if (NOT ${ArrowDataset_FOUND})
message(FATAL_ERROR "apache-arrow-dataset is required, please install it and retry")
endif()

if(BUILD_ARROW_FROM_SOURCE)
include(apache-arrow)
build_arrow()
if (${Arrow_VERSION} VERSION_GREATER_EQUAL "12.0.0")
# ArrowAcero is available in Arrow 12.0.0 and later
find_package(ArrowAcero QUIET)
if (NOT ${ArrowAcero_FOUND})
message(FATAL_ERROR "apache-arrow-acero is required, please install it and retry")
endif()
endif()
find_package(Parquet QUIET)
if (NOT ${Parquet_FOUND})
message(FATAL_ERROR "parquet is required, please install it and retry")
endif()


macro(get_target_location var target)
if(TARGET ${target})
Expand All @@ -234,46 +226,18 @@ macro(build_graphar)
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
)
target_include_directories(graphar PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
if(BUILD_ARROW_FROM_SOURCE)
target_include_directories(graphar SYSTEM BEFORE PRIVATE ${GAR_ARROW_INCLUDE_DIR})
endif()
target_link_libraries(graphar PRIVATE Threads::Threads ${CMAKE_DL_LIBS})

if(APPLE)
if(BUILD_ARROW_FROM_SOURCE)
target_link_libraries(graphar PRIVATE -Wl,-force_load gar_arrow_static
"${GAR_PARQUET_STATIC_LIB}"
"${GAR_DATASET_STATIC_LIB}"
"${GAR_ACERO_STATIC_LIB}"
"${GAR_ARROW_BUNDLED_DEPS_STATIC_LIB}")
else()
target_link_libraries(graphar PRIVATE -Wl,-force_load Arrow::arrow_shared
Parquet::parquet_shared
ArrowDataset::arrow_dataset_shared
ArrowAcero::arrow_acero_shared)
endif()
target_link_libraries(graphar PRIVATE -Wl,-force_load Arrow::arrow_shared
Parquet::parquet_shared
ArrowDataset::arrow_dataset_shared
ArrowAcero::arrow_acero_shared)
else()
if(BUILD_ARROW_FROM_SOURCE)
target_link_libraries(graphar PRIVATE -Wl,--exclude-libs,ALL -Wl,--whole-archive gar_arrow_static
"${GAR_PARQUET_STATIC_LIB}"
"${GAR_DATASET_STATIC_LIB}"
"${GAR_ARROW_ACERO_STATIC_LIB}"
"${GAR_ARROW_BUNDLED_DEPS_STATIC_LIB}" -Wl,--no-whole-archive)
else()
target_link_libraries(graphar PRIVATE -Wl,--exclude-libs,ALL -Wl,--whole-archive Arrow::arrow_shared
Parquet::parquet_shared
ArrowDataset::arrow_dataset_shared
ArrowAcero::arrow_acero_shared -Wl,--no-whole-archive)
endif()
endif()

# if OpenSSL library exists, link the OpenSSL library.
# OpenSSL has to be linked after GAR_ARROW_BUNDLED_DEPS_STATIC_LIB
if(OPENSSL_FOUND)
target_link_libraries(graphar PRIVATE OpenSSL::SSL)
endif()
if (CURL_FOUND)
target_link_libraries(graphar PRIVATE ${CURL_LIBRARIES})
target_link_libraries(graphar PRIVATE -Wl,--exclude-libs,ALL -Wl,--whole-archive Arrow::arrow_shared
Parquet::parquet_shared
ArrowDataset::arrow_dataset_shared
ArrowAcero::arrow_acero_shared -Wl,--no-whole-archive)
endif()
endmacro()

Expand All @@ -297,37 +261,13 @@ if (BUILD_EXAMPLES)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/Catch2/single_include>
)
target_include_directories(${E_NAME} SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
if(BUILD_ARROW_FROM_SOURCE)
target_include_directories(${E_NAME} SYSTEM BEFORE PRIVATE ${GAR_ARROW_INCLUDE_DIR})
endif()
target_link_libraries(${E_NAME} PRIVATE graphar ${Boost_LIBRARIES} Threads::Threads ${CMAKE_DL_LIBS})
if(APPLE)
if(BUILD_ARROW_FROM_SOURCE)
target_link_libraries(${E_NAME} PRIVATE -Wl,-force_load gar_arrow_static
"${GAR_PARQUET_STATIC_LIB}"
"${GAR_ARROW_BUNDLED_DEPS_STATIC_LIB}")
else()
target_link_libraries(${E_NAME} PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)
endif()
target_link_libraries(${E_NAME} PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)
else()
if(BUILD_ARROW_FROM_SOURCE)
target_link_libraries(${E_NAME} PRIVATE -Wl,--exclude-libs,ALL -Wl,--whole-archive gar_arrow_static
"${GAR_PARQUET_STATIC_LIB}"
"${GAR_ARROW_BUNDLED_DEPS_STATIC_LIB}" -Wl,--no-whole-archive)
else()
target_link_libraries(${E_NAME} PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)
endif()
endif()

# if OpenSSL library exists, link the OpenSSL library.
# OpenSSL has to be linked after GAR_ARROW_BUNDLED_DEPS_STATIC_LIB
if(OPENSSL_FOUND)
target_link_libraries(${E_NAME} PRIVATE OpenSSL::SSL)
endif()
if (CURL_FOUND)
target_link_libraries(${E_NAME} PRIVATE CURL::libcurl)
target_link_libraries(${E_NAME} PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)
endif()
endforeach()
endif()
Expand Down Expand Up @@ -379,43 +319,18 @@ if (BUILD_TESTS)
add_executable(${target} ${add_test_SRCS})
target_compile_features(${target} PRIVATE cxx_std_17)
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/thirdparty)
if(BUILD_ARROW_FROM_SOURCE)
target_include_directories(${target} SYSTEM BEFORE PRIVATE ${GAR_ARROW_INCLUDE_DIR})
endif()
target_link_libraries(${target} PRIVATE Catch2::Catch2 graphar Threads::Threads ${CMAKE_DL_LIBS})
if(APPLE)
if(BUILD_ARROW_FROM_SOURCE)
target_link_libraries(${target} PRIVATE -Wl,-force_load gar_arrow_static
"${GAR_PARQUET_STATIC_LIB}"
"${GAR_ARROW_BUNDLED_DEPS_STATIC_LIB}")
else()
target_link_libraries(${target} PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)
endif()
target_link_libraries(${target} PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)
else()
if(BUILD_ARROW_FROM_SOURCE)
target_link_libraries(${target} PRIVATE -Wl,--exclude-libs,ALL -Wl,--whole-archive gar_arrow_static
"${GAR_PARQUET_STATIC_LIB}"
"${GAR_ARROW_BUNDLED_DEPS_STATIC_LIB}" -Wl,--no-whole-archive)
else()
target_link_libraries(${target} PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)
endif()
target_link_libraries(${target} PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)
endif()
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/include $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/Catch2/single_include>)
target_include_directories(${target} SYSTEM BEFORE PRIVATE ${GAR_ARROW_INCLUDE_DIR})
include(CTest)
include(Catch)
catch_discover_tests(${target})

# if OpenSSL library exists, link the OpenSSL library.
# OpenSSL has to be linked after GAR_ARROW_BUNDLED_DEPS_STATIC_LIB
if(OPENSSL_FOUND)
target_link_libraries(${target} PRIVATE OpenSSL::SSL)
endif()
if (CURL_FOUND)
target_link_libraries(${target} PRIVATE CURL::libcurl)
endif()
endmacro()

add_test(test_info SRCS test/test_info.cc)
Expand All @@ -440,15 +355,6 @@ if (BUILD_BENCHMARKS)
target_compile_features(${target} PRIVATE cxx_std_17)
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/thirdparty)
target_link_libraries(${target} PRIVATE benchmark::benchmark_main graphar Threads::Threads ${CMAKE_DL_LIBS})

# if OpenSSL library exists, link the OpenSSL library.
# OpenSSL has to be linked after GAR_ARROW_BUNDLED_DEPS_STATIC_LIB
if(OPENSSL_FOUND)
target_link_libraries(${target} PRIVATE OpenSSL::SSL)
endif()
if (CURL_FOUND)
target_link_libraries(${target} PRIVATE CURL::libcurl)
endif()
endmacro()
add_benchmark(arrow_chunk_reader_benchmark SRCS benchmarks/arrow_chunk_reader_benchmark.cc)
add_benchmark(graph_info_benchmark SRCS benchmarks/graph_info_benchmark.cc)
Expand Down
Loading

0 comments on commit 441fa8e

Please sign in to comment.