From 6ac50a97caf45580c25bb41b30df5d6b439f86dd Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 28 Jan 2024 17:07:20 +0900 Subject: [PATCH] GH-39823: [C++] Allow building cpp/src/arrow/**/*.cc without waiting bundled libraries --- cpp/CMakeLists.txt | 80 +-- cpp/cmake_modules/FindRapidJSONAlt.cmake | 16 +- cpp/cmake_modules/ThirdpartyToolchain.cmake | 67 +- cpp/examples/arrow/CMakeLists.txt | 7 +- .../stream_reader_writer.cc | 1 + cpp/src/arrow/CMakeLists.txt | 644 +++++++++++------- cpp/src/arrow/acero/CMakeLists.txt | 101 ++- cpp/src/arrow/adapters/orc/CMakeLists.txt | 2 + cpp/src/arrow/compute/CMakeLists.txt | 4 +- cpp/src/arrow/compute/kernels/CMakeLists.txt | 9 +- cpp/src/arrow/dataset/CMakeLists.txt | 23 +- cpp/src/arrow/dataset/file_csv_test.cc | 1 + cpp/src/arrow/filesystem/CMakeLists.txt | 4 + cpp/src/arrow/flight/CMakeLists.txt | 4 +- cpp/src/arrow/io/CMakeLists.txt | 1 + cpp/src/arrow/ipc/CMakeLists.txt | 9 +- cpp/src/arrow/ipc/feather_test.cc | 1 + cpp/src/arrow/ipc/read_write_benchmark.cc | 1 + cpp/src/arrow/util/CMakeLists.txt | 24 +- cpp/src/arrow/util/compression.cc | 1 + cpp/src/arrow/util/compression_benchmark.cc | 1 + cpp/src/arrow/util/compression_test.cc | 3 +- cpp/src/arrow/util/config.h.cmake | 7 + cpp/src/gandiva/CMakeLists.txt | 21 +- cpp/src/gandiva/precompiled/CMakeLists.txt | 3 +- cpp/src/parquet/CMakeLists.txt | 35 +- cpp/src/parquet/column_io_benchmark.cc | 1 + cpp/src/parquet/column_writer_test.cc | 1 + cpp/src/parquet/file_deserialize_test.cc | 1 + cpp/src/parquet/file_serialize_test.cc | 1 + cpp/src/parquet/reader_test.cc | 1 + 31 files changed, 624 insertions(+), 451 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 016cd8a1b9ec8..2018ba5e1cea5 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -686,13 +686,9 @@ endif() # # 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_LINK_LIBS) set(ARROW_SHARED_INSTALL_INTERFACE_LIBS) -set(ARROW_STATIC_LINK_LIBS arrow::flatbuffers arrow::hadoop) +set(ARROW_STATIC_LINK_LIBS arrow::flatbuffers) set(ARROW_STATIC_INSTALL_INTERFACE_LIBS) # We must use google-cloud-cpp::storage first. If @@ -705,73 +701,53 @@ set(ARROW_STATIC_INSTALL_INTERFACE_LIBS) # /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 ${ARROW_PROTOBUF_LIBPROTOBUF}) @@ -779,7 +755,6 @@ if(ARROW_ORC) 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) @@ -788,8 +763,6 @@ if(ARROW_USE_GLOG) 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 @@ -806,22 +779,8 @@ if(ARROW_S3) 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) + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_OPENTELEMETRY_LIBS}) endif() if(Protobuf_SOURCE STREQUAL "SYSTEM") list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${ARROW_PROTOBUF_LIBPROTOBUF}) @@ -829,13 +788,7 @@ if(ARROW_WITH_OPENTELEMETRY) 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) @@ -843,33 +796,16 @@ if(ARROW_WITH_UTF8PROC) 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::rapidjson) - list(APPEND ARROW_STATIC_LINK_LIBS rapidjson::rapidjson) -endif() - -if(ARROW_USE_XSIMD) - list(APPEND ARROW_SHARED_LINK_LIBS ${ARROW_XSIMD}) - list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_XSIMD}) -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) @@ -895,8 +831,7 @@ endif() if(ARROW_BUILD_BENCHMARKS) # Some benchmarks use gtest - add_dependencies(arrow_benchmark_dependencies arrow_test_dependencies - toolchain-benchmarks) + add_dependencies(arrow_benchmark_dependencies arrow_test_dependencies) endif() set(ARROW_TEST_STATIC_LINK_LIBS arrow_testing_static arrow_static @@ -942,15 +877,8 @@ if(ARROW_BUILD_BENCHMARKS) 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) add_definitions(-DARROW_MIMALLOC) - list(APPEND ARROW_SHARED_LINK_LIBS mimalloc::mimalloc) - list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) endif() # ---------------------------------------------------------------------- diff --git a/cpp/cmake_modules/FindRapidJSONAlt.cmake b/cpp/cmake_modules/FindRapidJSONAlt.cmake index ef5acf18b8223..1c2508dc2393a 100644 --- a/cpp/cmake_modules/FindRapidJSONAlt.cmake +++ b/cpp/cmake_modules/FindRapidJSONAlt.cmake @@ -29,7 +29,10 @@ endif() find_package(RapidJSON ${find_package_args}) if(RapidJSON_FOUND) set(RapidJSONAlt_FOUND TRUE) - set(RAPIDJSON_INCLUDE_DIR ${RAPIDJSON_INCLUDE_DIRS}) + if(NOT TARGET RapidJSON) + add_library(RapidJSON INTERFACE IMPORTED) + target_include_directories(RapidJSON INTERFACE "${RAPIDJSON_INCLUDE_DIRS}") + endif() return() endif() @@ -74,3 +77,14 @@ find_package_handle_standard_args( RapidJSONAlt REQUIRED_VARS RAPIDJSON_INCLUDE_DIR VERSION_VAR RAPIDJSON_VERSION) + +if(RapidJSONAlt_FOUND) + if(WIN32 AND "${RAPIDJSON_INCLUDE_DIR}" MATCHES "^/") + # MSYS2 + execute_process(COMMAND "cygpath" "--windows" "${RAPIDJSON_INCLUDE_DIR}" + OUTPUT_VARIABLE RAPIDJSON_INCLUDE_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + add_library(RapidJSON INTERFACE IMPORTED) + target_include_directories(RapidJSON INTERFACE "${RAPIDJSON_INCLUDE_DIR}") +endif() diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 6bb9c0f6af2ca..a1ac47228a7f9 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -18,11 +18,6 @@ include(ProcessorCount) processorcount(NPROC) -add_custom_target(rapidjson) -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, @@ -1150,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() @@ -1364,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}) @@ -1415,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) @@ -1451,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) @@ -1471,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) @@ -1522,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) @@ -1581,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) @@ -1694,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) @@ -1791,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) @@ -2133,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) @@ -2292,7 +2281,6 @@ macro(build_benchmark) target_include_directories(benchmark::benchmark_main BEFORE INTERFACE "${GBENCHMARK_INCLUDE_DIR}") - add_dependencies(toolchain-benchmarks gbenchmark_ep) add_dependencies(benchmark::benchmark gbenchmark_ep) add_dependencies(benchmark::benchmark_main gbenchmark_ep) endmacro() @@ -2328,9 +2316,9 @@ macro(build_rapidjson) # The include directory must exist before it is referenced by a target. file(MAKE_DIRECTORY "${RAPIDJSON_INCLUDE_DIR}") - add_dependencies(toolchain rapidjson_ep) - add_dependencies(toolchain-tests rapidjson_ep) - add_dependencies(rapidjson rapidjson_ep) + add_library(RapidJSON INTERFACE IMPORTED) + target_include_directories(RapidJSON INTERFACE "${RAPIDJSON_INCLUDE_DIR}") + add_dependencies(RapidJSON rapidjson_ep) set(RAPIDJSON_VENDORED TRUE) endmacro() @@ -2344,19 +2332,6 @@ if(ARROW_WITH_RAPIDJSON) ${ARROW_RAPIDJSON_REQUIRED_VERSION} IS_RUNTIME_DEPENDENCY FALSE) - - if(RapidJSON_INCLUDE_DIR) - set(RAPIDJSON_INCLUDE_DIR "${RapidJSON_INCLUDE_DIR}") - endif() - if(WIN32 AND "${RAPIDJSON_INCLUDE_DIR}" MATCHES "^/") - # MSYS2 - execute_process(COMMAND "cygpath" "--windows" "${RAPIDJSON_INCLUDE_DIR}" - OUTPUT_VARIABLE RAPIDJSON_INCLUDE_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - - add_library(rapidjson::rapidjson INTERFACE IMPORTED) - target_include_directories(rapidjson::rapidjson INTERFACE "${RAPIDJSON_INCLUDE_DIR}") endif() macro(build_xsimd) @@ -2375,8 +2350,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() @@ -2398,8 +2374,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}") @@ -2437,7 +2411,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) @@ -2473,7 +2446,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) @@ -2526,7 +2498,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) @@ -2583,7 +2554,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 @@ -2647,7 +2617,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) @@ -2700,7 +2669,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) @@ -2738,7 +2706,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}") @@ -3983,7 +3950,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) @@ -4233,8 +4199,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 @@ -4455,7 +4419,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) @@ -4463,6 +4426,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() @@ -4622,9 +4586,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 @@ -4666,6 +4627,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}") @@ -5001,7 +4965,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) @@ -5030,6 +4993,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 @@ -5203,7 +5169,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..079a52cb5b056 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) @@ -106,6 +108,9 @@ if(ARROW_FLIGHT) gRPC::grpc++ ${GRPC_REFLECTION_LINK_LIBS} ${ARROW_PROTOBUF_LIBPROTOBUF} + # Protobuf generated files may use ABSL_DCHECK*() and + # absl::log_internal_check_op is needed for them. + absl::log_internal_check_op ${GFLAGS_LIBRARIES} EXTRA_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/helloworld.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 c1fafeebc035d..e4e1e19830559 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -26,6 +26,43 @@ add_dependencies(arrow-all arrow-benchmarks arrow-integration) +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 +156,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 +191,6 @@ set(ARROW_SRCS datum.cc device.cc extension_type.cc - memory_pool.cc pretty_print.cc record_batch.cc result.cc @@ -192,18 +207,106 @@ 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) +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,97 +352,92 @@ 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) + util/value_parsing.cc) +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() -append_runtime_avx2_src(util/bpacking_avx2.cc) -append_runtime_avx512_src(util/bpacking_avx512.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) - add_definitions(-DARROW_WITH_BROTLI) - list(APPEND ARROW_SRCS util/compression_brotli.cc) + list(APPEND ARROW_UTIL_SRCS util/compression_brotli.cc) endif() - if(ARROW_WITH_BZ2) - add_definitions(-DARROW_WITH_BZ2) - list(APPEND ARROW_SRCS util/compression_bz2.cc) + list(APPEND ARROW_UTIL_SRCS util/compression_bz2.cc) endif() - if(ARROW_WITH_LZ4) - add_definitions(-DARROW_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) - add_definitions(-DARROW_WITH_SNAPPY) - list(APPEND ARROW_SRCS util/compression_snappy.cc) + list(APPEND ARROW_UTIL_SRCS util/compression_snappy.cc) endif() - if(ARROW_WITH_ZLIB) - add_definitions(-DARROW_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) - add_definitions(-DARROW_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::rapidjson arrow_shared +set(ARROW_TESTING_SHARED_LINK_LIBS arrow::flatbuffers RapidJSON arrow_shared ${ARROW_GTEST_GTEST}) -set(ARROW_TESTING_STATIC_LINK_LIBS arrow::flatbuffers rapidjson::rapidjson arrow_static +set(ARROW_TESTING_STATIC_LINK_LIBS arrow::flatbuffers RapidJSON arrow_static ${ARROW_GTEST_GTEST}) set(ARROW_TESTING_SRCS @@ -350,115 +448,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 @@ -488,53 +563,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() -if(ARROW_FILESYSTEM) - if(ARROW_HDFS) - add_definitions(-DARROW_HDFS) - 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() - list(APPEND - ARROW_SRCS - filesystem/filesystem.cc - filesystem/localfs.cc - filesystem/mockfs.cc - filesystem/path_util.cc - filesystem/util_internal.cc) +if(ARROW_FILESYSTEM) + 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 @@ -542,32 +665,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) @@ -576,8 +718,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() @@ -653,7 +793,7 @@ add_arrow_lib(arrow PKG_CONFIG_NAME arrow SOURCES - ${ARROW_ALL_SRCS} + ${ARROW_SRCS} OUTPUTS ARROW_LIBRARIES PRECOMPILED_HEADERS @@ -665,8 +805,32 @@ add_arrow_lib(arrow SHARED_LINK_LIBS ${ARROW_SHARED_LINK_LIBS} SHARED_PRIVATE_LINK_LIBS + ${ARROW_ARRAY_TARGET_SHARED} + ${ARROW_COMPUTE_TARGET_SHARED} + ${ARROW_CSV_TARGET_SHARED} + ${ARROW_JSON_TARGET_SHARED} + ${ARROW_IPC_TARGET_SHARED} + ${ARROW_IO_TARGET_SHARED} + ${ARROW_MEMORY_POOL_TARGET_SHARED} + ${ARROW_FILESYSTEM_TARGET_SHARED} + ${ARROW_ORC_TARGET_SHARED} + ${ARROW_INTEGRATION_TARGET_SHARED} + ${ARROW_UTIL_TARGET_SHARED} + ${ARROW_VENDORED_TARGET_SHARED} ${ARROW_SHARED_PRIVATE_LINK_LIBS} STATIC_LINK_LIBS + ${ARROW_ARRAY_TARGET_STATIC} + ${ARROW_COMPUTE_TARGET_STATIC} + ${ARROW_CSV_TARGET_STATIC} + ${ARROW_JSON_TARGET_STATIC} + ${ARROW_IPC_TARGET_STATIC} + ${ARROW_IO_TARGET_STATIC} + ${ARROW_MEMORY_POOL_TARGET_STATIC} + ${ARROW_FILESYSTEM_TARGET_STATIC} + ${ARROW_INTEGRATION_TARGET_STATIC} + ${ARROW_ORC_TARGET_STATIC} + ${ARROW_UTIL_TARGET_STATIC} + ${ARROW_VENDORED_TARGET_STATIC} ${ARROW_STATIC_LINK_LIBS} STATIC_INSTALL_INTERFACE_LIBS ${ARROW_STATIC_INSTALL_INTERFACE_LIBS} diff --git a/cpp/src/arrow/acero/CMakeLists.txt b/cpp/src/arrow/acero/CMakeLists.txt index b77d52a23eedb..25fac48f2131d 100644 --- a/cpp/src/arrow/acero/CMakeLists.txt +++ b/cpp/src/arrow/acero/CMakeLists.txt @@ -62,21 +62,14 @@ 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) @@ -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 @@ -133,7 +126,7 @@ endif() function(add_arrow_acero_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}" @@ -146,6 +139,12 @@ function(add_arrow_acero_test REL_TEST_NAME) set(PREFIX "arrow-acero") endif() + if(ARG_EXTRA_LINK_LIBS) + set(EXTRA_LINK_LIBS ${ARG_EXTRA_LINK_LIBS}) + else() + set(EXTRA_LINK_LIBS ${ARROW_ACERO_TEST_LINK_LIBS}) + endif() + if(ARG_LABELS) set(LABELS ${ARG_LABELS}) else() @@ -154,7 +153,7 @@ function(add_arrow_acero_test REL_TEST_NAME) add_arrow_test(${REL_TEST_NAME} EXTRA_LINK_LIBS - ${ARROW_ACERO_TEST_LINK_LIBS} + ${EXTRA_LINK_LIBS} PREFIX ${PREFIX} LABELS @@ -162,33 +161,83 @@ function(add_arrow_acero_test REL_TEST_NAME) ${ARG_UNPARSED_ARGUMENTS}) endfunction() +if(ARROW_TESTING) + add_library(arrow_acero_test_nodes OBJECT test_nodes.cc) + target_link_libraries(arrow_acero_test_nodes PRIVATE ${ARROW_ACERO_TEST_LINK_LIBS}) + if(ARROW_WITH_OPENTELEMETRY) + target_link_libraries(arrow_acero_test_nodes PRIVATE ${ARROW_OPENTELEMETRY_LIBS}) + endif() +endif() 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(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) + EXTRA_LINK_LIBS + ${ARROW_ACERO_TEST_LINK_LIBS} + arrow_acero_test_nodes) +add_arrow_acero_test(source_node_test + SOURCES + source_node_test.cc + EXTRA_LINK_LIBS + ${ARROW_ACERO_TEST_LINK_LIBS} + arrow_acero_test_nodes) +add_arrow_acero_test(fetch_node_test + SOURCES + fetch_node_test.cc + EXTRA_LINK_LIBS + ${ARROW_ACERO_TEST_LINK_LIBS} + arrow_acero_test_nodes) +add_arrow_acero_test(order_by_node_test + SOURCES + order_by_node_test.cc + EXTRA_LINK_LIBS + ${ARROW_ACERO_TEST_LINK_LIBS} + arrow_acero_test_nodes) +add_arrow_acero_test(hash_join_node_test + SOURCES + hash_join_node_test.cc + bloom_filter_test.cc + EXTRA_LINK_LIBS + ${ARROW_ACERO_TEST_LINK_LIBS} + arrow_acero_test_nodes) +add_arrow_acero_test(pivot_longer_node_test + SOURCES + pivot_longer_node_test.cc + EXTRA_LINK_LIBS + ${ARROW_ACERO_TEST_LINK_LIBS} + arrow_acero_test_nodes) # 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 + EXTRA_LINK_LIBS + ${ARROW_ACERO_TEST_LINK_LIBS} + arrow_acero_test_nodes) + add_arrow_acero_test(sorted_merge_node_test + SOURCES + sorted_merge_node_test.cc + EXTRA_LINK_LIBS + ${ARROW_ACERO_TEST_LINK_LIBS} + arrow_acero_test_nodes) endif() add_arrow_acero_test(tpch_node_test SOURCES tpch_node_test.cc) add_arrow_acero_test(union_node_test SOURCES union_node_test.cc) add_arrow_acero_test(aggregate_node_test SOURCES aggregate_node_test.cc) add_arrow_acero_test(util_test SOURCES util_test.cc task_util_test.cc) -add_arrow_acero_test(hash_aggregate_test SOURCES hash_aggregate_test.cc) +set(ARROW_ACERO_HASH_AGGREGATE_TEST_LINK_LIBS ${ARROW_ACERO_TEST_LINK_LIBS}) +if(ARROW_USE_BOOST) + list(APPEND ARROW_ACERO_HASH_AGGREGATE_TEST_LINK_LIBS Boost::headers) +endif() +add_arrow_acero_test(hash_aggregate_test + SOURCES + hash_aggregate_test.cc + EXTRA_LINK_LIBS + ${ARROW_ACERO_HASH_AGGREGATE_TEST_LINK_LIBS}) if(ARROW_BUILD_BENCHMARKS) function(add_arrow_acero_benchmark REL_BENCHMARK_NAME) diff --git a/cpp/src/arrow/adapters/orc/CMakeLists.txt b/cpp/src/arrow/adapters/orc/CMakeLists.txt index 4d66151cd38c9..4bf1d36268845 100644 --- a/cpp/src/arrow/adapters/orc/CMakeLists.txt +++ b/cpp/src/arrow/adapters/orc/CMakeLists.txt @@ -35,6 +35,8 @@ add_arrow_test(adapter_test PREFIX "arrow-orc" STATIC_LINK_LIBS + orc::orc + ${ARROW_PROTOBUF_LIBPROTOBUF} ${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..98cb2f2ae867b 100644 --- a/cpp/src/arrow/compute/kernels/CMakeLists.txt +++ b/cpp/src/arrow/compute/kernels/CMakeLists.txt @@ -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/dataset/CMakeLists.txt b/cpp/src/arrow/dataset/CMakeLists.txt index 1afef3e3b0463..49b951a389d18 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) @@ -68,6 +69,11 @@ list(APPEND ARROW_DATASET_SHARED_INSTALL_INTERFACE_LIBS ArrowAcero::arrow_acero_ list(APPEND ARROW_DATASET_STATIC_LINK_LIBS arrow_acero_static ${ARROW_STATIC_LINK_LIBS}) 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 @@ -169,7 +181,8 @@ if(ARROW_JSON) 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 a42a8d0f8c1b6..3fed25cae5d5e 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) @@ -102,6 +105,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/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt index 91e0fbf9136d3..10254bfe02731 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() 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..78f30b8075656 100644 --- a/cpp/src/arrow/ipc/CMakeLists.txt +++ b/cpp/src/arrow/ipc/CMakeLists.txt @@ -18,8 +18,6 @@ # # Messaging and interprocess communication -add_custom_target(arrow_ipc) - function(ADD_ARROW_IPC_TEST REL_TEST_NAME) set(options) set(one_value_args PREFIX) @@ -36,12 +34,7 @@ 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) diff --git a/cpp/src/arrow/ipc/feather_test.cc b/cpp/src/arrow/ipc/feather_test.cc index 80e441fe2b670..ba3f4d828c397 100644 --- a/cpp/src/arrow/ipc/feather_test.cc +++ b/cpp/src/arrow/ipc/feather_test.cc @@ -35,6 +35,7 @@ #include "arrow/type.h" #include "arrow/util/checked_cast.h" #include "arrow/util/compression.h" +#include "arrow/util/config.h" namespace arrow { 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/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/compression.cc b/cpp/src/arrow/util/compression.cc index 5ad17e993f153..b63aec0aae8f9 100644 --- a/cpp/src/arrow/util/compression.cc +++ b/cpp/src/arrow/util/compression.cc @@ -24,6 +24,7 @@ #include "arrow/result.h" #include "arrow/status.h" #include "arrow/util/compression_internal.h" +#include "arrow/util/config.h" #include "arrow/util/logging.h" namespace arrow { diff --git a/cpp/src/arrow/util/compression_benchmark.cc b/cpp/src/arrow/util/compression_benchmark.cc index cc04eb4634851..0b9727cff9041 100644 --- a/cpp/src/arrow/util/compression_benchmark.cc +++ b/cpp/src/arrow/util/compression_benchmark.cc @@ -27,6 +27,7 @@ #include "arrow/result.h" #include "arrow/util/compression.h" +#include "arrow/util/config.h" #include "arrow/util/logging.h" #include "arrow/util/macros.h" diff --git a/cpp/src/arrow/util/compression_test.cc b/cpp/src/arrow/util/compression_test.cc index eeeedce17764f..eb2da98d5110d 100644 --- a/cpp/src/arrow/util/compression_test.cc +++ b/cpp/src/arrow/util/compression_test.cc @@ -30,6 +30,7 @@ #include "arrow/testing/gtest_util.h" #include "arrow/testing/util.h" #include "arrow/util/compression.h" +#include "arrow/util/config.h" namespace arrow { namespace util { @@ -729,7 +730,7 @@ INSTANTIATE_TEST_SUITE_P(TestLZ4Frame, CodecTest, INSTANTIATE_TEST_SUITE_P(TestBrotli, CodecTest, ::testing::Values(Compression::BROTLI)); #endif -#if ARROW_WITH_BZ2 +#ifdef ARROW_WITH_BZ2 INSTANTIATE_TEST_SUITE_P(TestBZ2, CodecTest, ::testing::Values(Compression::BZ2)); #endif diff --git a/cpp/src/arrow/util/config.h.cmake b/cpp/src/arrow/util/config.h.cmake index 6c8c31ffb856f..2de8691c5452d 100644 --- a/cpp/src/arrow/util/config.h.cmake +++ b/cpp/src/arrow/util/config.h.cmake @@ -53,9 +53,16 @@ #cmakedefine ARROW_ENABLE_THREADING #cmakedefine ARROW_GCS +#cmakedefine ARROW_HDFS #cmakedefine ARROW_S3 #cmakedefine ARROW_USE_NATIVE_INT128 +#cmakedefine ARROW_WITH_BROTLI +#cmakedefine ARROW_WITH_BZ2 +#cmakedefine ARROW_WITH_LZ4 #cmakedefine ARROW_WITH_MUSL #cmakedefine ARROW_WITH_OPENTELEMETRY +#cmakedefine ARROW_WITH_SNAPPY #cmakedefine ARROW_WITH_UCX +#cmakedefine ARROW_WITH_ZLIB +#cmakedefine ARROW_WITH_ZSTD #cmakedefine PARQUET_REQUIRE_ENCRYPTION diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt index 3f038f54a7b27..ad00e40598a76 100644 --- a/cpp/src/gandiva/CMakeLists.txt +++ b/cpp/src/gandiva/CMakeLists.txt @@ -92,20 +92,25 @@ 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 re2::re2 ${GANDIVA_OPENSSL_LIBS} Boost::headers) set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_HEADERS LLVM::LLVM_LIBS - ${GANDIVA_OPENSSL_TARGETS} + re2::re2 + ${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) @@ -185,8 +190,8 @@ if(ARROW_WITH_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() function(ADD_GANDIVA_TEST REL_TEST_NAME) @@ -255,7 +260,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 04028431ba157..93f32455a7cb8 100644 --- a/cpp/src/parquet/CMakeLists.txt +++ b/cpp/src/parquet/CMakeLists.txt @@ -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 @@ -422,27 +429,3 @@ add_parquet_benchmark(level_conversion_benchmark) add_parquet_benchmark(page_index_benchmark SOURCES page_index_benchmark.cc benchmark_util.cc) add_parquet_benchmark(arrow/reader_writer_benchmark PREFIX "parquet-arrow") - -if(ARROW_WITH_BROTLI) - add_definitions(-DARROW_WITH_BROTLI) -endif() - -if(ARROW_WITH_BZ2) - add_definitions(-DARROW_WITH_BZ2) -endif() - -if(ARROW_WITH_LZ4) - add_definitions(-DARROW_WITH_LZ4) -endif() - -if(ARROW_WITH_SNAPPY) - add_definitions(-DARROW_WITH_SNAPPY) -endif() - -if(ARROW_WITH_ZLIB) - add_definitions(-DARROW_WITH_ZLIB) -endif() - -if(ARROW_WITH_ZSTD) - add_definitions(-DARROW_WITH_ZSTD) -endif() diff --git a/cpp/src/parquet/column_io_benchmark.cc b/cpp/src/parquet/column_io_benchmark.cc index 48e434a342e72..593765dcd4e0b 100644 --- a/cpp/src/parquet/column_io_benchmark.cc +++ b/cpp/src/parquet/column_io_benchmark.cc @@ -20,6 +20,7 @@ #include "arrow/array.h" #include "arrow/io/memory.h" #include "arrow/testing/random.h" +#include "arrow/util/config.h" #include "parquet/column_reader.h" #include "parquet/column_writer.h" diff --git a/cpp/src/parquet/column_writer_test.cc b/cpp/src/parquet/column_writer_test.cc index 97421629d2ca6..ea7945013f0d1 100644 --- a/cpp/src/parquet/column_writer_test.cc +++ b/cpp/src/parquet/column_writer_test.cc @@ -26,6 +26,7 @@ #include "arrow/testing/gtest_util.h" #include "arrow/util/bit_util.h" #include "arrow/util/bitmap_builders.h" +#include "arrow/util/config.h" #include "parquet/column_page.h" #include "parquet/column_reader.h" diff --git a/cpp/src/parquet/file_deserialize_test.cc b/cpp/src/parquet/file_deserialize_test.cc index 6b3c7062fcc4a..9f2857c8194c7 100644 --- a/cpp/src/parquet/file_deserialize_test.cc +++ b/cpp/src/parquet/file_deserialize_test.cc @@ -37,6 +37,7 @@ #include "arrow/status.h" #include "arrow/testing/gtest_util.h" #include "arrow/util/compression.h" +#include "arrow/util/config.h" #include "arrow/util/crc32.h" namespace parquet { diff --git a/cpp/src/parquet/file_serialize_test.cc b/cpp/src/parquet/file_serialize_test.cc index 62e1965418076..fc356d5d24c1c 100644 --- a/cpp/src/parquet/file_serialize_test.cc +++ b/cpp/src/parquet/file_serialize_test.cc @@ -19,6 +19,7 @@ #include #include "arrow/testing/gtest_compat.h" +#include "arrow/util/config.h" #include "parquet/column_reader.h" #include "parquet/column_writer.h" diff --git a/cpp/src/parquet/reader_test.cc b/cpp/src/parquet/reader_test.cc index 551f62798e3b5..f9c2e06873a22 100644 --- a/cpp/src/parquet/reader_test.cc +++ b/cpp/src/parquet/reader_test.cc @@ -32,6 +32,7 @@ #include "arrow/testing/gtest_util.h" #include "arrow/testing/random.h" #include "arrow/util/checked_cast.h" +#include "arrow/util/config.h" #include "parquet/column_reader.h" #include "parquet/column_scanner.h"