From 909f6f90ebdbb2e16b223d768ee10c78e0b37bfb Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 29 Feb 2024 09:44:15 +0900 Subject: [PATCH] GH-39823: [C++] Allow building cpp/src/arrow/**/*.cc without waiting bundled libraries (#39824) ### Rationale for this change If we can build most of `cpp/src/arrow/**/*.cc` before all bundled libraries are built, we can reduce build time. ### What changes are included in this PR? * Remove the `toolchain` internal CMake target * Remove `ARROW_SHARED_LINK_LIBS` * Remove `ARROW_STATIC_LINK_LIBS` * Move the following variables to `cpp/src/arrow/CMakeLists.txt` * `ARROW_SHARED_PRIVATE_LINK_LIBS` * `ARROW_SHARED_INSTALL_INTERFACE_LIBS` * `ARROW_STATIC_INSTALL_INTERFACE_LIBS` * `ARROW_TEST_LINK_TOOLCHAIN` * `ARROW_TEST_SHARED_LINK_LIBS` * `ARROW_TEST_STATIC_LINK_LIBS` * `ARROW_SYSTEM_LINK_LIBS` * Add internal `OBJECT` libraries that have minimal dependencies * Remove unused `cpp/src/arrow/util/benchmark_main.cc` ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: #39823 * GitHub Issue: #39823 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/CMakeLists.txt | 284 +----- cpp/cmake_modules/ThirdpartyToolchain.cmake | 56 +- cpp/examples/arrow/CMakeLists.txt | 21 +- .../stream_reader_writer.cc | 1 + cpp/src/arrow/CMakeLists.txt | 850 ++++++++++++------ cpp/src/arrow/acero/CMakeLists.txt | 51 +- cpp/src/arrow/adapters/orc/CMakeLists.txt | 1 + cpp/src/arrow/compute/CMakeLists.txt | 4 +- cpp/src/arrow/compute/kernels/CMakeLists.txt | 11 +- .../kernels/scalar_string_benchmark.cc | 1 + cpp/src/arrow/dataset/CMakeLists.txt | 28 +- cpp/src/arrow/dataset/file_csv_test.cc | 1 + cpp/src/arrow/filesystem/CMakeLists.txt | 4 + cpp/src/arrow/filesystem/s3fs_test.cc | 22 +- cpp/src/arrow/flight/CMakeLists.txt | 9 +- cpp/src/arrow/integration/CMakeLists.txt | 9 +- cpp/src/arrow/io/CMakeLists.txt | 1 + cpp/src/arrow/ipc/CMakeLists.txt | 13 +- cpp/src/arrow/ipc/read_write_benchmark.cc | 1 + cpp/src/arrow/json/CMakeLists.txt | 10 +- cpp/src/arrow/util/CMakeLists.txt | 24 +- cpp/src/arrow/util/benchmark_main.cc | 24 - cpp/src/gandiva/CMakeLists.txt | 36 +- cpp/src/gandiva/precompiled/CMakeLists.txt | 3 +- cpp/src/parquet/CMakeLists.txt | 49 +- cpp/src/skyhook/CMakeLists.txt | 7 +- 26 files changed, 814 insertions(+), 707 deletions(-) delete mode 100644 cpp/src/arrow/util/benchmark_main.cc diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 164f4182d9602..b6d9ad5a5990e 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -683,305 +683,35 @@ if(${INFER_FOUND}) endif() # -# Linker and Dependencies +# Link targets # -# Libraries to link statically with libarrow.so. -# -# Note that arrow::hadoop is a header only target that refers -# cpp/thirdparty/hadoop/include/. See -# cpp/cmake_modules/ThirdpartyToolchain.cmake for details. -set(ARROW_SHARED_LINK_LIBS arrow::flatbuffers arrow::hadoop) -set(ARROW_SHARED_INSTALL_INTERFACE_LIBS) -set(ARROW_STATIC_LINK_LIBS arrow::flatbuffers arrow::hadoop) -set(ARROW_STATIC_INSTALL_INTERFACE_LIBS) - -# We must use google-cloud-cpp::storage first. If -# google-cloud-cpp::storage depends on bundled Abseil, bundled Abseil -# and system Abseil may be mixed. -# -# For example, if Boost::headers is used before -# google-cloud-cpp::storage AND Boost::headers has -# -I/opt/homebrew/include AND /opt/homebrew/include/absl/ exists, -# /opt/homebrew/include/absl/**/*.h are used instead of .h provided by -# bundled Abseil. -if(ARROW_GCS) - list(APPEND ARROW_SHARED_LINK_LIBS google-cloud-cpp::storage) - list(APPEND ARROW_STATIC_LINK_LIBS google-cloud-cpp::storage) - if(google_cloud_cpp_storage_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS google-cloud-cpp::storage) - endif() -endif() - -if(ARROW_USE_BOOST) - list(APPEND ARROW_SHARED_LINK_LIBS Boost::headers) - list(APPEND ARROW_STATIC_LINK_LIBS Boost::headers) -endif() - -if(ARROW_USE_OPENSSL) - set(ARROW_OPENSSL_LIBS OpenSSL::Crypto OpenSSL::SSL) - list(APPEND ARROW_SHARED_LINK_LIBS ${ARROW_OPENSSL_LIBS}) - list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_OPENSSL_LIBS}) - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_OPENSSL_LIBS}) -endif() - -if(ARROW_WITH_BROTLI) - # Order is important for static linking - set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon) - list(APPEND ARROW_SHARED_LINK_LIBS ${ARROW_BROTLI_LIBS}) - list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) - if(Brotli_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_BROTLI_LIBS}) - endif() -endif() - -if(ARROW_WITH_BZ2) - list(APPEND ARROW_STATIC_LINK_LIBS BZip2::BZip2) - if(BZip2_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS BZip2::BZip2) - endif() -endif() - -if(ARROW_WITH_LZ4) - list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) - if(lz4_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) - endif() -endif() - -if(ARROW_WITH_SNAPPY) - list(APPEND ARROW_STATIC_LINK_LIBS ${Snappy_TARGET}) - if(Snappy_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${Snappy_TARGET}) - endif() -endif() - -if(ARROW_WITH_ZLIB) - list(APPEND ARROW_STATIC_LINK_LIBS ZLIB::ZLIB) - if(ZLIB_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ZLIB::ZLIB) - endif() -endif() - -if(ARROW_WITH_ZSTD) - list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_ZSTD_LIBZSTD}) - if(zstd_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_ZSTD_LIBZSTD}) - endif() -endif() - -if(ARROW_ORC) - list(APPEND ARROW_SHARED_LINK_LIBS orc::orc ${ARROW_PROTOBUF_LIBPROTOBUF}) - list(APPEND ARROW_STATIC_LINK_LIBS orc::orc ${ARROW_PROTOBUF_LIBPROTOBUF}) - if(ORC_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS orc::orc) - endif() -endif() - -if(ARROW_USE_GLOG) - list(APPEND ARROW_SHARED_LINK_LIBS glog::glog) - list(APPEND ARROW_STATIC_LINK_LIBS glog::glog) - if(GLOG_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS glog::glog) - endif() -endif() - -if(ARROW_S3) - list(APPEND ARROW_SHARED_LINK_LIBS ${AWSSDK_LINK_LIBRARIES}) - list(APPEND ARROW_STATIC_LINK_LIBS ${AWSSDK_LINK_LIBRARIES}) - if(AWSSDK_SOURCE STREQUAL "SYSTEM") - list(APPEND - ARROW_STATIC_INSTALL_INTERFACE_LIBS - aws-cpp-sdk-identity-management - aws-cpp-sdk-sts - aws-cpp-sdk-cognito-identity - aws-cpp-sdk-s3 - aws-cpp-sdk-core) - elseif(AWSSDK_SOURCE STREQUAL "BUNDLED") - if(UNIX) - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS CURL::libcurl) - endif() - endif() -endif() - -if(ARROW_WITH_OPENTELEMETRY) - list(APPEND - ARROW_SHARED_LINK_LIBS - opentelemetry-cpp::trace - opentelemetry-cpp::ostream_span_exporter - opentelemetry-cpp::otlp_http_exporter) - list(APPEND - ARROW_STATIC_LINK_LIBS - opentelemetry-cpp::trace - opentelemetry-cpp::ostream_span_exporter - opentelemetry-cpp::otlp_http_exporter) - if(opentelemetry_SOURCE STREQUAL "SYSTEM") - list(APPEND - ARROW_STATIC_INSTALL_INTERFACE_LIBS - opentelemetry-cpp::trace - opentelemetry-cpp::ostream_span_exporter - opentelemetry-cpp::otlp_http_exporter) - endif() - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS CURL::libcurl) -endif() - -if(ARROW_WITH_AZURE_SDK) - list(APPEND ARROW_SHARED_LINK_LIBS ${AZURE_SDK_LINK_LIBRARIES}) - list(APPEND ARROW_STATIC_LINK_LIBS ${AZURE_SDK_LINK_LIBRARIES}) -endif() - -if(ARROW_WITH_UTF8PROC) - list(APPEND ARROW_SHARED_LINK_LIBS utf8proc::utf8proc) - list(APPEND ARROW_STATIC_LINK_LIBS utf8proc::utf8proc) - if(utf8proc_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS utf8proc::utf8proc) - endif() -endif() - -if(ARROW_WITH_RE2) - list(APPEND ARROW_SHARED_LINK_LIBS re2::re2) - list(APPEND ARROW_STATIC_LINK_LIBS re2::re2) - if(re2_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS re2::re2) - endif() -endif() - -if(ARROW_WITH_RAPIDJSON) - list(APPEND ARROW_SHARED_LINK_LIBS RapidJSON) - list(APPEND ARROW_STATIC_LINK_LIBS RapidJSON) -endif() - -if(ARROW_USE_XSIMD) - list(APPEND ARROW_SHARED_LINK_LIBS ${ARROW_XSIMD}) - list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_XSIMD}) -endif() - -# This should be done after if(ARROW_ORC) and if(ARROW_WITH_OPENTELEMETRY) -# because they depend on Protobuf. -if(ARROW_WITH_PROTOBUF) - if(Protobuf_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_PROTOBUF_LIBPROTOBUF}) - endif() -endif() - -add_custom_target(arrow_dependencies) -add_custom_target(arrow_benchmark_dependencies) -add_custom_target(arrow_test_dependencies) - -# ARROW-4581: CMake can be finicky about invoking the ExternalProject builds -# for some of the library dependencies, so we "nuke it from orbit" by making -# the toolchain dependency explicit using these "dependencies" targets -add_dependencies(arrow_dependencies toolchain) -add_dependencies(arrow_test_dependencies toolchain-tests) - -if(ARROW_STATIC_LINK_LIBS) - add_dependencies(arrow_dependencies ${ARROW_STATIC_LINK_LIBS}) - if(ARROW_HDFS OR ARROW_ORC) - if(NOT MSVC_TOOLCHAIN) - list(APPEND ARROW_STATIC_LINK_LIBS ${CMAKE_DL_LIBS}) - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS}) - endif() - endif() -endif() - -set(ARROW_SHARED_PRIVATE_LINK_LIBS ${ARROW_STATIC_LINK_LIBS}) - -if(NOT MSVC_TOOLCHAIN) - list(APPEND ARROW_SHARED_LINK_LIBS ${CMAKE_DL_LIBS}) -endif() - -set(ARROW_TEST_LINK_TOOLCHAIN arrow::flatbuffers ${ARROW_GTEST_GMOCK} - ${ARROW_GTEST_GTEST_MAIN}) - -if(ARROW_BUILD_TESTS) - add_dependencies(arrow_test_dependencies ${ARROW_TEST_LINK_TOOLCHAIN}) -endif() - -if(ARROW_BUILD_BENCHMARKS) - # Some benchmarks use gtest - add_dependencies(arrow_benchmark_dependencies arrow_test_dependencies - toolchain-benchmarks) -endif() - -set(ARROW_TEST_STATIC_LINK_LIBS arrow_testing_static arrow_static - ${ARROW_SHARED_LINK_LIBS} ${ARROW_TEST_LINK_TOOLCHAIN}) - -set(ARROW_TEST_SHARED_LINK_LIBS arrow_testing_shared arrow_shared - ${ARROW_SHARED_LINK_LIBS} ${ARROW_TEST_LINK_TOOLCHAIN}) - -if(NOT MSVC) - list(APPEND ARROW_TEST_SHARED_LINK_LIBS ${CMAKE_DL_LIBS}) -endif() - if("${ARROW_TEST_LINKAGE}" STREQUAL "shared") if(ARROW_BUILD_TESTS AND NOT ARROW_BUILD_SHARED) message(FATAL_ERROR "If using shared linkage for unit tests, must also \ pass ARROW_BUILD_SHARED=on") endif() # Use shared linking for unit tests if it's available - set(ARROW_TEST_LINK_LIBS ${ARROW_TEST_SHARED_LINK_LIBS}) + set(ARROW_TEST_LINK_LIBS arrow_testing_shared ${ARROW_GTEST_GMOCK} + ${ARROW_GTEST_GTEST_MAIN}) set(ARROW_EXAMPLE_LINK_LIBS arrow_shared) else() if(ARROW_BUILD_TESTS AND NOT ARROW_BUILD_STATIC) message(FATAL_ERROR "If using static linkage for unit tests, must also \ pass ARROW_BUILD_STATIC=on") endif() - set(ARROW_TEST_LINK_LIBS ${ARROW_TEST_STATIC_LINK_LIBS}) + set(ARROW_TEST_LINK_LIBS arrow_testing_static ${ARROW_GTEST_GMOCK} + ${ARROW_GTEST_GTEST_MAIN}) set(ARROW_EXAMPLE_LINK_LIBS arrow_static) endif() if(ARROW_BUILD_BENCHMARKS) - # In the case that benchmark::benchmark_main is not available, - # we need to provide our own version. This only happens for older versions - # of benchmark. - if(NOT TARGET benchmark::benchmark_main) - add_library(arrow_benchmark_main STATIC src/arrow/util/benchmark_main.cc) - add_library(benchmark::benchmark_main ALIAS arrow_benchmark_main) - endif() - - set(ARROW_BENCHMARK_LINK_LIBS benchmark::benchmark_main benchmark::benchmark - ${ARROW_TEST_LINK_LIBS}) + set(ARROW_BENCHMARK_LINK_LIBS benchmark::benchmark_main ${ARROW_TEST_LINK_LIBS}) if(WIN32) - set(ARROW_BENCHMARK_LINK_LIBS Shlwapi.dll ${ARROW_BENCHMARK_LINK_LIBS}) + list(APPEND ARROW_BENCHMARK_LINK_LIBS Shlwapi.dll) endif() endif() -if(ARROW_JEMALLOC) - list(APPEND ARROW_SHARED_LINK_LIBS jemalloc::jemalloc) - list(APPEND ARROW_STATIC_LINK_LIBS jemalloc::jemalloc) -endif() - -if(ARROW_MIMALLOC) - list(APPEND ARROW_SHARED_LINK_LIBS mimalloc::mimalloc) - list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) -endif() - -# ---------------------------------------------------------------------- -# Handle platform-related libraries like -pthread - -set(ARROW_SYSTEM_LINK_LIBS) - -if(ARROW_ENABLE_THREADING) - list(APPEND ARROW_SYSTEM_LINK_LIBS Threads::Threads) -endif() -if(CMAKE_THREAD_LIBS_INIT) - string(APPEND ARROW_PC_LIBS_PRIVATE " ${CMAKE_THREAD_LIBS_INIT}") -endif() - -if(WIN32) - # Winsock - list(APPEND ARROW_SYSTEM_LINK_LIBS "ws2_32.dll") -endif() - -if(NOT WIN32 AND NOT APPLE) - # Pass -lrt on Linux only - list(APPEND ARROW_SYSTEM_LINK_LIBS rt) -endif() - -list(APPEND ARROW_SHARED_LINK_LIBS ${ARROW_SYSTEM_LINK_LIBS}) -list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_SYSTEM_LINK_LIBS}) -list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_SYSTEM_LINK_LIBS}) - # # Subdirectories # diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 951028b6994ad..454d94d64bf8a 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -18,10 +18,6 @@ include(ProcessorCount) processorcount(NPROC) -add_custom_target(toolchain) -add_custom_target(toolchain-benchmarks) -add_custom_target(toolchain-tests) - # Accumulate all bundled targets and we will splice them together later as # libarrow_bundled_dependencies.a so that third party libraries have something # usable to create statically-linked builds with some BUNDLED dependencies, @@ -1149,7 +1145,6 @@ macro(build_boost) if(NOT TARGET Boost::dynamic_linking) # This doesn't add BOOST_ALL_DYN_LINK because bundled Boost is a static library. add_library(Boost::dynamic_linking INTERFACE IMPORTED) - add_dependencies(toolchain boost_ep) endif() set(BOOST_VENDORED TRUE) endmacro() @@ -1363,7 +1358,6 @@ macro(build_snappy) set_target_properties(${Snappy_TARGET} PROPERTIES IMPORTED_LOCATION "${SNAPPY_STATIC_LIB}") target_include_directories(${Snappy_TARGET} BEFORE INTERFACE "${SNAPPY_PREFIX}/include") - add_dependencies(toolchain snappy_ep) add_dependencies(${Snappy_TARGET} snappy_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS ${Snappy_TARGET}) @@ -1414,7 +1408,6 @@ macro(build_brotli) CMAKE_ARGS ${BROTLI_CMAKE_ARGS} STEP_TARGETS headers_copy) - add_dependencies(toolchain brotli_ep) file(MAKE_DIRECTORY "${BROTLI_INCLUDE_DIR}") add_library(Brotli::brotlicommon STATIC IMPORTED) @@ -1450,6 +1443,8 @@ if(ARROW_WITH_BROTLI) PC_PACKAGE_NAMES libbrotlidec libbrotlienc) + # Order is important for static linking + set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon) endif() if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) @@ -1470,6 +1465,7 @@ if(PARQUET_REQUIRE_ENCRYPTION REQUIRED_VERSION ${ARROW_OPENSSL_REQUIRED_VERSION}) set(ARROW_USE_OPENSSL ON) + set(ARROW_OPENSSL_LIBS OpenSSL::Crypto OpenSSL::SSL) endif() if(ARROW_USE_OPENSSL) @@ -1521,7 +1517,6 @@ macro(build_glog) BUILD_BYPRODUCTS "${GLOG_STATIC_LIB}" CMAKE_ARGS ${GLOG_CMAKE_ARGS}) - add_dependencies(toolchain glog_ep) file(MAKE_DIRECTORY "${GLOG_INCLUDE_DIR}") add_library(glog::glog STATIC IMPORTED) @@ -1580,8 +1575,6 @@ macro(build_gflags) BUILD_BYPRODUCTS "${GFLAGS_STATIC_LIB}" CMAKE_ARGS ${GFLAGS_CMAKE_ARGS}) - add_dependencies(toolchain gflags_ep) - add_thirdparty_lib(gflags::gflags_static STATIC ${GFLAGS_STATIC_LIB}) add_dependencies(gflags::gflags_static gflags_ep) set(GFLAGS_LIBRARY gflags::gflags_static) @@ -1693,7 +1686,6 @@ macro(build_thrift) if(ARROW_USE_BOOST) target_link_libraries(thrift::thrift INTERFACE Boost::headers) endif() - add_dependencies(toolchain thrift_ep) add_dependencies(thrift::thrift thrift_ep) set(Thrift_VERSION ${ARROW_THRIFT_BUILD_VERSION}) set(THRIFT_VENDORED TRUE) @@ -1790,7 +1782,6 @@ macro(build_protobuf) set_target_properties(arrow::protobuf::protoc PROPERTIES IMPORTED_LOCATION "${PROTOBUF_COMPILER}") - add_dependencies(toolchain protobuf_ep) add_dependencies(arrow::protobuf::libprotobuf protobuf_ep) add_dependencies(arrow::protobuf::protoc protobuf_ep) @@ -2132,7 +2123,6 @@ if(ARROW_MIMALLOC) target_link_libraries(mimalloc::mimalloc INTERFACE "bcrypt.lib" "psapi.lib") endif() add_dependencies(mimalloc::mimalloc mimalloc_ep) - add_dependencies(toolchain mimalloc_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) @@ -2290,8 +2280,8 @@ macro(build_benchmark) PROPERTIES IMPORTED_LOCATION "${GBENCHMARK_MAIN_STATIC_LIB}") target_include_directories(benchmark::benchmark_main BEFORE INTERFACE "${GBENCHMARK_INCLUDE_DIR}") + target_link_libraries(benchmark::benchmark_main INTERFACE benchmark::benchmark) - add_dependencies(toolchain-benchmarks gbenchmark_ep) add_dependencies(benchmark::benchmark gbenchmark_ep) add_dependencies(benchmark::benchmark_main gbenchmark_ep) endmacro() @@ -2361,8 +2351,9 @@ macro(build_xsimd) # The include directory must exist before it is referenced by a target. file(MAKE_DIRECTORY "${XSIMD_INCLUDE_DIR}") - add_dependencies(toolchain xsimd_ep) - add_dependencies(toolchain-tests xsimd_ep) + add_library(arrow::xsimd INTERFACE IMPORTED) + target_include_directories(arrow::xsimd INTERFACE "${XSIMD_INCLUDE_DIR}") + add_dependencies(arrow::xsimd xsimd_ep) set(XSIMD_VENDORED TRUE) endmacro() @@ -2384,8 +2375,6 @@ if(ARROW_USE_XSIMD) "8.1.0") if(xsimd_SOURCE STREQUAL "BUNDLED") - add_library(arrow::xsimd INTERFACE IMPORTED) - target_include_directories(arrow::xsimd INTERFACE "${XSIMD_INCLUDE_DIR}") set(ARROW_XSIMD arrow::xsimd) else() message(STATUS "xsimd found. Headers: ${xsimd_INCLUDE_DIRS}") @@ -2423,7 +2412,6 @@ macro(build_zlib) set_target_properties(ZLIB::ZLIB PROPERTIES IMPORTED_LOCATION ${ZLIB_LIBRARIES}) target_include_directories(ZLIB::ZLIB BEFORE INTERFACE "${ZLIB_INCLUDE_DIRS}") - add_dependencies(toolchain zlib_ep) add_dependencies(ZLIB::ZLIB zlib_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS ZLIB::ZLIB) @@ -2459,7 +2447,6 @@ macro(build_lz4) add_library(LZ4::lz4 STATIC IMPORTED) set_target_properties(LZ4::lz4 PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}") target_include_directories(LZ4::lz4 BEFORE INTERFACE "${LZ4_PREFIX}/include") - add_dependencies(toolchain lz4_ep) add_dependencies(LZ4::lz4 lz4_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4) @@ -2512,7 +2499,6 @@ macro(build_zstd) target_include_directories(zstd::libzstd_static BEFORE INTERFACE "${ZSTD_PREFIX}/include") - add_dependencies(toolchain zstd_ep) add_dependencies(zstd::libzstd_static zstd_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS zstd::libzstd_static) @@ -2569,7 +2555,6 @@ macro(build_re2) set_target_properties(re2::re2 PROPERTIES IMPORTED_LOCATION "${RE2_STATIC_LIB}") target_include_directories(re2::re2 BEFORE INTERFACE "${RE2_PREFIX}/include") - add_dependencies(toolchain re2_ep) add_dependencies(re2::re2 re2_ep) set(RE2_VENDORED TRUE) # Set values so that FindRE2 finds this too @@ -2627,7 +2612,6 @@ macro(build_bzip2) target_include_directories(BZip2::BZip2 BEFORE INTERFACE "${BZIP2_PREFIX}/include") set(BZIP2_INCLUDE_DIR "${BZIP2_PREFIX}/include") - add_dependencies(toolchain bzip2_ep) add_dependencies(BZip2::BZip2 bzip2_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS BZip2::BZip2) @@ -2680,7 +2664,6 @@ macro(build_utf8proc) target_include_directories(utf8proc::utf8proc BEFORE INTERFACE "${UTF8PROC_PREFIX}/include") - add_dependencies(toolchain utf8proc_ep) add_dependencies(utf8proc::utf8proc utf8proc_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS utf8proc::utf8proc) @@ -2717,7 +2700,6 @@ macro(build_cares) file(MAKE_DIRECTORY ${CARES_INCLUDE_DIR}) - add_dependencies(toolchain cares_ep) add_library(c-ares::cares STATIC IMPORTED) set_target_properties(c-ares::cares PROPERTIES IMPORTED_LOCATION "${CARES_STATIC_LIB}") target_include_directories(c-ares::cares BEFORE INTERFACE "${CARES_INCLUDE_DIR}") @@ -3962,7 +3944,6 @@ macro(build_grpc) ${GRPC_CPP_PLUGIN}) add_dependencies(grpc_ep grpc_dependencies) - add_dependencies(toolchain grpc_ep) add_dependencies(gRPC::grpc++ grpc_ep) add_dependencies(gRPC::grpc_cpp_plugin grpc_ep) set(GRPC_VENDORED TRUE) @@ -4212,8 +4193,6 @@ macro(build_google_cloud_cpp_storage) # Work around https://gitlab.kitware.com/cmake/cmake/issues/15052 file(MAKE_DIRECTORY ${GOOGLE_CLOUD_CPP_INCLUDE_DIR}) - add_dependencies(toolchain google_cloud_cpp_ep) - add_library(google-cloud-cpp::common STATIC IMPORTED) set_target_properties(google-cloud-cpp::common PROPERTIES IMPORTED_LOCATION @@ -4434,7 +4413,6 @@ macro(build_orc) target_link_libraries(orc::orc INTERFACE ${CMAKE_DL_LIBS}) endif() - add_dependencies(toolchain orc_ep) add_dependencies(orc::orc orc_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS orc::orc) @@ -4442,6 +4420,7 @@ endmacro() if(ARROW_ORC) resolve_dependency(orc HAVE_ALT TRUE) + target_link_libraries(orc::orc INTERFACE ${ARROW_PROTOBUF_LIBPROTOBUF}) message(STATUS "Found ORC static library: ${ORC_STATIC_LIB}") message(STATUS "Found ORC headers: ${ORC_INCLUDE_DIR}") endif() @@ -4601,9 +4580,6 @@ macro(build_opentelemetry) DEPENDEES download DEPENDERS configure) - add_dependencies(toolchain opentelemetry_ep) - add_dependencies(toolchain-tests opentelemetry_ep) - set(OPENTELEMETRY_VENDORED 1) target_link_libraries(opentelemetry-cpp::common @@ -4645,6 +4621,9 @@ if(ARROW_WITH_OPENTELEMETRY) find_curl() set(opentelemetry-cpp_SOURCE "AUTO") resolve_dependency(opentelemetry-cpp) + set(ARROW_OPENTELEMETRY_LIBS + opentelemetry-cpp::trace opentelemetry-cpp::ostream_span_exporter + opentelemetry-cpp::otlp_http_exporter) get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::api INTERFACE_INCLUDE_DIRECTORIES) message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") @@ -4980,7 +4959,6 @@ macro(build_awssdk) ${AWS_CPP_SDK_S3_STATIC_LIBRARY} ${AWS_CPP_SDK_STS_STATIC_LIBRARY} DEPENDS aws_crt_cpp_ep) - add_dependencies(toolchain awssdk_ep) foreach(_AWSSDK_LIB ${_AWSSDK_LIBS}) if(${_AWSSDK_LIB} MATCHES "^aws-cpp-sdk-") add_dependencies(${_AWSSDK_LIB} awssdk_ep) @@ -5009,6 +4987,9 @@ macro(build_awssdk) PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) add_dependencies(awssdk_ep zlib_ep) endif() + set_property(TARGET AWS::aws-c-io + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) elseif(WIN32) set_property(TARGET aws-cpp-sdk-core APPEND @@ -5112,12 +5093,8 @@ endfunction() if(ARROW_WITH_AZURE_SDK) resolve_dependency(Azure REQUIRED_VERSION 1.10.2) - set(AZURE_SDK_LINK_LIBRARIES - Azure::azure-storage-files-datalake - Azure::azure-storage-common - Azure::azure-storage-blobs - Azure::azure-identity - Azure::azure-core) + set(AZURE_SDK_LINK_LIBRARIES Azure::azure-storage-files-datalake + Azure::azure-storage-blobs Azure::azure-identity) endif() # ---------------------------------------------------------------------- # ucx - communication framework for modern, high-bandwidth and low-latency networks @@ -5182,7 +5159,6 @@ macro(build_ucx) add_library(ucx::ucs SHARED IMPORTED) set_target_properties(ucx::ucs PROPERTIES IMPORTED_LOCATION "${UCX_SHARED_LIB_UCS}") - add_dependencies(toolchain ucx_ep) add_dependencies(ucx::ucp ucx_ep) add_dependencies(ucx::uct ucx_ep) add_dependencies(ucx::ucs ucx_ep) diff --git a/cpp/examples/arrow/CMakeLists.txt b/cpp/examples/arrow/CMakeLists.txt index 4625f130565e7..a092a31733f72 100644 --- a/cpp/examples/arrow/CMakeLists.txt +++ b/cpp/examples/arrow/CMakeLists.txt @@ -17,7 +17,9 @@ add_arrow_example(row_wise_conversion_example) -add_arrow_example(rapidjson_row_converter) +if(ARROW_WITH_RAPIDJSON) + add_arrow_example(rapidjson_row_converter EXTRA_LINK_LIBS RapidJSON) +endif() if(ARROW_ACERO) if(ARROW_BUILD_SHARED) @@ -93,6 +95,17 @@ if(ARROW_FLIGHT) add_custom_target(flight_grpc_example_gen ALL DEPENDS ${FLIGHT_EXAMPLE_GENERATED_PROTO_FILES}) + set(FLIGHT_GRPC_EXAMPLE_LINK_LIBS + ${FLIGHT_EXAMPLES_LINK_LIBS} + gRPC::grpc++ + ${GRPC_REFLECTION_LINK_LIBS} + ${ARROW_PROTOBUF_LIBPROTOBUF} + ${GFLAGS_LIBRARIES}) + if(TARGET absl::log_internal_check_op) + # Protobuf generated files may use ABSL_DCHECK*() and + # absl::log_internal_check_op is needed for them. + list(APPEND FLIGHT_GRPC_EXAMPLE_LINK_LIBS absl::log_internal_check_op) + endif() add_arrow_example(flight_grpc_example DEPENDENCIES flight_grpc_example_gen @@ -102,11 +115,7 @@ if(ARROW_FLIGHT) EXTRA_INCLUDES ${CMAKE_BINARY_DIR} EXTRA_LINK_LIBS - ${FLIGHT_EXAMPLES_LINK_LIBS} - gRPC::grpc++ - ${GRPC_REFLECTION_LINK_LIBS} - ${ARROW_PROTOBUF_LIBPROTOBUF} - ${GFLAGS_LIBRARIES} + ${FLIGHT_GRPC_EXAMPLE_LINK_LIBS} EXTRA_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc" "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc") diff --git a/cpp/examples/parquet/parquet_stream_api/stream_reader_writer.cc b/cpp/examples/parquet/parquet_stream_api/stream_reader_writer.cc index 1f7246b78160c..7189aa853917c 100644 --- a/cpp/examples/parquet/parquet_stream_api/stream_reader_writer.cc +++ b/cpp/examples/parquet/parquet_stream_api/stream_reader_writer.cc @@ -25,6 +25,7 @@ #include #include "arrow/io/file.h" +#include "arrow/util/config.h" #include "parquet/exception.h" #include "parquet/stream_reader.h" #include "parquet/stream_writer.h" diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index c160179ceff0b..23a3691566f69 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -26,6 +26,214 @@ add_dependencies(arrow-all arrow-benchmarks arrow-integration) +# Libraries to link with libarrow.so. They aren't exported. +set(ARROW_SHARED_PRIVATE_LINK_LIBS) + +# Libraries to link with exported libarrow.{so,a}. +set(ARROW_SHARED_INSTALL_INTERFACE_LIBS) +set(ARROW_STATIC_INSTALL_INTERFACE_LIBS) + +if(ARROW_GCS) + if(google_cloud_cpp_storage_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS google-cloud-cpp::storage) + endif() +endif() + +if(ARROW_USE_OPENSSL) + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_OPENSSL_LIBS}) +endif() + +if(ARROW_WITH_BROTLI) + if(Brotli_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_BROTLI_LIBS}) + endif() +endif() + +if(ARROW_WITH_BZ2) + if(BZip2_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS BZip2::BZip2) + endif() +endif() + +if(ARROW_WITH_LZ4) + if(lz4_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) + endif() +endif() + +if(ARROW_WITH_SNAPPY) + if(Snappy_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${Snappy_TARGET}) + endif() +endif() + +if(ARROW_WITH_ZLIB) + if(ZLIB_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ZLIB::ZLIB) + endif() +endif() + +if(ARROW_WITH_ZSTD) + if(zstd_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_ZSTD_LIBZSTD}) + endif() +endif() + +if(ARROW_ORC) + if(ORC_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS orc::orc) + endif() +endif() + +if(ARROW_USE_GLOG) + if(GLOG_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS glog::glog) + endif() +endif() + +if(ARROW_S3) + if(AWSSDK_SOURCE STREQUAL "SYSTEM") + list(APPEND + ARROW_STATIC_INSTALL_INTERFACE_LIBS + aws-cpp-sdk-identity-management + aws-cpp-sdk-sts + aws-cpp-sdk-cognito-identity + aws-cpp-sdk-s3 + aws-cpp-sdk-core) + elseif(AWSSDK_SOURCE STREQUAL "BUNDLED") + if(UNIX) + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS CURL::libcurl) + endif() + endif() +endif() + +if(ARROW_WITH_OPENTELEMETRY) + if(opentelemetry_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_OPENTELEMETRY_LIBS}) + endif() + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS CURL::libcurl) +endif() + +if(ARROW_WITH_UTF8PROC) + if(utf8proc_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS utf8proc::utf8proc) + endif() +endif() + +if(ARROW_WITH_RE2) + if(re2_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS re2::re2) + endif() +endif() + +# This should be done after if(ARROW_ORC) and if(ARROW_WITH_OPENTELEMETRY) +# because they depend on Protobuf. +if(ARROW_WITH_PROTOBUF) + if(Protobuf_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_PROTOBUF_LIBPROTOBUF}) + endif() +endif() + +if(ARROW_ENABLE_THREADING) + list(APPEND ARROW_SHARED_PRIVATE_LINK_LIBS Threads::Threads) + list(APPEND ARROW_STATIC_LINK_LIBS Threads::Threads) +endif() + +if(NOT MSVC_TOOLCHAIN) + list(APPEND ARROW_SHARED_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS}) + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS}) +endif() + +set(ARROW_TEST_LINK_TOOLCHAIN arrow::flatbuffers ${ARROW_GTEST_GMOCK} + ${ARROW_GTEST_GTEST_MAIN}) +set(ARROW_TEST_STATIC_LINK_LIBS arrow_testing_static arrow_static + ${ARROW_TEST_LINK_TOOLCHAIN}) +set(ARROW_TEST_SHARED_LINK_LIBS arrow_testing_shared arrow_shared + ${ARROW_TEST_LINK_TOOLCHAIN}) +if(NOT MSVC) + list(APPEND ARROW_TEST_SHARED_LINK_LIBS ${CMAKE_DL_LIBS}) +endif() + +# ---------------------------------------------------------------------- +# Handle platform-related libraries like -pthread + +set(ARROW_SYSTEM_LINK_LIBS) + +if(CMAKE_THREAD_LIBS_INIT) + string(APPEND ARROW_PC_LIBS_PRIVATE " ${CMAKE_THREAD_LIBS_INIT}") +endif() + +if(WIN32) + list(APPEND ARROW_SYSTEM_LINK_LIBS "ws2_32.dll") +endif() + +if(NOT WIN32 AND NOT APPLE) + # Pass -lrt on Linux only + list(APPEND ARROW_SYSTEM_LINK_LIBS rt) +endif() + +list(APPEND ARROW_SHARED_INSTALL_INTERFACE_LIBS ${ARROW_SYSTEM_LINK_LIBS}) +list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_SYSTEM_LINK_LIBS}) + +# Need -latomic on Raspbian. +# See also: https://issues.apache.org/jira/browse/ARROW-12860 +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7") + string(APPEND ARROW_PC_LIBS_PRIVATE " -latomic") + list(APPEND ARROW_SHARED_INSTALL_INTERFACE_LIBS "atomic") + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS "atomic") +endif() + +# This creates OBJECT libraries for arrow_shared/arrow_static. This is +# not intended to use for other libraries such as +# arrow_acero_shared/arrow_acero_static for now. +# +# arrow_shared/arrow_static depends on many external libraries such as +# Zstandard and jemalloc. If we use bundled libraries, we can't start +# building arrow_shared/arrow_static until all bundled libraries are +# built. It prevent parallel build speedup. +# +# We can avoid the situation by creating small OBJECT libraries that +# depend only needed external libraries. If an OBJECT library doesn't +# depend on any bundled libraries, it can be built before bundled +# libraries are built. If an OBJECT library depend on only a few +# bundled libraries, it can be built after only they are built. +function(arrow_add_object_library PREFIX) + set(SOURCES ${ARGN}) + string(TOLOWER "${PREFIX}" prefix) + if(WIN32) + add_library(${prefix}_shared OBJECT ${SOURCES}) + add_library(${prefix}_static OBJECT ${SOURCES}) + set_target_properties(${prefix}_shared PROPERTIES POSITION_INDEPENDENT_CODE ON) + set_target_properties(${prefix}_static PROPERTIES POSITION_INDEPENDENT_CODE ON) + target_compile_definitions(${prefix}_shared PRIVATE ARROW_EXPORTING) + target_compile_definitions(${prefix}_static PRIVATE ARROW_STATIC) + target_compile_features(${prefix}_shared PRIVATE cxx_std_17) + target_compile_features(${prefix}_static PRIVATE cxx_std_17) + set(${PREFIX}_TARGET_SHARED + ${prefix}_shared + PARENT_SCOPE) + set(${PREFIX}_TARGET_STATIC + ${prefix}_static + PARENT_SCOPE) + set(${PREFIX}_TARGETS + ${prefix}_shared ${prefix}_static + PARENT_SCOPE) + else() + add_library(${prefix} OBJECT ${SOURCES}) + set_target_properties(${prefix} PROPERTIES POSITION_INDEPENDENT_CODE ON) + target_compile_features(${prefix} PRIVATE cxx_std_17) + set(${PREFIX}_TARGET_SHARED + ${prefix} + PARENT_SCOPE) + set(${PREFIX}_TARGET_STATIC + ${prefix} + PARENT_SCOPE) + set(${PREFIX}_TARGETS + ${prefix} + PARENT_SCOPE) + endif() +endfunction() + # Adding unit tests part of the "arrow" portion of the test suite function(ADD_ARROW_TEST REL_TEST_NAME) set(options) @@ -119,53 +327,32 @@ function(ADD_ARROW_BENCHMARK REL_TEST_NAME) ${ARG_UNPARSED_ARGUMENTS}) endfunction() -macro(append_runtime_avx2_src SRC) +macro(append_runtime_avx2_src SRCS SRC) if(ARROW_HAVE_RUNTIME_AVX2) - list(APPEND ARROW_SRCS ${SRC}) + list(APPEND ${SRCS} ${SRC}) set_source_files_properties(${SRC} PROPERTIES SKIP_PRECOMPILE_HEADERS ON) set_source_files_properties(${SRC} PROPERTIES COMPILE_FLAGS ${ARROW_AVX2_FLAG}) endif() endmacro() -macro(append_runtime_avx2_bmi2_src SRC) +macro(append_runtime_avx2_bmi2_src SRCS SRC) if(ARROW_HAVE_RUNTIME_AVX2 AND ARROW_HAVE_RUNTIME_BMI2) - list(APPEND ARROW_SRCS ${SRC}) + list(APPEND ${SRCS} ${SRC}) set_source_files_properties(${SRC} PROPERTIES SKIP_PRECOMPILE_HEADERS ON) set_source_files_properties(${SRC} PROPERTIES COMPILE_FLAGS "${ARROW_AVX2_FLAG} ${ARROW_BMI2_FLAG}") endif() endmacro() -macro(append_runtime_avx512_src SRC) +macro(append_runtime_avx512_src SRCS SRC) if(ARROW_HAVE_RUNTIME_AVX512) - list(APPEND ARROW_SRCS ${SRC}) + list(APPEND ${SRCS} ${SRC}) set_source_files_properties(${SRC} PROPERTIES SKIP_PRECOMPILE_HEADERS ON) set_source_files_properties(${SRC} PROPERTIES COMPILE_FLAGS ${ARROW_AVX512_FLAG}) endif() endmacro() set(ARROW_SRCS - array/array_base.cc - array/array_binary.cc - array/array_decimal.cc - array/array_dict.cc - array/array_nested.cc - array/array_primitive.cc - array/array_run_end.cc - array/builder_adaptive.cc - array/builder_base.cc - array/builder_binary.cc - array/builder_decimal.cc - array/builder_dict.cc - array/builder_run_end.cc - array/builder_nested.cc - array/builder_primitive.cc - array/builder_union.cc - array/concatenate.cc - array/data.cc - array/diff.cc - array/util.cc - array/validate.cc builder.cc buffer.cc chunked_array.cc @@ -175,7 +362,6 @@ set(ARROW_SRCS datum.cc device.cc extension_type.cc - memory_pool.cc pretty_print.cc record_batch.cc result.cc @@ -192,18 +378,109 @@ set(ARROW_SRCS type_traits.cc visitor.cc c/bridge.cc - c/dlpack.cc - io/buffered.cc - io/caching.cc - io/compressed.cc - io/file.cc - io/hdfs.cc - io/hdfs_internal.cc - io/interfaces.cc - io/memory.cc - io/slow.cc - io/stdio.cc - io/transform.cc + c/dlpack.cc) + +arrow_add_object_library(ARROW_ARRAY + array/array_base.cc + array/array_binary.cc + array/array_decimal.cc + array/array_dict.cc + array/array_nested.cc + array/array_primitive.cc + array/array_run_end.cc + array/builder_adaptive.cc + array/builder_base.cc + array/builder_binary.cc + array/builder_decimal.cc + array/builder_dict.cc + array/builder_run_end.cc + array/builder_nested.cc + array/builder_primitive.cc + array/builder_union.cc + array/concatenate.cc + array/data.cc + array/diff.cc + array/util.cc + array/validate.cc) + +arrow_add_object_library(ARROW_IO + io/buffered.cc + io/caching.cc + io/compressed.cc + io/file.cc + io/hdfs.cc + io/hdfs_internal.cc + io/interfaces.cc + io/memory.cc + io/slow.cc + io/stdio.cc + io/transform.cc) +foreach(ARROW_IO_TARGET ${ARROW_IO_TARGETS}) + target_link_libraries(${ARROW_IO_TARGET} PRIVATE arrow::hadoop) + if(NOT MSVC) + target_link_libraries(${ARROW_IO_TARGET} PRIVATE ${CMAKE_DL_LIBS}) + endif() +endforeach() + +set(ARROW_MEMORY_POOL_SRCS memory_pool.cc) +if(ARROW_JEMALLOC) + list(APPEND ARROW_MEMORY_POOL_SRCS memory_pool_jemalloc.cc) + set_source_files_properties(memory_pool_jemalloc.cc + PROPERTIES SKIP_PRECOMPILE_HEADERS ON + SKIP_UNITY_BUILD_INCLUSION ON) +endif() +arrow_add_object_library(ARROW_MEMORY_POOL ${ARROW_MEMORY_POOL_SRCS}) +if(ARROW_JEMALLOC) + foreach(ARROW_MEMORY_POOL_TARGET ${ARROW_MEMORY_POOL_TARGETS}) + target_link_libraries(${ARROW_MEMORY_POOL_TARGET} PRIVATE jemalloc::jemalloc) + endforeach() +endif() +if(ARROW_MIMALLOC) + foreach(ARROW_MEMORY_POOL_TARGET ${ARROW_MEMORY_POOL_TARGETS}) + target_link_libraries(${ARROW_MEMORY_POOL_TARGET} PRIVATE mimalloc::mimalloc) + endforeach() +endif() + +set(ARROW_VENDORED_SRCS + vendored/base64.cpp + vendored/datetime/tz.cpp + vendored/double-conversion/bignum-dtoa.cc + vendored/double-conversion/bignum.cc + vendored/double-conversion/cached-powers.cc + vendored/double-conversion/double-to-string.cc + vendored/double-conversion/fast-dtoa.cc + vendored/double-conversion/fixed-dtoa.cc + vendored/double-conversion/string-to-double.cc + vendored/double-conversion/strtod.cc + vendored/musl/strptime.c + vendored/uriparser/UriCommon.c + vendored/uriparser/UriCompare.c + vendored/uriparser/UriEscape.c + vendored/uriparser/UriFile.c + vendored/uriparser/UriIp4.c + vendored/uriparser/UriIp4Base.c + vendored/uriparser/UriMemory.c + vendored/uriparser/UriNormalize.c + vendored/uriparser/UriNormalizeBase.c + vendored/uriparser/UriParse.c + vendored/uriparser/UriParseBase.c + vendored/uriparser/UriQuery.c + vendored/uriparser/UriRecompose.c + vendored/uriparser/UriResolve.c + vendored/uriparser/UriShorten.c) +if(APPLE) + list(APPEND ARROW_VENDORED_SRCS vendored/datetime/ios.mm) +endif() +set_source_files_properties(vendored/datetime/tz.cpp + PROPERTIES SKIP_PRECOMPILE_HEADERS ON + SKIP_UNITY_BUILD_INCLUSION ON) +arrow_add_object_library(ARROW_VENDORED ${ARROW_VENDORED_SRCS}) +# Disable DLL exports in vendored uriparser library +foreach(ARROW_VENDORED_TARGET ${ARROW_VENDORED_TARGETS}) + target_compile_definitions(${ARROW_VENDORED_TARGET} PUBLIC URI_STATIC_BUILD) +endforeach() + +set(ARROW_UTIL_SRCS util/align_util.cc util/async_util.cc util/atfork_internal.cc @@ -249,92 +526,103 @@ set(ARROW_SRCS util/unreachable.cc util/uri.cc util/utf8.cc - util/value_parsing.cc - vendored/base64.cpp - vendored/datetime/tz.cpp - vendored/double-conversion/bignum.cc - vendored/double-conversion/bignum-dtoa.cc - vendored/double-conversion/cached-powers.cc - vendored/double-conversion/double-to-string.cc - vendored/double-conversion/fast-dtoa.cc - vendored/double-conversion/fixed-dtoa.cc - vendored/double-conversion/string-to-double.cc - vendored/double-conversion/strtod.cc) - -if(ARROW_JEMALLOC) - list(APPEND ARROW_SRCS memory_pool_jemalloc.cc) - set_source_files_properties(memory_pool_jemalloc.cc - PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) -endif() - -append_runtime_avx2_src(util/bpacking_avx2.cc) -append_runtime_avx512_src(util/bpacking_avx512.cc) + util/value_parsing.cc) +append_runtime_avx2_src(ARROW_UTIL_SRCS util/bpacking_avx2.cc) +append_runtime_avx512_src(ARROW_UTIL_SRCS util/bpacking_avx512.cc) if(ARROW_HAVE_NEON) - list(APPEND ARROW_SRCS util/bpacking_neon.cc) -endif() - -if(APPLE) - list(APPEND ARROW_SRCS vendored/datetime/ios.mm) + list(APPEND ARROW_UTIL_SRCS util/bpacking_neon.cc) endif() -set(ARROW_C_SRCS - vendored/musl/strptime.c - vendored/uriparser/UriCommon.c - vendored/uriparser/UriCompare.c - vendored/uriparser/UriEscape.c - vendored/uriparser/UriFile.c - vendored/uriparser/UriIp4Base.c - vendored/uriparser/UriIp4.c - vendored/uriparser/UriMemory.c - vendored/uriparser/UriNormalizeBase.c - vendored/uriparser/UriNormalize.c - vendored/uriparser/UriParseBase.c - vendored/uriparser/UriParse.c - vendored/uriparser/UriQuery.c - vendored/uriparser/UriRecompose.c - vendored/uriparser/UriResolve.c - vendored/uriparser/UriShorten.c) - -set_source_files_properties(vendored/datetime/tz.cpp - PROPERTIES SKIP_PRECOMPILE_HEADERS ON - SKIP_UNITY_BUILD_INCLUSION ON) - -# Disable DLL exports in vendored uriparser library -add_definitions(-DURI_STATIC_BUILD) - if(ARROW_WITH_BROTLI) - list(APPEND ARROW_SRCS util/compression_brotli.cc) + list(APPEND ARROW_UTIL_SRCS util/compression_brotli.cc) endif() - if(ARROW_WITH_BZ2) - list(APPEND ARROW_SRCS util/compression_bz2.cc) + list(APPEND ARROW_UTIL_SRCS util/compression_bz2.cc) endif() - if(ARROW_WITH_LZ4) - list(APPEND ARROW_SRCS util/compression_lz4.cc) + list(APPEND ARROW_UTIL_SRCS util/compression_lz4.cc) endif() - if(ARROW_WITH_OPENTELEMETRY) - list(APPEND ARROW_SRCS util/tracing_internal.cc) + list(APPEND ARROW_UTIL_SRCS util/tracing_internal.cc) endif() - if(ARROW_WITH_SNAPPY) - list(APPEND ARROW_SRCS util/compression_snappy.cc) + list(APPEND ARROW_UTIL_SRCS util/compression_snappy.cc) endif() - if(ARROW_WITH_ZLIB) - list(APPEND ARROW_SRCS util/compression_zlib.cc) + list(APPEND ARROW_UTIL_SRCS util/compression_zlib.cc) +endif() +if(ARROW_WITH_ZSTD) + list(APPEND ARROW_UTIL_SRCS util/compression_zstd.cc) endif() +arrow_add_object_library(ARROW_UTIL ${ARROW_UTIL_SRCS}) + +if(ARROW_USE_BOOST) + foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE Boost::headers) + endforeach() +endif() +if(ARROW_USE_XSIMD) + foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE ${ARROW_XSIMD}) + endforeach() +endif() +if(ARROW_WITH_BROTLI) + foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE ${ARROW_BROTLI_LIBS}) + endforeach() +endif() +if(ARROW_WITH_BZ2) + foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE BZip2::BZip2) + endforeach() +endif() +if(ARROW_WITH_LZ4) + foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE LZ4::lz4) + endforeach() +endif() +if(ARROW_WITH_SNAPPY) + foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE ${Snappy_TARGET}) + endforeach() +endif() +if(ARROW_WITH_OPENTELEMETRY) + foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE ${ARROW_OPENTELEMETRY_LIBS}) + endforeach() +endif() +if(ARROW_WITH_ZLIB) + foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE ZLIB::ZLIB) + endforeach() +endif() if(ARROW_WITH_ZSTD) - list(APPEND ARROW_SRCS util/compression_zstd.cc) + foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE ${ARROW_ZSTD_LIBZSTD}) + endforeach() endif() -set(ARROW_TESTING_SHARED_LINK_LIBS arrow::flatbuffers RapidJSON arrow_shared - ${ARROW_GTEST_GTEST}) +set(ARROW_TESTING_SHARED_LINK_LIBS arrow_shared ${ARROW_GTEST_GTEST}) +set(ARROW_TESTING_SHARED_PRIVATE_LINK_LIBS arrow::flatbuffers RapidJSON) set(ARROW_TESTING_STATIC_LINK_LIBS arrow::flatbuffers RapidJSON arrow_static ${ARROW_GTEST_GTEST}) +set(ARROW_TESTING_SHARED_INSTALL_INTERFACE_LIBS Arrow::arrow_shared) +set(ARROW_TESTING_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static) +# that depend on gtest +if(GTest_SOURCE STREQUAL "SYSTEM") + list(APPEND ARROW_TESTING_SHARED_INSTALL_INTERFACE_LIBS ${ARROW_GTEST_GTEST}) + list(APPEND ARROW_TESTING_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_GTEST_GTEST}) +else() + list(APPEND ARROW_TESTING_SHARED_INSTALL_INTERFACE_LIBS ArrowTesting::gtest) + list(APPEND ARROW_TESTING_STATIC_INSTALL_INTERFACE_LIBS ArrowTesting::gtest) +endif() +if(WIN32) + list(APPEND ARROW_TESTING_SHARED_LINK_LIBS "ws2_32.dll") + list(APPEND ARROW_TESTING_STATIC_LINK_LIBS "ws2_32.dll") + list(APPEND ARROW_TESTING_STATIC_INSTALL_INTERFACE_LIBS "ws2_32.dll") +endif() set(ARROW_TESTING_SRCS io/test_common.cc @@ -344,115 +632,92 @@ set(ARROW_TESTING_SRCS testing/generator.cc testing/util.cc) -# Add dependencies for third-party allocators. -# If possible we only want memory_pool.cc to wait for allocators to finish building, -# but that only works with Ninja -# (see https://gitlab.kitware.com/cmake/cmake/issues/19677) - -set(_allocator_dependencies "") # Empty list -if(jemalloc_VENDORED) - list(APPEND _allocator_dependencies jemalloc_ep) -endif() -if(mimalloc_VENDORED) - list(APPEND _allocator_dependencies mimalloc_ep) -endif() - -if(_allocator_dependencies) - if("${CMAKE_GENERATOR}" STREQUAL "Ninja") - set_source_files_properties(memory_pool.cc PROPERTIES OBJECT_DEPENDS - "${_allocator_dependencies}") - else() - add_dependencies(arrow_dependencies ${_allocator_dependencies}) - endif() - set_source_files_properties(memory_pool.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON - SKIP_UNITY_BUILD_INCLUSION ON) -endif() - -unset(_allocator_dependencies) - -if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set_property(SOURCE util/io_util.cc - APPEND_STRING - PROPERTY COMPILE_FLAGS " -Wno-unused-macros ") -endif() - # # Configure the base Arrow libraries # if(ARROW_BUILD_INTEGRATION OR ARROW_BUILD_TESTS) - list(APPEND - ARROW_SRCS - integration/c_data_integration_internal.cc - integration/json_integration.cc - integration/json_internal.cc) + arrow_add_object_library(ARROW_INTEGRATION integration/c_data_integration_internal.cc + integration/json_integration.cc integration/json_internal.cc) + foreach(ARROW_INTEGRATION_TARGET ${ARROW_INTEGRATION_TARGETS}) + target_link_libraries(${ARROW_INTEGRATION_TARGET} PRIVATE RapidJSON) + endforeach() +else() + set(ARROW_INTEGRATION_TARGET_SHARED) + set(ARROW_INTEGRATION_TARGET_STATIC) endif() if(ARROW_CSV) - list(APPEND - ARROW_SRCS - csv/converter.cc - csv/chunker.cc - csv/column_builder.cc - csv/column_decoder.cc - csv/options.cc - csv/parser.cc - csv/reader.cc - csv/writer.cc) + arrow_add_object_library(ARROW_CSV + csv/converter.cc + csv/chunker.cc + csv/column_builder.cc + csv/column_decoder.cc + csv/options.cc + csv/parser.cc + csv/reader.cc + csv/writer.cc) + if(ARROW_USE_XSIMD) + foreach(ARROW_CSV_TARGET ${ARROW_CSV_TARGETS}) + target_link_libraries(${ARROW_CSV_TARGET} PRIVATE ${ARROW_XSIMD}) + endforeach() + endif() list(APPEND ARROW_TESTING_SRCS csv/test_common.cc) +else() + set(ARROW_CSV_TARGET_SHARED) + set(ARROW_CSV_TARGET_STATIC) endif() # Baseline Compute functionality + scalar casts and a few select kernels -list(APPEND - ARROW_SRCS - compute/api_aggregate.cc - compute/api_scalar.cc - compute/api_vector.cc - compute/cast.cc - compute/exec.cc - compute/expression.cc - compute/function.cc - compute/function_internal.cc - compute/kernel.cc - compute/key_hash.cc - compute/key_map.cc - compute/light_array.cc - compute/ordering.cc - compute/registry.cc - compute/kernels/codegen_internal.cc - compute/kernels/row_encoder.cc - compute/kernels/ree_util_internal.cc - compute/kernels/scalar_cast_boolean.cc - compute/kernels/scalar_cast_dictionary.cc - compute/kernels/scalar_cast_extension.cc - compute/kernels/scalar_cast_internal.cc - compute/kernels/scalar_cast_nested.cc - compute/kernels/scalar_cast_numeric.cc - compute/kernels/scalar_cast_string.cc - compute/kernels/scalar_cast_temporal.cc - compute/kernels/util_internal.cc - compute/kernels/vector_hash.cc - compute/kernels/vector_selection.cc - compute/kernels/vector_selection_filter_internal.cc - compute/kernels/vector_selection_internal.cc - compute/kernels/vector_selection_take_internal.cc - compute/row/encode_internal.cc - compute/row/compare_internal.cc - compute/row/grouper.cc - compute/row/row_internal.cc - compute/util.cc) - -append_runtime_avx2_src(compute/key_hash_avx2.cc) -append_runtime_avx2_bmi2_src(compute/key_map_avx2.cc) -append_runtime_avx2_src(compute/row/compare_internal_avx2.cc) -append_runtime_avx2_src(compute/row/encode_internal_avx2.cc) -append_runtime_avx2_bmi2_src(compute/util_avx2.cc) +set(ARROW_COMPUTE_SRCS + compute/api_aggregate.cc + compute/api_scalar.cc + compute/api_vector.cc + compute/cast.cc + compute/exec.cc + compute/expression.cc + compute/function.cc + compute/function_internal.cc + compute/kernel.cc + compute/key_hash.cc + compute/key_map.cc + compute/light_array.cc + compute/ordering.cc + compute/registry.cc + compute/kernels/codegen_internal.cc + compute/kernels/row_encoder.cc + compute/kernels/ree_util_internal.cc + compute/kernels/scalar_cast_boolean.cc + compute/kernels/scalar_cast_dictionary.cc + compute/kernels/scalar_cast_extension.cc + compute/kernels/scalar_cast_internal.cc + compute/kernels/scalar_cast_nested.cc + compute/kernels/scalar_cast_numeric.cc + compute/kernels/scalar_cast_string.cc + compute/kernels/scalar_cast_temporal.cc + compute/kernels/util_internal.cc + compute/kernels/vector_hash.cc + compute/kernels/vector_selection.cc + compute/kernels/vector_selection_filter_internal.cc + compute/kernels/vector_selection_internal.cc + compute/kernels/vector_selection_take_internal.cc + compute/row/encode_internal.cc + compute/row/compare_internal.cc + compute/row/grouper.cc + compute/row/row_internal.cc + compute/util.cc) + +append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/key_hash_avx2.cc) +append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/key_map_avx2.cc) +append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/compare_internal_avx2.cc) +append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/encode_internal_avx2.cc) +append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/util_avx2.cc) if(ARROW_COMPUTE) # Include the remaining kernels list(APPEND - ARROW_SRCS + ARROW_COMPUTE_SRCS compute/kernels/aggregate_basic.cc compute/kernels/aggregate_mode.cc compute/kernels/aggregate_quantile.cc @@ -482,49 +747,101 @@ if(ARROW_COMPUTE) compute/kernels/vector_select_k.cc compute/kernels/vector_sort.cc) - append_runtime_avx2_src(compute/kernels/aggregate_basic_avx2.cc) - append_runtime_avx512_src(compute/kernels/aggregate_basic_avx512.cc) + append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/kernels/aggregate_basic_avx2.cc) + append_runtime_avx512_src(ARROW_COMPUTE_SRCS compute/kernels/aggregate_basic_avx512.cc) +endif() + +arrow_add_object_library(ARROW_COMPUTE ${ARROW_COMPUTE_SRCS}) +if(ARROW_USE_BOOST) + foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS}) + target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE Boost::headers) + endforeach() +endif() +if(ARROW_USE_XSIMD) + foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS}) + target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE ${ARROW_XSIMD}) + endforeach() +endif() +if(ARROW_WITH_OPENTELEMETRY) + foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS}) + target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE ${ARROW_OPENTELEMETRY_LIBS}) + endforeach() +endif() +if(ARROW_WITH_RE2) + foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS}) + target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE re2::re2) + endforeach() +endif() +if(ARROW_WITH_UTF8PROC) + foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS}) + target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE utf8proc::utf8proc) + endforeach() endif() if(ARROW_FILESYSTEM) - list(APPEND - ARROW_SRCS - filesystem/filesystem.cc - filesystem/localfs.cc - filesystem/mockfs.cc - filesystem/path_util.cc - filesystem/util_internal.cc) + set(ARROW_FILESYSTEM_SRCS + filesystem/filesystem.cc + filesystem/localfs.cc + filesystem/mockfs.cc + filesystem/path_util.cc + filesystem/util_internal.cc) if(ARROW_AZURE) - list(APPEND ARROW_SRCS filesystem/azurefs.cc) + list(APPEND ARROW_FILESYSTEM_SRCS filesystem/azurefs.cc) set_source_files_properties(filesystem/azurefs.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON SKIP_UNITY_BUILD_INCLUSION ON) endif() if(ARROW_GCS) - list(APPEND ARROW_SRCS filesystem/gcsfs.cc filesystem/gcsfs_internal.cc) + list(APPEND ARROW_FILESYSTEM_SRCS filesystem/gcsfs.cc filesystem/gcsfs_internal.cc) set_source_files_properties(filesystem/gcsfs.cc filesystem/gcsfs_internal.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON SKIP_UNITY_BUILD_INCLUSION ON) endif() if(ARROW_HDFS) - list(APPEND ARROW_SRCS filesystem/hdfs.cc) + list(APPEND ARROW_FILESYSTEM_SRCS filesystem/hdfs.cc) endif() if(ARROW_S3) - list(APPEND ARROW_SRCS filesystem/s3fs.cc) + list(APPEND ARROW_FILESYSTEM_SRCS filesystem/s3fs.cc) set_source_files_properties(filesystem/s3fs.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON SKIP_UNITY_BUILD_INCLUSION ON) endif() + arrow_add_object_library(ARROW_FILESYSTEM ${ARROW_FILESYSTEM_SRCS}) + if(ARROW_AZURE) + foreach(ARROW_FILESYSTEM_TARGET ${ARROW_FILESYSTEM_TARGETS}) + target_link_libraries(${ARROW_FILESYSTEM_TARGET} + PRIVATE ${AZURE_SDK_LINK_LIBRARIES}) + endforeach() + endif() + if(ARROW_GCS) + foreach(ARROW_FILESYSTEM_TARGET ${ARROW_FILESYSTEM_TARGETS}) + target_link_libraries(${ARROW_FILESYSTEM_TARGET} PRIVATE google-cloud-cpp::storage) + endforeach() + endif() + if(ARROW_HDFS) + foreach(ARROW_FILESYSTEM_TARGET ${ARROW_FILESYSTEM_TARGETS}) + target_link_libraries(${ARROW_FILESYSTEM_TARGET} PRIVATE arrow::hadoop) + endforeach() + endif() + if(ARROW_S3) + foreach(ARROW_FILESYSTEM_TARGET ${ARROW_FILESYSTEM_TARGETS}) + target_link_libraries(${ARROW_FILESYSTEM_TARGET} PRIVATE ${AWSSDK_LINK_LIBRARIES}) + endforeach() + endif() + list(APPEND ARROW_TESTING_SHARED_LINK_LIBS ${ARROW_GTEST_GMOCK}) list(APPEND ARROW_TESTING_STATIC_LINK_LIBS ${ARROW_GTEST_GMOCK}) list(APPEND ARROW_TESTING_SRCS filesystem/test_util.cc) +else() + set(ARROW_FILESYSTEM_TARGET_SHARED) + set(ARROW_FILESYSTEM_TARGET_STATIC) endif() if(ARROW_IPC) list(APPEND - ARROW_SRCS + ARROW_IPC_SRCS ipc/dictionary.cc ipc/feather.cc ipc/message.cc @@ -532,32 +849,51 @@ if(ARROW_IPC) ipc/options.cc ipc/reader.cc ipc/writer.cc) - if(ARROW_JSON) - list(APPEND ARROW_SRCS ipc/json_simple.cc) + list(APPEND ARROW_IPC_SRCS ipc/json_simple.cc) + endif() + arrow_add_object_library(ARROW_IPC ${ARROW_IPC_SRCS}) + foreach(ARROW_IPC_TARGET ${ARROW_IPC_TARGETS}) + target_link_libraries(${ARROW_IPC_TARGET} PRIVATE arrow::flatbuffers) + endforeach() + if(ARROW_JSON) + foreach(ARROW_IPC_TARGET ${ARROW_IPC_TARGETS}) + target_link_libraries(${ARROW_IPC_TARGET} PRIVATE RapidJSON) + endforeach() endif() +else() + set(ARROW_IPC_TARGET_SHARED) + set(ARROW_IPC_TARGET_STATIC) endif() if(ARROW_JSON) - list(APPEND - ARROW_SRCS - extension/fixed_shape_tensor.cc - json/options.cc - json/chunked_builder.cc - json/chunker.cc - json/converter.cc - json/object_parser.cc - json/object_writer.cc - json/parser.cc - json/reader.cc) + arrow_add_object_library(ARROW_JSON + extension/fixed_shape_tensor.cc + json/options.cc + json/chunked_builder.cc + json/chunker.cc + json/converter.cc + json/object_parser.cc + json/object_writer.cc + json/parser.cc + json/reader.cc) + foreach(ARROW_JSON_TARGET ${ARROW_JSON_TARGETS}) + target_link_libraries(${ARROW_JSON_TARGET} PRIVATE RapidJSON) + endforeach() +else() + set(ARROW_JSON_TARGET_SHARED) + set(ARROW_JSON_TARGET_STATIC) endif() if(ARROW_ORC) - list(APPEND - ARROW_SRCS - adapters/orc/adapter.cc - adapters/orc/options.cc - adapters/orc/util.cc) + arrow_add_object_library(ARROW_ORC adapters/orc/adapter.cc adapters/orc/options.cc + adapters/orc/util.cc) + foreach(ARROW_ORC_TARGET ${ARROW_ORC_TARGETS}) + target_link_libraries(${ARROW_ORC_TARGET} PRIVATE orc::orc) + endforeach() +else() + set(ARROW_ORC_TARGET_SHARED) + set(ARROW_ORC_TARGET_STATIC) endif() if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT) @@ -566,8 +902,6 @@ if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT) set(ARROW_SHARED_LINK_FLAGS ${ARROW_VERSION_SCRIPT_FLAGS}) endif() -set(ARROW_ALL_SRCS ${ARROW_SRCS} ${ARROW_C_SRCS}) - if(ARROW_BUILD_STATIC AND ARROW_BUNDLED_STATIC_LIBS) set(ARROW_BUILD_BUNDLED_DEPENDENCIES TRUE) else() @@ -610,14 +944,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") endif() endif() -# Need -latomic on Raspbian. -# See also: https://issues.apache.org/jira/browse/ARROW-12860 -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7") - string(APPEND ARROW_PC_LIBS_PRIVATE " -latomic") - list(APPEND ARROW_SHARED_INSTALL_INTERFACE_LIBS "atomic") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS "atomic") -endif() - # If libarrow.a is only built, "pkg-config --cflags --libs arrow" # outputs build flags for static linking not shared # linking. ARROW_PC_* except ARROW_PC_*_PRIVATE are for the static @@ -643,21 +969,42 @@ add_arrow_lib(arrow PKG_CONFIG_NAME arrow SOURCES - ${ARROW_ALL_SRCS} + ${ARROW_SRCS} OUTPUTS ARROW_LIBRARIES PRECOMPILED_HEADERS "$<$:arrow/pch.h>" - DEPENDENCIES - arrow_dependencies SHARED_LINK_FLAGS ${ARROW_SHARED_LINK_FLAGS} - SHARED_LINK_LIBS - ${ARROW_SHARED_LINK_LIBS} SHARED_PRIVATE_LINK_LIBS + ${ARROW_ARRAY_TARGET_SHARED} + ${ARROW_COMPUTE_TARGET_SHARED} + ${ARROW_CSV_TARGET_SHARED} + ${ARROW_FILESYSTEM_TARGET_SHARED} + ${ARROW_INTEGRATION_TARGET_SHARED} + ${ARROW_IO_TARGET_SHARED} + ${ARROW_IPC_TARGET_SHARED} + ${ARROW_JSON_TARGET_SHARED} + ${ARROW_MEMORY_POOL_TARGET_SHARED} + ${ARROW_ORC_TARGET_SHARED} + ${ARROW_UTIL_TARGET_SHARED} + ${ARROW_VENDORED_TARGET_SHARED} ${ARROW_SHARED_PRIVATE_LINK_LIBS} + ${ARROW_SYSTEM_LINK_LIBS} STATIC_LINK_LIBS - ${ARROW_STATIC_LINK_LIBS} + ${ARROW_ARRAY_TARGET_STATIC} + ${ARROW_COMPUTE_TARGET_STATIC} + ${ARROW_CSV_TARGET_STATIC} + ${ARROW_FILESYSTEM_TARGET_STATIC} + ${ARROW_INTEGRATION_TARGET_STATIC} + ${ARROW_IO_TARGET_STATIC} + ${ARROW_IPC_TARGET_STATIC} + ${ARROW_JSON_TARGET_STATIC} + ${ARROW_MEMORY_POOL_TARGET_STATIC} + ${ARROW_ORC_TARGET_STATIC} + ${ARROW_UTIL_TARGET_STATIC} + ${ARROW_VENDORED_TARGET_STATIC} + ${ARROW_SYSTEM_LINK_LIBS} STATIC_INSTALL_INTERFACE_LIBS ${ARROW_STATIC_INSTALL_INTERFACE_LIBS} SHARED_INSTALL_INTERFACE_LIBS @@ -720,16 +1067,6 @@ if(ARROW_WITH_BACKTRACE) endif() if(ARROW_TESTING) - # that depend on gtest - set(ARROW_TESTING_SHARED_INSTALL_INTERFACE_LIBS Arrow::arrow_shared) - set(ARROW_TESTING_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static) - if(GTest_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_TESTING_SHARED_INSTALL_INTERFACE_LIBS ${ARROW_GTEST_GTEST}) - list(APPEND ARROW_TESTING_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_GTEST_GTEST}) - else() - list(APPEND ARROW_TESTING_SHARED_INSTALL_INTERFACE_LIBS ArrowTesting::gtest) - list(APPEND ARROW_TESTING_STATIC_INSTALL_INTERFACE_LIBS ArrowTesting::gtest) - endif() add_arrow_lib(arrow_testing CMAKE_PACKAGE_NAME ArrowTesting @@ -741,10 +1078,10 @@ if(ARROW_TESTING) ARROW_TESTING_LIBRARIES PRECOMPILED_HEADERS "$<$:arrow/pch.h>" - DEPENDENCIES - arrow_test_dependencies SHARED_LINK_LIBS ${ARROW_TESTING_SHARED_LINK_LIBS} + SHARED_PRIVATE_LINK_LIBS + ${ARROW_TESTING_SHARED_PRIVATE_LINK_LIBS} SHARED_INSTALL_INTERFACE_LIBS ${ARROW_TESTING_SHARED_INSTALL_INTERFACE_LIBS} STATIC_LINK_LIBS @@ -807,7 +1144,6 @@ add_arrow_test(misc_test status_test.cc) add_arrow_test(public_api_test) - set_source_files_properties(public_api_test.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON SKIP_UNITY_BUILD_INCLUSION ON) diff --git a/cpp/src/arrow/acero/CMakeLists.txt b/cpp/src/arrow/acero/CMakeLists.txt index b77d52a23eedb..31ed4a6a69b6a 100644 --- a/cpp/src/arrow/acero/CMakeLists.txt +++ b/cpp/src/arrow/acero/CMakeLists.txt @@ -62,26 +62,19 @@ append_acero_runtime_avx2_src(bloom_filter_avx2.cc) append_acero_runtime_avx2_src(swiss_join_avx2.cc) set(ARROW_ACERO_SHARED_LINK_LIBS) +set(ARROW_ACERO_SHARED_PRIVATE_LINK_LIBS) set(ARROW_ACERO_STATIC_LINK_LIBS) set(ARROW_ACERO_STATIC_INSTALL_INTERFACE_LIBS) set(ARROW_ACERO_SHARED_INSTALL_INTERFACE_LIBS) if(ARROW_WITH_OPENTELEMETRY) - list(APPEND - ARROW_ACERO_SHARED_LINK_LIBS - opentelemetry-cpp::trace - opentelemetry-cpp::ostream_span_exporter - opentelemetry-cpp::otlp_http_exporter) - list(APPEND - ARROW_ACERO_STATIC_LINK_LIBS - opentelemetry-cpp::trace - opentelemetry-cpp::ostream_span_exporter - opentelemetry-cpp::otlp_http_exporter) + list(APPEND ARROW_ACERO_SHARED_PRIVATE_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS}) + list(APPEND ARROW_ACERO_STATIC_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS}) endif() list(APPEND ARROW_ACERO_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static) list(APPEND ARROW_ACERO_SHARED_INSTALL_INTERFACE_LIBS Arrow::arrow_shared) -list(APPEND ARROW_ACERO_STATIC_LINK_LIBS arrow_static ${ARROW_STATIC_LINK_LIBS}) +list(APPEND ARROW_ACERO_STATIC_LINK_LIBS arrow_static) list(APPEND ARROW_ACERO_SHARED_LINK_LIBS arrow_shared) add_arrow_lib(arrow_acero @@ -95,10 +88,10 @@ add_arrow_lib(arrow_acero ${ARROW_ACERO_SRCS} PRECOMPILED_HEADERS "$<$:arrow/acero/pch.h>" - DEPENDENCIES - toolchain SHARED_LINK_LIBS ${ARROW_ACERO_SHARED_LINK_LIBS} + SHARED_PRIVATE_LINK_LIBS + ${ARROW_ACERO_SHARED_PRIVATE_LINK_LIBS} SHARED_INSTALL_INTERFACE_LIBS ${ARROW_ACERO_SHARED_INSTALL_INTERFACE_LIBS} STATIC_LINK_LIBS @@ -122,12 +115,22 @@ endforeach() # Define arrow_acero_testing object library for common test files if(ARROW_TESTING) - add_library(arrow_acero_testing OBJECT test_util_internal.cc) + # test_nodes.cc isn't used by all tests but link to it for simple + # CMakeLists.txt. + add_library(arrow_acero_testing OBJECT test_nodes.cc test_util_internal.cc) # Even though this is still just an object library we still need to "link" our # dependencies so that include paths are configured correctly target_link_libraries(arrow_acero_testing PRIVATE ${ARROW_ACERO_TEST_LINK_LIBS}) + # Only for test_nodes.cc. + if(ARROW_WITH_OPENTELEMETRY) + target_link_libraries(arrow_acero_testing PRIVATE ${ARROW_OPENTELEMETRY_LIBS}) + endif() list(APPEND ARROW_ACERO_TEST_LINK_LIBS arrow_acero_testing) endif() +# Only for hash_aggregate_test.cc. +if(ARROW_USE_BOOST) + list(APPEND ARROW_ACERO_TEST_LINK_LIBS Boost::headers) +endif() # Adding unit tests part of the "dataset" portion of the test suite function(add_arrow_acero_test REL_TEST_NAME) @@ -162,26 +165,20 @@ function(add_arrow_acero_test REL_TEST_NAME) ${ARG_UNPARSED_ARGUMENTS}) endfunction() -add_arrow_acero_test(plan_test - SOURCES - plan_test.cc - test_nodes_test.cc - test_nodes.cc) -add_arrow_acero_test(source_node_test SOURCES source_node_test.cc test_nodes.cc) -add_arrow_acero_test(fetch_node_test SOURCES fetch_node_test.cc test_nodes.cc) -add_arrow_acero_test(order_by_node_test SOURCES order_by_node_test.cc test_nodes.cc) +add_arrow_acero_test(plan_test SOURCES plan_test.cc test_nodes_test.cc) +add_arrow_acero_test(source_node_test SOURCES source_node_test.cc) +add_arrow_acero_test(fetch_node_test SOURCES fetch_node_test.cc) +add_arrow_acero_test(order_by_node_test SOURCES order_by_node_test.cc) add_arrow_acero_test(hash_join_node_test SOURCES hash_join_node_test.cc bloom_filter_test.cc) -add_arrow_acero_test(pivot_longer_node_test SOURCES pivot_longer_node_test.cc - test_nodes.cc) +add_arrow_acero_test(pivot_longer_node_test SOURCES pivot_longer_node_test.cc) # asof_join_node and sorted_merge_node use std::thread internally # and doesn't use ThreadPool so it will # be broken if threading is turned off if(ARROW_ENABLE_THREADING) - add_arrow_acero_test(asof_join_node_test SOURCES asof_join_node_test.cc test_nodes.cc) - add_arrow_acero_test(sorted_merge_node_test SOURCES sorted_merge_node_test.cc - test_nodes.cc) + add_arrow_acero_test(asof_join_node_test SOURCES asof_join_node_test.cc) + add_arrow_acero_test(sorted_merge_node_test SOURCES sorted_merge_node_test.cc) endif() add_arrow_acero_test(tpch_node_test SOURCES tpch_node_test.cc) diff --git a/cpp/src/arrow/adapters/orc/CMakeLists.txt b/cpp/src/arrow/adapters/orc/CMakeLists.txt index 4d66151cd38c9..14fb8e681d14b 100644 --- a/cpp/src/arrow/adapters/orc/CMakeLists.txt +++ b/cpp/src/arrow/adapters/orc/CMakeLists.txt @@ -35,6 +35,7 @@ add_arrow_test(adapter_test PREFIX "arrow-orc" STATIC_LINK_LIBS + orc::orc ${ARROW_ORC_STATIC_LINK_LIBS}) set_source_files_properties(adapter_test.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON diff --git a/cpp/src/arrow/compute/CMakeLists.txt b/cpp/src/arrow/compute/CMakeLists.txt index e14d78ff6e5ca..badcf4f2f26ac 100644 --- a/cpp/src/arrow/compute/CMakeLists.txt +++ b/cpp/src/arrow/compute/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -add_custom_target(arrow_compute) +add_custom_target(arrow-compute-tests) arrow_install_all_headers("arrow/compute") @@ -29,7 +29,7 @@ endif() # set(ARROW_COMPUTE_TEST_PREFIX "arrow-compute") -set(ARROW_COMPUTE_TEST_LABELS "arrow_compute") +set(ARROW_COMPUTE_TEST_LABELS "arrow-compute-tests") set(ARROW_COMPUTE_TEST_ARGS PREFIX ${ARROW_COMPUTE_TEST_PREFIX} LABELS ${ARROW_COMPUTE_TEST_LABELS}) diff --git a/cpp/src/arrow/compute/kernels/CMakeLists.txt b/cpp/src/arrow/compute/kernels/CMakeLists.txt index 4350cd57ff026..afb30996eac15 100644 --- a/cpp/src/arrow/compute/kernels/CMakeLists.txt +++ b/cpp/src/arrow/compute/kernels/CMakeLists.txt @@ -23,7 +23,7 @@ if(ARROW_TESTING) add_library(arrow_compute_kernels_testing OBJECT test_util.cc) # Even though this is still just an object library we still need to "link" our # dependencies so that include paths are configured correctly - target_link_libraries(arrow_compute_kernels_testing PRIVATE ${ARROW_GTEST_GMOCK}) + target_link_libraries(arrow_compute_kernels_testing PUBLIC ${ARROW_GTEST_GMOCK}) endif() add_arrow_test(scalar_cast_test @@ -36,13 +36,17 @@ add_arrow_test(scalar_cast_test # ---------------------------------------------------------------------- # Scalar kernels +set(ARROW_COMPUTE_SCALAR_TYPE_TEST_LINK_LIBS arrow_compute_kernels_testing) +if(ARROW_WITH_UTF8PROC) + list(APPEND ARROW_COMPUTE_SCALAR_TYPE_TEST_LINK_LIBS utf8proc::utf8proc) +endif() add_arrow_compute_test(scalar_type_test SOURCES scalar_boolean_test.cc scalar_nested_test.cc scalar_string_test.cc EXTRA_LINK_LIBS - arrow_compute_kernels_testing) + ${ARROW_COMPUTE_SCALAR_TYPE_TEST_LINK_LIBS}) add_arrow_compute_test(scalar_if_else_test SOURCES @@ -126,7 +130,8 @@ add_arrow_compute_test(aggregate_test SOURCES aggregate_test.cc EXTRA_LINK_LIBS - arrow_compute_kernels_testing) + arrow_compute_kernels_testing + Boost::headers) # ---------------------------------------------------------------------- # Utilities diff --git a/cpp/src/arrow/compute/kernels/scalar_string_benchmark.cc b/cpp/src/arrow/compute/kernels/scalar_string_benchmark.cc index 0977ea7806cb4..909c89dbe4795 100644 --- a/cpp/src/arrow/compute/kernels/scalar_string_benchmark.cc +++ b/cpp/src/arrow/compute/kernels/scalar_string_benchmark.cc @@ -25,6 +25,7 @@ #include "arrow/testing/random.h" #include "arrow/util/benchmark_util.h" #include "arrow/util/checked_cast.h" +#include "arrow/util/config.h" namespace arrow { diff --git a/cpp/src/arrow/dataset/CMakeLists.txt b/cpp/src/arrow/dataset/CMakeLists.txt index 1afef3e3b0463..e48bcfaf65bcb 100644 --- a/cpp/src/arrow/dataset/CMakeLists.txt +++ b/cpp/src/arrow/dataset/CMakeLists.txt @@ -38,6 +38,7 @@ endif() set(ARROW_DATASET_STATIC_LINK_LIBS) set(ARROW_DATASET_SHARED_LINK_LIBS) +set(ARROW_DATASET_SHARED_PRIVATE_LINK_LIBS) set(ARROW_DATASET_STATIC_INSTALL_INTERFACE_LIBS) set(ARROW_DATASET_SHARED_INSTALL_INTERFACE_LIBS) @@ -65,9 +66,14 @@ endif() list(APPEND ARROW_DATASET_STATIC_INSTALL_INTERFACE_LIBS ArrowAcero::arrow_acero_static) list(APPEND ARROW_DATASET_SHARED_INSTALL_INTERFACE_LIBS ArrowAcero::arrow_acero_shared) -list(APPEND ARROW_DATASET_STATIC_LINK_LIBS arrow_acero_static ${ARROW_STATIC_LINK_LIBS}) +list(APPEND ARROW_DATASET_STATIC_LINK_LIBS arrow_acero_static) list(APPEND ARROW_DATASET_SHARED_LINK_LIBS arrow_acero_shared) +if(ARROW_WITH_OPENTELEMETRY) + list(APPEND ARROW_DATASET_STATIC_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS}) + list(APPEND ARROW_DATASET_SHARED_PRIVATE_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS}) +endif() + add_arrow_lib(arrow_dataset CMAKE_PACKAGE_NAME ArrowDataset @@ -79,12 +85,12 @@ add_arrow_lib(arrow_dataset ${ARROW_DATASET_SRCS} PRECOMPILED_HEADERS "$<$:arrow/dataset/pch.h>" - DEPENDENCIES - toolchain PRIVATE_INCLUDES ${ARROW_DATASET_PRIVATE_INCLUDES} SHARED_LINK_LIBS ${ARROW_DATASET_SHARED_LINK_LIBS} + SHARED_PRIVATE_LINK_LIBS + ${ARROW_DATASET_SHARED_PRIVATE_LINK_LIBS} SHARED_INSTALL_INTERFACE_LIBS ${ARROW_DATASET_SHARED_INSTALL_INTERFACE_LIBS} STATIC_LINK_LIBS @@ -121,7 +127,7 @@ endif() function(ADD_ARROW_DATASET_TEST REL_TEST_NAME) set(options) set(one_value_args PREFIX) - set(multi_value_args LABELS) + set(multi_value_args EXTRA_LINK_LIBS LABELS) cmake_parse_arguments(ARG "${options}" "${one_value_args}" @@ -134,6 +140,12 @@ function(ADD_ARROW_DATASET_TEST REL_TEST_NAME) set(PREFIX "arrow-dataset") endif() + if(ARG_EXTRA_LINK_LIBS) + set(EXTRA_LINK_LIBS ${ARG_EXTRA_LINK_LIBS}) + else() + set(EXTRA_LINK_LIBS ${ARROW_DATASET_TEST_LINK_LIBS}) + endif() + if(ARG_LABELS) set(LABELS ${ARG_LABELS}) else() @@ -142,7 +154,7 @@ function(ADD_ARROW_DATASET_TEST REL_TEST_NAME) add_arrow_test(${REL_TEST_NAME} EXTRA_LINK_LIBS - ${ARROW_DATASET_TEST_LINK_LIBS} + ${EXTRA_LINK_LIBS} PREFIX ${PREFIX} LABELS @@ -165,11 +177,13 @@ if(ARROW_CSV) endif() if(ARROW_JSON) - add_arrow_dataset_test(file_json_test) + add_arrow_dataset_test(file_json_test EXTRA_LINK_LIBS ${ARROW_DATASET_TEST_LINK_LIBS} + RapidJSON) endif() if(ARROW_ORC) - add_arrow_dataset_test(file_orc_test) + add_arrow_dataset_test(file_orc_test EXTRA_LINK_LIBS ${ARROW_DATASET_TEST_LINK_LIBS} + orc::orc) endif() if(ARROW_PARQUET) diff --git a/cpp/src/arrow/dataset/file_csv_test.cc b/cpp/src/arrow/dataset/file_csv_test.cc index 755b202439be6..60a6685dc22fd 100644 --- a/cpp/src/arrow/dataset/file_csv_test.cc +++ b/cpp/src/arrow/dataset/file_csv_test.cc @@ -36,6 +36,7 @@ #include "arrow/testing/generator.h" #include "arrow/testing/gtest_util.h" #include "arrow/testing/util.h" +#include "arrow/util/config.h" namespace arrow { namespace dataset { diff --git a/cpp/src/arrow/filesystem/CMakeLists.txt b/cpp/src/arrow/filesystem/CMakeLists.txt index 77e93223cd116..b9ed11e7608f3 100644 --- a/cpp/src/arrow/filesystem/CMakeLists.txt +++ b/cpp/src/arrow/filesystem/CMakeLists.txt @@ -43,6 +43,7 @@ if(ARROW_GCS) EXTRA_LABELS filesystem EXTRA_LINK_LIBS + google-cloud-cpp::storage Boost::filesystem Boost::system) endif() @@ -52,6 +53,7 @@ if(ARROW_AZURE) EXTRA_LABELS filesystem EXTRA_LINK_LIBS + ${AZURE_SDK_LINK_LIBRARIES} Boost::filesystem Boost::system) endif() @@ -64,6 +66,7 @@ if(ARROW_S3) EXTRA_LABELS filesystem EXTRA_LINK_LIBS + ${AWSSDK_LINK_LIBRARIES} Boost::filesystem Boost::system) if(TARGET arrow-s3fs-test) @@ -98,6 +101,7 @@ if(ARROW_S3) s3fs_benchmark.cc s3_test_util.cc STATIC_LINK_LIBS + ${AWSSDK_LINK_LIBRARIES} ${ARROW_BENCHMARK_LINK_LIBS} Boost::filesystem Boost::system) diff --git a/cpp/src/arrow/filesystem/s3fs_test.cc b/cpp/src/arrow/filesystem/s3fs_test.cc index 394f59e91a454..ad7aaa1bd43cf 100644 --- a/cpp/src/arrow/filesystem/s3fs_test.cc +++ b/cpp/src/arrow/filesystem/s3fs_test.cc @@ -190,8 +190,11 @@ class S3TestMixin : public AwsTestMixin { } void TearDown() override { - client_.reset(); // Aws::S3::S3Client destruction relies on AWS SDK, so it must be - // reset before Aws::ShutdownAPI + // Aws::S3::S3Client destruction relies on AWS SDK, so it must be + // reset before Aws::ShutdownAPI + client_.reset(); + client_config_.reset(); + AwsTestMixin::TearDown(); } @@ -468,6 +471,13 @@ class TestS3FS : public S3TestMixin { } } + void TearDown() override { + // Aws::S3::S3Client destruction relies on AWS SDK, so it must be + // reset before Aws::ShutdownAPI + fs_.reset(); + S3TestMixin::TearDown(); + } + Result> MakeNewFileSystem( io::IOContext io_context = io::default_io_context()) { options_.ConfigureAccessKey(minio_->access_key(), minio_->secret_key()); @@ -1359,6 +1369,14 @@ class TestS3FSGeneric : public S3TestMixin, public GenericFileSystemTest { fs_ = std::make_shared("s3fs-test-bucket", s3fs_); } + void TearDown() override { + // Aws::S3::S3Client destruction relies on AWS SDK, so it must be + // reset before Aws::ShutdownAPI + s3fs_.reset(); + fs_.reset(); + S3TestMixin::TearDown(); + } + protected: std::shared_ptr GetEmptyFileSystem() override { return fs_; } diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt index 91e0fbf9136d3..8eba89b8e78a6 100644 --- a/cpp/src/arrow/flight/CMakeLists.txt +++ b/cpp/src/arrow/flight/CMakeLists.txt @@ -20,7 +20,9 @@ add_custom_target(arrow_flight) arrow_install_all_headers("arrow/flight") set(ARROW_FLIGHT_LINK_LIBS gRPC::grpc++ ${ARROW_PROTOBUF_LIBPROTOBUF}) - +if(ARROW_WITH_OPENTELEMETRY) + list(APPEND ARROW_FLIGHT_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS}) +endif() if(WIN32) list(APPEND ARROW_FLIGHT_LINK_LIBS ws2_32.lib) endif() @@ -66,8 +68,7 @@ list(APPEND ARROW_FLIGHT_TEST_INTERFACE_LIBS Boost::headers Boost::filesystem - Boost::system - ${ARROW_GTEST_GMOCK}) + Boost::system) list(APPEND ARROW_FLIGHT_TEST_LINK_LIBS gRPC::grpc++) # TODO(wesm): Protobuf shared vs static linking @@ -260,9 +261,7 @@ if(ARROW_TESTING) test_definitions.cc test_util.cc DEPENDENCIES - ${ARROW_GTEST_GTEST} flight_grpc_gen - arrow_dependencies SHARED_LINK_LIBS ${ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS} SHARED_INSTALL_INTERFACE_LIBS diff --git a/cpp/src/arrow/integration/CMakeLists.txt b/cpp/src/arrow/integration/CMakeLists.txt index 0d7b7e5a7d47d..350487052de1b 100644 --- a/cpp/src/arrow/integration/CMakeLists.txt +++ b/cpp/src/arrow/integration/CMakeLists.txt @@ -21,12 +21,15 @@ arrow_install_all_headers("arrow/integration") # - an executable that can be called to answer integration test requests # - a self-(unit)test for the C++ side of integration testing if(ARROW_BUILD_TESTS) - add_arrow_test(json_integration_test EXTRA_LINK_LIBS ${GFLAGS_LIBRARIES}) + add_arrow_test(json_integration_test EXTRA_LINK_LIBS RapidJSON ${GFLAGS_LIBRARIES}) add_dependencies(arrow-integration arrow-json-integration-test) elseif(ARROW_BUILD_INTEGRATION) add_executable(arrow-json-integration-test json_integration_test.cc) - target_link_libraries(arrow-json-integration-test ${ARROW_TEST_LINK_LIBS} - ${GFLAGS_LIBRARIES} ${ARROW_GTEST_GTEST}) + target_link_libraries(arrow-json-integration-test + RapidJSON + ${ARROW_TEST_LINK_LIBS} + ${GFLAGS_LIBRARIES} + ${ARROW_GTEST_GTEST}) add_dependencies(arrow-json-integration-test arrow arrow_testing) add_dependencies(arrow-integration arrow-json-integration-test) diff --git a/cpp/src/arrow/io/CMakeLists.txt b/cpp/src/arrow/io/CMakeLists.txt index d8224192ce0fb..041d511083457 100644 --- a/cpp/src/arrow/io/CMakeLists.txt +++ b/cpp/src/arrow/io/CMakeLists.txt @@ -28,6 +28,7 @@ if(ARROW_HDFS) PREFIX "arrow-io" EXTRA_LINK_LIBS + arrow::hadoop Boost::filesystem Boost::system) endif() diff --git a/cpp/src/arrow/ipc/CMakeLists.txt b/cpp/src/arrow/ipc/CMakeLists.txt index 4b62bdc3a77f2..8b7eee495808b 100644 --- a/cpp/src/arrow/ipc/CMakeLists.txt +++ b/cpp/src/arrow/ipc/CMakeLists.txt @@ -18,12 +18,10 @@ # # Messaging and interprocess communication -add_custom_target(arrow_ipc) - function(ADD_ARROW_IPC_TEST REL_TEST_NAME) set(options) set(one_value_args PREFIX) - set(multi_value_args LABELS) + set(multi_value_args) cmake_parse_arguments(ARG "${options}" "${one_value_args}" @@ -36,17 +34,12 @@ function(ADD_ARROW_IPC_TEST REL_TEST_NAME) set(PREFIX "arrow-ipc") endif() - add_arrow_test(${REL_TEST_NAME} - EXTRA_LINK_LIBS - ${ARROW_DATASET_TEST_LINK_LIBS} - PREFIX - ${PREFIX} - ${ARG_UNPARSED_ARGUMENTS}) + add_arrow_test(${REL_TEST_NAME} PREFIX ${PREFIX} ${ARG_UNPARSED_ARGUMENTS}) endfunction() add_arrow_test(feather_test) add_arrow_ipc_test(json_simple_test) -add_arrow_ipc_test(read_write_test) +add_arrow_ipc_test(read_write_test EXTRA_LINK_LIBS arrow::flatbuffers) add_arrow_ipc_test(tensor_test) # Headers: top level diff --git a/cpp/src/arrow/ipc/read_write_benchmark.cc b/cpp/src/arrow/ipc/read_write_benchmark.cc index ed7e6957df199..defe9790678c0 100644 --- a/cpp/src/arrow/ipc/read_write_benchmark.cc +++ b/cpp/src/arrow/ipc/read_write_benchmark.cc @@ -30,6 +30,7 @@ #include "arrow/testing/gtest_util.h" #include "arrow/testing/random.h" #include "arrow/type.h" +#include "arrow/util/config.h" #include "arrow/util/io_util.h" namespace arrow { diff --git a/cpp/src/arrow/json/CMakeLists.txt b/cpp/src/arrow/json/CMakeLists.txt index f09b15ce51c20..95b299d8f0c33 100644 --- a/cpp/src/arrow/json/CMakeLists.txt +++ b/cpp/src/arrow/json/CMakeLists.txt @@ -23,9 +23,15 @@ add_arrow_test(test parser_test.cc reader_test.cc PREFIX - "arrow-json") + "arrow-json" + EXTRA_LINK_LIBS + RapidJSON) -add_arrow_benchmark(parser_benchmark PREFIX "arrow-json") +add_arrow_benchmark(parser_benchmark + PREFIX + "arrow-json" + EXTRA_LINK_LIBS + RapidJSON) arrow_install_all_headers("arrow/json") # pkg-config support diff --git a/cpp/src/arrow/util/CMakeLists.txt b/cpp/src/arrow/util/CMakeLists.txt index badf8a75078ed..e26efba28594b 100644 --- a/cpp/src/arrow/util/CMakeLists.txt +++ b/cpp/src/arrow/util/CMakeLists.txt @@ -38,6 +38,13 @@ else() set(IO_UTIL_TEST_SOURCES io_util_test.cc) endif() +set(ARROW_UTILITY_TEST_LINK_LIBS Boost::headers) +if(ARROW_USE_XSIMD) + list(APPEND ARROW_UTILITY_TEST_LINK_LIBS ${ARROW_XSIMD}) +endif() +if(ARROW_WITH_OPENTELEMETRY) + list(APPEND ARROW_UTILITY_TEST_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS}) +endif() add_arrow_test(utility-test SOURCES align_util_test.cc @@ -73,7 +80,9 @@ add_arrow_test(utility-test trie_test.cc uri_test.cc utf8_util_test.cc - value_parsing_test.cc) + value_parsing_test.cc + EXTRA_LINK_LIBS + ${ARROW_UTILITY_TEST_LINK_LIBS}) add_arrow_test(async-utility-test SOURCES @@ -96,7 +105,11 @@ add_arrow_test(threading-utility-test test_common.cc thread_pool_test.cc) -add_arrow_test(crc32-test SOURCES crc32_test.cc) +add_arrow_test(crc32-test + SOURCES + crc32_test.cc + EXTRA_LINK_LIBS + Boost::headers) add_arrow_benchmark(bit_block_counter_benchmark) add_arrow_benchmark(bit_util_benchmark) @@ -113,5 +126,10 @@ add_arrow_benchmark(small_vector_benchmark) add_arrow_benchmark(tdigest_benchmark) add_arrow_benchmark(thread_pool_benchmark) add_arrow_benchmark(trie_benchmark) -add_arrow_benchmark(utf8_util_benchmark) +set(ARROW_BENCHMARK_UTF8_UTIL_LINK_LIBS) +if(ARROW_USE_XSIMD) + list(APPEND ARROW_BENCHMARK_UTF8_UTIL_LINK_LIBS ${ARROW_XSIMD}) +endif() +add_arrow_benchmark(utf8_util_benchmark EXTRA_LINK_LIBS + ${ARROW_BENCHMARK_UTF8_UTIL_LINK_LIBS}) add_arrow_benchmark(value_parsing_benchmark) diff --git a/cpp/src/arrow/util/benchmark_main.cc b/cpp/src/arrow/util/benchmark_main.cc deleted file mode 100644 index c9739af03fb53..0000000000000 --- a/cpp/src/arrow/util/benchmark_main.cc +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -#include "benchmark/benchmark.h" - -int main(int argc, char** argv) { - benchmark::Initialize(&argc, argv); - benchmark::RunSpecifiedBenchmarks(); - return 0; -} diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt index 9352ac5c4a938..0f28b0da82fed 100644 --- a/cpp/src/gandiva/CMakeLists.txt +++ b/cpp/src/gandiva/CMakeLists.txt @@ -92,20 +92,24 @@ set(SRC_FILES random_generator_holder.cc ${GANDIVA_PRECOMPILED_CC_PATH}) -set(GANDIVA_OPENSSL_LIBS OpenSSL::Crypto OpenSSL::SSL) +set(GANDIVA_OPENSSL_LIBS ${ARROW_OPENSSL_LIBS}) if(WIN32 AND NOT CMAKE_VERSION VERSION_LESS 3.18) - list(APPEND GANDIVA_OPENSSL_TARGETS OpenSSL::applink) + list(APPEND GANDIVA_OPENSSL_LIBS OpenSSL::applink) endif() set(GANDIVA_SHARED_LINK_LIBS arrow_shared LLVM::LLVM_HEADERS) -set(GANDIVA_SHARED_PRIVATE_LINK_LIBS LLVM::LLVM_LIBS ${GANDIVA_OPENSSL_TARGETS} +set(GANDIVA_SHARED_PRIVATE_LINK_LIBS LLVM::LLVM_LIBS ${GANDIVA_OPENSSL_LIBS} Boost::headers) set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_HEADERS LLVM::LLVM_LIBS - ${GANDIVA_OPENSSL_TARGETS} + ${GANDIVA_OPENSSL_LIBS} Boost::headers) +if(ARROW_USE_XSIMD) + list(APPEND GANDIVA_SHARED_PRIVATE_LINK_LIBS ${ARROW_XSIMD}) + list(APPEND GANDIVA_STATIC_LINK_LIBS ${ARROW_XSIMD}) +endif() if(ARROW_WITH_RE2) list(APPEND GANDIVA_SHARED_PRIVATE_LINK_LIBS re2::re2) list(APPEND GANDIVA_STATIC_LINK_LIBS re2::re2) @@ -117,8 +121,7 @@ endif() if(ARROW_GANDIVA_STATIC_LIBSTDCPP AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )) - set(GANDIVA_STATIC_LINK_LIBS ${GANDIVA_STATIC_LINK_LIBS} -static-libstdc++ - -static-libgcc) + list(APPEND GANDIVA_STATIC_LINK_LIBS -static-libstdc++ -static-libgcc) endif() # if (MSVC) @@ -130,10 +133,8 @@ endif() # endforeach() # endif() if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT) - set(GANDIVA_VERSION_SCRIPT_FLAGS - "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map") - set(GANDIVA_SHARED_LINK_FLAGS - "${GANDIVA_SHARED_LINK_FLAGS} ${GANDIVA_VERSION_SCRIPT_FLAGS}") + string(APPEND GANDIVA_SHARED_LINK_FLAGS + " -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map") endif() add_arrow_lib(gandiva @@ -148,7 +149,6 @@ add_arrow_lib(gandiva OUTPUTS GANDIVA_LIBRARIES DEPENDENCIES - arrow_dependencies precompiled SHARED_LINK_FLAGS ${GANDIVA_SHARED_LINK_FLAGS} @@ -178,16 +178,18 @@ add_dependencies(gandiva ${GANDIVA_LIBRARIES}) arrow_install_all_headers("gandiva") -set(GANDIVA_STATIC_TEST_LINK_LIBS gandiva_static ${ARROW_TEST_LINK_LIBS}) -set(GANDIVA_SHARED_TEST_LINK_LIBS gandiva_shared ${ARROW_TEST_LINK_LIBS} LLVM::LLVM_LIBS) +set(GANDIVA_STATIC_TEST_LINK_LIBS gandiva_static arrow_testing_static) +set(GANDIVA_SHARED_TEST_LINK_LIBS gandiva_shared arrow_testing_shared LLVM::LLVM_LIBS) if(ARROW_WITH_UTF8PROC) list(APPEND GANDIVA_SHARED_TEST_LINK_LIBS utf8proc::utf8proc) list(APPEND GANDIVA_STATIC_TEST_LINK_LIBS utf8proc::utf8proc) endif() if(WIN32) - list(APPEND GANDIVA_STATIC_TEST_LINK_LIBS ${GANDIVA_OPENSSL_TARGETS}) - list(APPEND GANDIVA_SHARED_TEST_LINK_LIBS ${GANDIVA_OPENSSL_TARGETS}) + list(APPEND GANDIVA_STATIC_TEST_LINK_LIBS ${GANDIVA_OPENSSL_LIBS}) + list(APPEND GANDIVA_SHARED_TEST_LINK_LIBS ${GANDIVA_OPENSSL_LIBS}) endif() +list(APPEND GANDIVA_STATIC_TEST_LINK_LIBS ${ARROW_GTEST_GMOCK} ${ARROW_GTEST_GTEST_MAIN}) +list(APPEND GANDIVA_SHARED_TEST_LINK_LIBS ${ARROW_GTEST_GMOCK} ${ARROW_GTEST_GTEST_MAIN}) function(ADD_GANDIVA_TEST REL_TEST_NAME) set(options USE_STATIC_LINKING) @@ -265,7 +267,9 @@ add_gandiva_test(internals-test hash_utils_test.cc gdv_function_stubs_test.cc interval_holder_test.cc - tests/test_util.cc) + tests/test_util.cc + EXTRA_LINK_LIBS + re2::re2) add_subdirectory(precompiled) add_subdirectory(tests) diff --git a/cpp/src/gandiva/precompiled/CMakeLists.txt b/cpp/src/gandiva/precompiled/CMakeLists.txt index e62a8e3d4a375..c092ff4fd011f 100644 --- a/cpp/src/gandiva/precompiled/CMakeLists.txt +++ b/cpp/src/gandiva/precompiled/CMakeLists.txt @@ -77,7 +77,8 @@ if(ARROW_BUILD_TESTS) ../decimal_type_util.cc ../decimal_xlarge.cc) target_include_directories(gandiva-precompiled-test PRIVATE ${CMAKE_SOURCE_DIR}/src) - target_link_libraries(gandiva-precompiled-test PRIVATE ${ARROW_TEST_LINK_LIBS}) + target_link_libraries(gandiva-precompiled-test PRIVATE ${ARROW_TEST_LINK_LIBS} + Boost::headers) target_compile_definitions(gandiva-precompiled-test PRIVATE GANDIVA_UNIT_TEST=1 ARROW_STATIC GANDIVA_STATIC) set(TEST_PATH "${EXECUTABLE_OUTPUT_PATH}/gandiva-precompiled-test") diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt index 9fed75704b64c..8be5a88c33c55 100644 --- a/cpp/src/parquet/CMakeLists.txt +++ b/cpp/src/parquet/CMakeLists.txt @@ -118,7 +118,7 @@ endfunction() # TODO(wesm): Handling of ABI/SO version if(ARROW_BUILD_STATIC) - set(PARQUET_STATIC_LINK_LIBS arrow_static ${ARROW_STATIC_LINK_LIBS}) + set(PARQUET_STATIC_LINK_LIBS arrow_static) set(PARQUET_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static) else() set(PARQUET_STATIC_INSTALL_INTERFACE_LIBS) @@ -227,7 +227,11 @@ if(ARROW_HAVE_RUNTIME_AVX2) endif() endif() +set(PARQUET_SHARED_LINK_LIBS) +set(PARQUET_SHARED_PRIVATE_LINK_LIBS) + if(PARQUET_REQUIRE_ENCRYPTION) + list(APPEND PARQUET_SHARED_PRIVATE_LINK_LIBS ${ARROW_OPENSSL_LIBS}) set(PARQUET_SRCS ${PARQUET_SRCS} encryption/encryption_internal.cc encryption/openssl_internal.cc) # Encryption key management @@ -248,11 +252,11 @@ else() endif() if(NOT PARQUET_MINIMAL_DEPENDENCY) - set(PARQUET_SHARED_LINK_LIBS arrow_shared) + list(APPEND PARQUET_SHARED_LINK_LIBS arrow_shared) # These are libraries that we will link privately with parquet_shared (as they # do not need to be linked transitively by other linkers) - set(PARQUET_SHARED_PRIVATE_LINK_LIBS thrift::thrift) + list(APPEND PARQUET_SHARED_PRIVATE_LINK_LIBS thrift::thrift) # Link publicly with parquet_static (because internal users need to # transitively link all dependencies) @@ -261,6 +265,9 @@ if(NOT PARQUET_MINIMAL_DEPENDENCY) list(APPEND PARQUET_STATIC_INSTALL_INTERFACE_LIBS thrift::thrift) endif() endif() +if(ARROW_WITH_OPENTELEMETRY) + list(APPEND PARQUET_SHARED_PRIVATE_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS}) +endif() if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT) set(PARQUET_SHARED_LINK_FLAGS @@ -300,6 +307,15 @@ if(WIN32 AND NOT (ARROW_TEST_LINKAGE STREQUAL "static")) list(APPEND PARQUET_LIBRARIES parquet_test_support) endif() +if(ARROW_TESTING) + add_library(parquet_testing OBJECT test_util.cc) + # Even though this is still just an object library we still need to + # "link" our dependencies so that include paths are configured + # correctly + target_link_libraries(parquet_testing PUBLIC ${ARROW_GTEST_GMOCK}) + list(APPEND PARQUET_TEST_LINK_LIBS parquet_testing) +endif() + if(NOT ARROW_BUILD_SHARED) set(PARQUET_BENCHMARK_LINK_OPTION STATIC_LINK_LIBS parquet_static ${PARQUET_TEST_LINK_LIBS} benchmark::benchmark_main) @@ -354,8 +370,7 @@ add_parquet_test(internals-test metadata_test.cc page_index_test.cc public_api_test.cc - types_test.cc - test_util.cc) + types_test.cc) set_source_files_properties(public_api_test.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON SKIP_UNITY_BUILD_INCLUSION ON) @@ -366,28 +381,22 @@ add_parquet_test(reader-test level_conversion_test.cc column_scanner_test.cc reader_test.cc - stream_reader_test.cc - test_util.cc) + stream_reader_test.cc) add_parquet_test(writer-test SOURCES column_writer_test.cc file_serialize_test.cc - stream_writer_test.cc - test_util.cc) + stream_writer_test.cc) add_parquet_test(arrow-test SOURCES arrow/arrow_reader_writer_test.cc arrow/arrow_schema_test.cc - arrow/arrow_statistics_test.cc - test_util.cc) + arrow/arrow_statistics_test.cc) -add_parquet_test(arrow-internals-test - SOURCES - arrow/path_internal_test.cc - arrow/reconstruct_internal_test.cc - test_util.cc) +add_parquet_test(arrow-internals-test SOURCES arrow/path_internal_test.cc + arrow/reconstruct_internal_test.cc) if(PARQUET_REQUIRE_ENCRYPTION) add_parquet_test(encryption-test @@ -395,8 +404,7 @@ if(PARQUET_REQUIRE_ENCRYPTION) encryption/write_configurations_test.cc encryption/read_configurations_test.cc encryption/properties_test.cc - encryption/test_encryption_util.cc - test_util.cc) + encryption/test_encryption_util.cc) add_parquet_test(encryption-key-management-test SOURCES encryption/key_management_test.cc @@ -404,13 +412,12 @@ if(PARQUET_REQUIRE_ENCRYPTION) encryption/key_wrapping_test.cc encryption/test_encryption_util.cc encryption/test_in_memory_kms.cc - encryption/two_level_cache_with_expiration_test.cc - test_util.cc) + encryption/two_level_cache_with_expiration_test.cc) endif() # Those tests need to use static linking as they access thrift-generated # symbols which are not exported by parquet.dll on Windows (PARQUET-1420). -add_parquet_test(file_deserialize_test SOURCES file_deserialize_test.cc test_util.cc) +add_parquet_test(file_deserialize_test SOURCES file_deserialize_test.cc) add_parquet_test(schema_test) add_parquet_benchmark(bloom_filter_benchmark SOURCES bloom_filter_benchmark.cc diff --git a/cpp/src/skyhook/CMakeLists.txt b/cpp/src/skyhook/CMakeLists.txt index 67fddec135f99..1b41e340ebd12 100644 --- a/cpp/src/skyhook/CMakeLists.txt +++ b/cpp/src/skyhook/CMakeLists.txt @@ -43,8 +43,11 @@ add_arrow_lib(arrow_skyhook ARROW_SKYHOOK_CLIENT_LIBRARIES SHARED_LINK_LIBS ${ARROW_SKYHOOK_LINK_SHARED} + SHARED_PRIVATE_LINK_LIBS + arrow::flatbuffers STATIC_LINK_LIBS - ${ARROW_SKYHOOK_LINK_STATIC}) + ${ARROW_SKYHOOK_LINK_STATIC} + arrow::flatbuffers) # define the cls library add_arrow_lib(cls_skyhook @@ -54,6 +57,8 @@ add_arrow_lib(cls_skyhook ARROW_SKYHOOK_CLS_LIBRARIES SHARED_LINK_LIBS ${ARROW_SKYHOOK_LINK_SHARED} + SHARED_PRIVATE_LINK_LIBS + arrow::flatbuffers STATIC_LINK_LIBS ${ARROW_SKYHOOK_LINK_STATIC})