diff --git a/ci/scripts/python_wheel_macos_build.sh b/ci/scripts/python_wheel_macos_build.sh index d580e9a331e88..92494fb4b7632 100755 --- a/ci/scripts/python_wheel_macos_build.sh +++ b/ci/scripts/python_wheel_macos_build.sh @@ -158,7 +158,7 @@ export PYARROW_WITH_S3=${ARROW_S3} export PYARROW_CMAKE_OPTIONS="-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DARROW_SIMD_LEVEL=${ARROW_SIMD_LEVEL}" export ARROW_HOME=${build_dir}/install # PyArrow build configuration -export PKG_CONFIG_PATH=/usr/lib/pkgconfig:${build_dir}/install/lib/pkgconfig +export CMAKE_PREFIX_PATH=${build_dir}/install # Set PyArrow version explicitly export SETUPTOOLS_SCM_PRETEND_VERSION=${PYARROW_VERSION} diff --git a/ci/scripts/python_wheel_manylinux_build.sh b/ci/scripts/python_wheel_manylinux_build.sh index 47721e45e3b82..6fe26134fdb3c 100755 --- a/ci/scripts/python_wheel_manylinux_build.sh +++ b/ci/scripts/python_wheel_manylinux_build.sh @@ -153,7 +153,7 @@ export PYARROW_WITH_SUBSTRAIT=${ARROW_SUBSTRAIT} export PYARROW_WITH_S3=${ARROW_S3} export ARROW_HOME=/tmp/arrow-dist # PyArrow build configuration -export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/tmp/arrow-dist/lib/pkgconfig +export CMAKE_PREFIX_PATH=/tmp/arrow-dist pushd /arrow/python python setup.py bdist_wheel diff --git a/ci/scripts/python_wheel_windows_build.bat b/ci/scripts/python_wheel_windows_build.bat index fb776185a5fda..9c1aa1428de76 100644 --- a/ci/scripts/python_wheel_windows_build.bat +++ b/ci/scripts/python_wheel_windows_build.bat @@ -113,6 +113,7 @@ set PYARROW_WITH_PARQUET_ENCRYPTION=%PARQUET_REQUIRE_ENCRYPTION% set PYARROW_WITH_SUBSTRAIT=%ARROW_SUBSTRAIT% set PYARROW_WITH_S3=%ARROW_S3% set ARROW_HOME=C:\arrow-dist +set CMAKE_PREFIX_PATH=C:\arrow-dist pushd C:\arrow\python @REM bundle the msvc runtime diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index f0c3f30ef3d8d..4c0d8f1e91bc2 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -122,7 +122,7 @@ endif() set(ARROW_GDB_DIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/gdb") set(ARROW_FULL_GDB_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/gdb") set(ARROW_GDB_AUTO_LOAD_DIR "${CMAKE_INSTALL_DATADIR}/gdb/auto-load") -set(ARROW_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +set(ARROW_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake") set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}") set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support") @@ -148,30 +148,6 @@ string(REGEX REPLACE "^CLANG_TOOLS=" "" ARROW_CLANG_TOOLS_VERSION string(REGEX REPLACE "^([0-9]+)(\\..+)?" "\\1" ARROW_CLANG_TOOLS_VERSION_MAJOR "${ARROW_CLANG_TOOLS_VERSION}") -if(APPLE) - find_program(BREW_BIN brew) - if(BREW_BIN) - execute_process(COMMAND ${BREW_BIN} --prefix - "llvm@${ARROW_LLVM_VERSION_PRIMARY_MAJOR}" - OUTPUT_VARIABLE LLVM_BREW_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT LLVM_BREW_PREFIX) - execute_process(COMMAND ${BREW_BIN} --prefix llvm - OUTPUT_VARIABLE LLVM_BREW_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - - execute_process(COMMAND ${BREW_BIN} --prefix "llvm@${ARROW_CLANG_TOOLS_VERSION_MAJOR}" - OUTPUT_VARIABLE CLANG_TOOLS_BREW_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT CLANG_TOOLS_BREW_PREFIX) - execute_process(COMMAND ${BREW_BIN} --prefix llvm - OUTPUT_VARIABLE CLANG_TOOLS_BREW_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - endif() -endif() - if(WIN32 AND NOT MINGW) # This is used to handle builds using e.g. clang in an MSVC setting. set(MSVC_TOOLCHAIN TRUE) @@ -719,18 +695,19 @@ endif() # 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_LINK_LIBS arrow::flatbuffers arrow::hadoop) +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) if(ARROW_USE_BOOST) - list(APPEND ARROW_LINK_LIBS Boost::headers) + 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_LINK_LIBS ${ARROW_OPENSSL_LIBS}) + 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() @@ -738,7 +715,7 @@ endif() if(ARROW_WITH_BROTLI) # Order is important for static linking set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon) - list(APPEND ARROW_LINK_LIBS ${ARROW_BROTLI_LIBS}) + 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}) @@ -781,7 +758,7 @@ if(ARROW_WITH_ZSTD) endif() if(ARROW_ORC) - list(APPEND ARROW_LINK_LIBS orc::liborc ${ARROW_PROTOBUF_LIBPROTOBUF}) + list(APPEND ARROW_SHARED_LINK_LIBS orc::liborc ${ARROW_PROTOBUF_LIBPROTOBUF}) list(APPEND ARROW_STATIC_LINK_LIBS orc::liborc ${ARROW_PROTOBUF_LIBPROTOBUF}) if(ORC_SOURCE STREQUAL "SYSTEM") list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS orc::liborc @@ -790,7 +767,7 @@ if(ARROW_ORC) endif() if(ARROW_GCS) - list(APPEND ARROW_LINK_LIBS google-cloud-cpp::storage) + 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) @@ -798,7 +775,7 @@ if(ARROW_GCS) endif() if(ARROW_USE_GLOG) - list(APPEND ARROW_LINK_LIBS glog::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) @@ -807,13 +784,13 @@ if(ARROW_USE_GLOG) endif() if(ARROW_S3) - list(APPEND ARROW_LINK_LIBS ${AWSSDK_LINK_LIBRARIES}) + list(APPEND ARROW_SHARED_LINK_LIBS ${AWSSDK_LINK_LIBRARIES}) list(APPEND ARROW_STATIC_LINK_LIBS ${AWSSDK_LINK_LIBRARIES}) endif() if(ARROW_WITH_OPENTELEMETRY) list(APPEND - ARROW_LINK_LIBS + ARROW_SHARED_LINK_LIBS opentelemetry-cpp::trace opentelemetry-cpp::ostream_span_exporter opentelemetry-cpp::otlp_http_exporter) @@ -836,7 +813,7 @@ if(ARROW_WITH_OPENTELEMETRY) endif() if(ARROW_WITH_UTF8PROC) - list(APPEND ARROW_LINK_LIBS utf8proc::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) @@ -844,7 +821,7 @@ if(ARROW_WITH_UTF8PROC) endif() if(ARROW_WITH_RE2) - list(APPEND ARROW_LINK_LIBS re2::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) @@ -852,12 +829,12 @@ if(ARROW_WITH_RE2) endif() if(ARROW_WITH_RAPIDJSON) - list(APPEND ARROW_LINK_LIBS rapidjson::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_LINK_LIBS xsimd) + list(APPEND ARROW_SHARED_LINK_LIBS xsimd) list(APPEND ARROW_STATIC_LINK_LIBS xsimd) endif() @@ -884,8 +861,7 @@ endif() set(ARROW_SHARED_PRIVATE_LINK_LIBS ${ARROW_STATIC_LINK_LIBS}) if(NOT MSVC_TOOLCHAIN) - list(APPEND ARROW_LINK_LIBS ${CMAKE_DL_LIBS}) - list(APPEND ARROW_SHARED_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS}) + list(APPEND ARROW_SHARED_LINK_LIBS ${CMAKE_DL_LIBS}) endif() set(ARROW_TEST_LINK_TOOLCHAIN arrow::flatbuffers GTest::gtest_main GTest::gtest @@ -901,11 +877,11 @@ if(ARROW_BUILD_BENCHMARKS) toolchain-benchmarks) endif() -set(ARROW_TEST_STATIC_LINK_LIBS arrow_testing_static arrow_static ${ARROW_LINK_LIBS} - ${ARROW_TEST_LINK_TOOLCHAIN}) +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_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) set(ARROW_TEST_SHARED_LINK_LIBS ${ARROW_TEST_SHARED_LINK_LIBS} ${CMAKE_DL_LIBS}) @@ -945,13 +921,13 @@ if(ARROW_BUILD_BENCHMARKS) endif() if(ARROW_JEMALLOC) - list(APPEND ARROW_LINK_LIBS jemalloc) + list(APPEND ARROW_SHARED_LINK_LIBS jemalloc) list(APPEND ARROW_STATIC_LINK_LIBS jemalloc) endif() if(ARROW_MIMALLOC) add_definitions(-DARROW_MIMALLOC) - list(APPEND ARROW_LINK_LIBS mimalloc::mimalloc) + list(APPEND ARROW_SHARED_LINK_LIBS mimalloc::mimalloc) list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) endif() @@ -975,7 +951,7 @@ if(NOT WIN32 AND NOT APPLE) list(APPEND ARROW_SYSTEM_LINK_LIBS rt) endif() -list(APPEND ARROW_LINK_LIBS ${ARROW_SYSTEM_LINK_LIBS}) +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}) diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index a6adf58718ad5..250aadeb33174 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -73,7 +73,7 @@ endfunction() # Based on MIT-licensed # https://gist.github.com/cristianadam/ef920342939a89fae3e8a85ca9459b49 -function(create_merged_static_lib output_target) +function(arrow_create_merged_static_lib output_target) set(options) set(one_value_args NAME ROOT) set(multi_value_args TO_MERGE) @@ -136,17 +136,37 @@ function(create_merged_static_lib output_target) message(FATAL_ERROR "Unknown bundle scenario!") endif() - add_custom_command(COMMAND ${BUNDLE_COMMAND} - OUTPUT ${output_lib_path} - COMMENT "Bundling ${output_lib_path}" - VERBATIM) + add_custom_target(${output_target}_merge ALL + ${BUNDLE_COMMAND} + DEPENDS ${ARG_ROOT} ${ARG_TO_MERGE} + BYPRODUCTS ${output_lib_path} + COMMENT "Bundling ${output_lib_path}" + VERBATIM) message(STATUS "Creating bundled static library target ${output_target} at ${output_lib_path}" ) - add_custom_target(${output_target} ALL DEPENDS ${output_lib_path}) - add_dependencies(${output_target} ${ARG_ROOT} ${ARG_TO_MERGE}) - install(FILES ${output_lib_path} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + add_library(${output_target} STATIC IMPORTED) + set_target_properties(${output_target} PROPERTIES IMPORTED_LOCATION ${output_lib_path}) + add_dependencies(${output_target} ${output_target}_merge) +endfunction() + +function(arrow_install_cmake_package PACKAGE_NAME EXPORT_NAME) + set(CONFIG_CMAKE "${PACKAGE_NAME}Config.cmake") + set(BUILT_CONFIG_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_CMAKE}") + configure_package_config_file("${CONFIG_CMAKE}.in" "${BUILT_CONFIG_CMAKE}" + INSTALL_DESTINATION "${ARROW_CMAKE_DIR}/${PACKAGE_NAME}") + set(CONFIG_VERSION_CMAKE "${PACKAGE_NAME}ConfigVersion.cmake") + set(BUILT_CONFIG_VERSION_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_VERSION_CMAKE}") + write_basic_package_version_file("${BUILT_CONFIG_VERSION_CMAKE}" + COMPATIBILITY SameMajorVersion) + install(FILES "${BUILT_CONFIG_CMAKE}" "${BUILT_CONFIG_VERSION_CMAKE}" + DESTINATION "${ARROW_CMAKE_DIR}/${PACKAGE_NAME}") + set(TARGETS_CMAKE "${PACKAGE_NAME}Targets.cmake") + install(EXPORT ${EXPORT_NAME} + DESTINATION "${ARROW_CMAKE_DIR}/${PACKAGE_NAME}" + NAMESPACE "${PACKAGE_NAME}::" + FILE "${TARGETS_CMAKE}") endfunction() # \arg OUTPUTS list to append built targets to @@ -247,9 +267,17 @@ function(ADD_ARROW_LIB LIB_NAME) if(ARG_PRIVATE_INCLUDES) target_include_directories(${LIB_NAME}_objlib PRIVATE ${ARG_PRIVATE_INCLUDES}) endif() - target_link_libraries(${LIB_NAME}_objlib - PRIVATE ${ARG_SHARED_LINK_LIBS} ${ARG_SHARED_PRIVATE_LINK_LIBS} - ${ARG_STATIC_LINK_LIBS}) + if(BUILD_SHARED) + if(ARG_SHARED_LINK_LIBS) + target_link_libraries(${LIB_NAME}_objlib PRIVATE ${ARG_SHARED_LINK_LIBS}) + endif() + if(ARG_SHARED_PRIVATE_LINK_LIBS) + target_link_libraries(${LIB_NAME}_objlib PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS}) + endif() + endif() + if(BUILD_STATIC AND ARG_STATIC_LINK_LIBS) + target_link_libraries(${LIB_NAME}_objlib PRIVATE ${ARG_STATIC_LINK_LIBS}) + endif() else() # Prepare arguments for separate compilation of static and shared libs below # TODO: add PCH directives @@ -309,11 +337,9 @@ function(ADD_ARROW_LIB LIB_NAME) SOVERSION "${ARROW_SO_VERSION}") target_link_libraries(${LIB_NAME}_shared - LINK_PUBLIC - "$" - "$" - LINK_PRIVATE - ${ARG_SHARED_PRIVATE_LINK_LIBS}) + PUBLIC "$" + "$" + PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS}) if(USE_OBJLIB) # Ensure that dependencies are built before compilation of objects in @@ -394,8 +420,9 @@ function(ADD_ARROW_LIB LIB_NAME) OUTPUT_NAME ${LIB_NAME_STATIC}) if(ARG_STATIC_INSTALL_INTERFACE_LIBS) - target_link_libraries(${LIB_NAME}_static LINK_PUBLIC - "$") + target_link_libraries(${LIB_NAME}_static + INTERFACE "$" + ) endif() if(ARG_STATIC_LINK_LIBS) @@ -422,26 +449,7 @@ function(ADD_ARROW_LIB LIB_NAME) endif() if(ARG_CMAKE_PACKAGE_NAME) - arrow_install_cmake_find_module("${ARG_CMAKE_PACKAGE_NAME}") - - set(TARGETS_CMAKE "${ARG_CMAKE_PACKAGE_NAME}Targets.cmake") - install(EXPORT ${LIB_NAME}_targets - FILE "${TARGETS_CMAKE}" - DESTINATION "${ARROW_CMAKE_DIR}") - - set(CONFIG_CMAKE "${ARG_CMAKE_PACKAGE_NAME}Config.cmake") - set(BUILT_CONFIG_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_CMAKE}") - configure_package_config_file("${CONFIG_CMAKE}.in" "${BUILT_CONFIG_CMAKE}" - INSTALL_DESTINATION "${ARROW_CMAKE_DIR}") - install(FILES "${BUILT_CONFIG_CMAKE}" DESTINATION "${ARROW_CMAKE_DIR}") - - set(CONFIG_VERSION_CMAKE "${ARG_CMAKE_PACKAGE_NAME}ConfigVersion.cmake") - set(BUILT_CONFIG_VERSION_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_VERSION_CMAKE}") - write_basic_package_version_file( - "${BUILT_CONFIG_VERSION_CMAKE}" - VERSION ${${PROJECT_NAME}_VERSION} - COMPATIBILITY AnyNewerVersion) - install(FILES "${BUILT_CONFIG_VERSION_CMAKE}" DESTINATION "${ARROW_CMAKE_DIR}") + arrow_install_cmake_package(${ARG_CMAKE_PACKAGE_NAME} ${LIB_NAME}_targets) endif() if(ARG_PKG_CONFIG_NAME) @@ -906,11 +914,6 @@ function(ARROW_ADD_PKG_CONFIG MODULE) DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/") endfunction() -function(ARROW_INSTALL_CMAKE_FIND_MODULE MODULE) - install(FILES "${ARROW_SOURCE_DIR}/cmake_modules/Find${MODULE}.cmake" - DESTINATION "${ARROW_CMAKE_DIR}") -endfunction() - # Implementations of lisp "car" and "cdr" functions macro(ARROW_CAR var) set(${var} ${ARGV1}) diff --git a/cpp/cmake_modules/FindArrow.cmake b/cpp/cmake_modules/FindArrow.cmake deleted file mode 100644 index 9d2faaf5819c2..0000000000000 --- a/cpp/cmake_modules/FindArrow.cmake +++ /dev/null @@ -1,466 +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. - -# - Find Arrow (arrow/api.h, libarrow.a, libarrow.so) -# This module defines -# ARROW_FOUND, whether Arrow has been found -# ARROW_FULL_SO_VERSION, full shared object version of found Arrow "100.0.0" -# ARROW_IMPORT_LIB, path to libarrow's import library (Windows only) -# ARROW_INCLUDE_DIR, directory containing headers -# ARROW_LIBS, deprecated. Use ARROW_LIB_DIR instead -# ARROW_LIB_DIR, directory containing Arrow libraries -# ARROW_SHARED_IMP_LIB, deprecated. Use ARROW_IMPORT_LIB instead -# ARROW_SHARED_LIB, path to libarrow's shared library -# ARROW_SO_VERSION, shared object version of found Arrow such as "100" -# ARROW_STATIC_LIB, path to libarrow.a -# ARROW_VERSION, version of found Arrow -# ARROW_VERSION_MAJOR, major version of found Arrow -# ARROW_VERSION_MINOR, minor version of found Arrow -# ARROW_VERSION_PATCH, patch version of found Arrow - -if(DEFINED ARROW_FOUND) - return() -endif() - -find_package(PkgConfig) -include(FindPackageHandleStandardArgs) - -if(WIN32 AND NOT MINGW) - # This is used to handle builds using e.g. clang in an MSVC setting. - set(MSVC_TOOLCHAIN TRUE) -else() - set(MSVC_TOOLCHAIN FALSE) -endif() - -set(ARROW_SEARCH_LIB_PATH_SUFFIXES) -if(CMAKE_LIBRARY_ARCHITECTURE) - list(APPEND ARROW_SEARCH_LIB_PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}") -endif() -list(APPEND - ARROW_SEARCH_LIB_PATH_SUFFIXES - "lib64" - "lib32" - "lib" - "bin") -set(ARROW_CONFIG_SUFFIXES - "_RELEASE" - "_RELWITHDEBINFO" - "_MINSIZEREL" - "_DEBUG" - "") -if(CMAKE_BUILD_TYPE) - string(TOUPPER ${CMAKE_BUILD_TYPE} ARROW_CONFIG_SUFFIX_PREFERRED) - set(ARROW_CONFIG_SUFFIX_PREFERRED "_${ARROW_CONFIG_SUFFIX_PREFERRED}") - list(INSERT ARROW_CONFIG_SUFFIXES 0 "${ARROW_CONFIG_SUFFIX_PREFERRED}") -endif() - -if(NOT DEFINED ARROW_MSVC_STATIC_LIB_SUFFIX) - if(MSVC_TOOLCHAIN) - set(ARROW_MSVC_STATIC_LIB_SUFFIX "_static") - else() - set(ARROW_MSVC_STATIC_LIB_SUFFIX "") - endif() -endif() - -# Internal function. -# -# Set shared library name for ${base_name} to ${output_variable}. -# -# Example: -# arrow_build_shared_library_name(ARROW_SHARED_LIBRARY_NAME arrow) -# # -> ARROW_SHARED_LIBRARY_NAME=libarrow.so on Linux -# # -> ARROW_SHARED_LIBRARY_NAME=libarrow.dylib on macOS -# # -> ARROW_SHARED_LIBRARY_NAME=arrow.dll with MSVC on Windows -# # -> ARROW_SHARED_LIBRARY_NAME=libarrow.dll with MinGW on Windows -function(arrow_build_shared_library_name output_variable base_name) - set(${output_variable} - "${CMAKE_SHARED_LIBRARY_PREFIX}${base_name}${CMAKE_SHARED_LIBRARY_SUFFIX}" - PARENT_SCOPE) -endfunction() - -# Internal function. -# -# Set import library name for ${base_name} to ${output_variable}. -# This is useful only for MSVC build. Import library is used only -# with MSVC build. -# -# Example: -# arrow_build_import_library_name(ARROW_IMPORT_LIBRARY_NAME arrow) -# # -> ARROW_IMPORT_LIBRARY_NAME=arrow on Linux (meaningless) -# # -> ARROW_IMPORT_LIBRARY_NAME=arrow on macOS (meaningless) -# # -> ARROW_IMPORT_LIBRARY_NAME=arrow.lib with MSVC on Windows -# # -> ARROW_IMPORT_LIBRARY_NAME=libarrow.dll.a with MinGW on Windows -function(arrow_build_import_library_name output_variable base_name) - set(${output_variable} - "${CMAKE_IMPORT_LIBRARY_PREFIX}${base_name}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - PARENT_SCOPE) -endfunction() - -# Internal function. -# -# Set static library name for ${base_name} to ${output_variable}. -# -# Example: -# arrow_build_static_library_name(ARROW_STATIC_LIBRARY_NAME arrow) -# # -> ARROW_STATIC_LIBRARY_NAME=libarrow.a on Linux -# # -> ARROW_STATIC_LIBRARY_NAME=libarrow.a on macOS -# # -> ARROW_STATIC_LIBRARY_NAME=arrow.lib with MSVC on Windows -# # -> ARROW_STATIC_LIBRARY_NAME=libarrow.dll.a with MinGW on Windows -function(arrow_build_static_library_name output_variable base_name) - set(${output_variable} - "${CMAKE_STATIC_LIBRARY_PREFIX}${base_name}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" - PARENT_SCOPE) -endfunction() - -# Internal function. -# -# Set macro value for ${macro_name} in ${header_content} to ${output_variable}. -# -# Example: -# arrow_extract_macro_value(version_major -# "ARROW_VERSION_MAJOR" -# "#define ARROW_VERSION_MAJOR 1.0.0") -# # -> version_major=1.0.0 -function(arrow_extract_macro_value output_variable macro_name header_content) - string(REGEX MATCH "#define +${macro_name} +[^\r\n]+" macro_definition - "${header_content}") - string(REGEX REPLACE "^#define +${macro_name} +(.+)$" "\\1" macro_value - "${macro_definition}") - set(${output_variable} - "${macro_value}" - PARENT_SCOPE) -endfunction() - -# Internal macro only for arrow_find_package. -# -# Find package in HOME. -macro(arrow_find_package_home) - find_path(${prefix}_include_dir "${header_path}" - PATHS "${home}" - PATH_SUFFIXES "include" - NO_DEFAULT_PATH) - set(include_dir "${${prefix}_include_dir}") - set(${prefix}_INCLUDE_DIR - "${include_dir}" - PARENT_SCOPE) - - if(MSVC_TOOLCHAIN) - set(CMAKE_SHARED_LIBRARY_SUFFIXES_ORIGINAL ${CMAKE_FIND_LIBRARY_SUFFIXES}) - # .dll isn't found by find_library with MSVC because .dll isn't included in - # CMAKE_FIND_LIBRARY_SUFFIXES. - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}") - endif() - find_library(${prefix}_shared_lib - NAMES "${shared_lib_name}" - PATHS "${home}" - PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES} - NO_DEFAULT_PATH) - if(MSVC_TOOLCHAIN) - set(CMAKE_SHARED_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_ORIGINAL}) - endif() - set(shared_lib "${${prefix}_shared_lib}") - set(${prefix}_SHARED_LIB - "${shared_lib}" - PARENT_SCOPE) - if(shared_lib) - add_library(${target_shared} SHARED IMPORTED) - set_target_properties(${target_shared} PROPERTIES IMPORTED_LOCATION "${shared_lib}") - if(include_dir) - set_target_properties(${target_shared} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${include_dir}") - endif() - find_library(${prefix}_import_lib - NAMES "${import_lib_name}" - PATHS "${home}" - PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES} - NO_DEFAULT_PATH) - set(import_lib "${${prefix}_import_lib}") - set(${prefix}_IMPORT_LIB - "${import_lib}" - PARENT_SCOPE) - if(import_lib) - set_target_properties(${target_shared} PROPERTIES IMPORTED_IMPLIB "${import_lib}") - endif() - endif() - - find_library(${prefix}_static_lib - NAMES "${static_lib_name}" - PATHS "${home}" - PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES} - NO_DEFAULT_PATH) - set(static_lib "${${prefix}_static_lib}") - set(${prefix}_STATIC_LIB - "${static_lib}" - PARENT_SCOPE) - if(static_lib) - add_library(${target_static} STATIC IMPORTED) - set_target_properties(${target_static} PROPERTIES IMPORTED_LOCATION "${static_lib}") - if(include_dir) - set_target_properties(${target_static} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${include_dir}") - endif() - endif() -endmacro() - -# Internal macro only for arrow_find_package. -# -# Find package by CMake package configuration. -macro(arrow_find_package_cmake_package_configuration) - find_package(${cmake_package_name} CONFIG) - if(${cmake_package_name}_FOUND) - set(${prefix}_USE_CMAKE_PACKAGE_CONFIG - TRUE - PARENT_SCOPE) - if(TARGET ${target_shared}) - foreach(suffix ${ARROW_CONFIG_SUFFIXES}) - get_target_property(shared_lib ${target_shared} IMPORTED_LOCATION${suffix}) - if(shared_lib) - # Remove shared library version: - # libarrow.so.100.0.0 -> libarrow.so - # Because ARROW_HOME and pkg-config approaches don't add - # shared library version. - string(REGEX REPLACE "(${CMAKE_SHARED_LIBRARY_SUFFIX})[.0-9]+$" "\\1" - shared_lib "${shared_lib}") - set(${prefix}_SHARED_LIB - "${shared_lib}" - PARENT_SCOPE) - break() - endif() - endforeach() - endif() - if(TARGET ${target_static}) - foreach(suffix ${ARROW_CONFIG_SUFFIXES}) - get_target_property(static_lib ${target_static} IMPORTED_LOCATION${suffix}) - if(static_lib) - set(${prefix}_STATIC_LIB - "${static_lib}" - PARENT_SCOPE) - break() - endif() - endforeach() - endif() - endif() -endmacro() - -# Internal macro only for arrow_find_package. -# -# Find package by pkg-config. -macro(arrow_find_package_pkg_config) - pkg_check_modules(${prefix}_PC ${pkg_config_name}) - if(${prefix}_PC_FOUND) - set(${prefix}_USE_PKG_CONFIG - TRUE - PARENT_SCOPE) - - set(include_dir "${${prefix}_PC_INCLUDEDIR}") - set(lib_dir "${${prefix}_PC_LIBDIR}") - set(shared_lib_paths "${${prefix}_PC_LINK_LIBRARIES}") - # Use the first shared library path as the IMPORTED_LOCATION - # for ${target_shared}. This assumes that the first shared library - # path is the shared library path for this module. - list(GET shared_lib_paths 0 first_shared_lib_path) - # Use the rest shared library paths as the INTERFACE_LINK_LIBRARIES - # for ${target_shared}. This assumes that the rest shared library - # paths are dependency library paths for this module. - list(LENGTH shared_lib_paths n_shared_lib_paths) - if(n_shared_lib_paths LESS_EQUAL 1) - set(rest_shared_lib_paths) - else() - list(SUBLIST - shared_lib_paths - 1 - -1 - rest_shared_lib_paths) - endif() - - set(${prefix}_VERSION - "${${prefix}_PC_VERSION}" - PARENT_SCOPE) - set(${prefix}_INCLUDE_DIR - "${include_dir}" - PARENT_SCOPE) - set(${prefix}_SHARED_LIB - "${first_shared_lib_path}" - PARENT_SCOPE) - - add_library(${target_shared} SHARED IMPORTED) - set_target_properties(${target_shared} - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dir}" - INTERFACE_LINK_LIBRARIES "${rest_shared_lib_paths}" - IMPORTED_LOCATION "${first_shared_lib_path}") - get_target_property(shared_lib ${target_shared} IMPORTED_LOCATION) - - find_library(${prefix}_static_lib - NAMES "${static_lib_name}" - PATHS "${lib_dir}" - NO_DEFAULT_PATH) - set(static_lib "${${prefix}_static_lib}") - set(${prefix}_STATIC_LIB - "${static_lib}" - PARENT_SCOPE) - if(static_lib) - add_library(${target_static} STATIC IMPORTED) - set_target_properties(${target_static} - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dir}" - IMPORTED_LOCATION "${static_lib}") - endif() - endif() -endmacro() - -function(arrow_find_package - prefix - home - base_name - header_path - cmake_package_name - pkg_config_name) - arrow_build_shared_library_name(shared_lib_name ${base_name}) - arrow_build_import_library_name(import_lib_name ${base_name}) - arrow_build_static_library_name(static_lib_name ${base_name}) - - set(target_shared ${base_name}_shared) - set(target_static ${base_name}_static) - - if(home) - arrow_find_package_home() - set(${prefix}_FIND_APPROACH - "HOME: ${home}" - PARENT_SCOPE) - else() - arrow_find_package_cmake_package_configuration() - if(${cmake_package_name}_FOUND) - set(${prefix}_FIND_APPROACH - "CMake package configuration: ${cmake_package_name}" - PARENT_SCOPE) - else() - arrow_find_package_pkg_config() - set(${prefix}_FIND_APPROACH - "pkg-config: ${pkg_config_name}" - PARENT_SCOPE) - endif() - endif() - - if(NOT include_dir) - if(TARGET ${target_shared}) - get_target_property(include_dir ${target_shared} INTERFACE_INCLUDE_DIRECTORIES) - elseif(TARGET ${target_static}) - get_target_property(include_dir ${target_static} INTERFACE_INCLUDE_DIRECTORIES) - endif() - endif() - if(include_dir) - set(${prefix}_INCLUDE_DIR - "${include_dir}" - PARENT_SCOPE) - endif() - - if(shared_lib) - get_filename_component(lib_dir "${shared_lib}" DIRECTORY) - elseif(static_lib) - get_filename_component(lib_dir "${static_lib}" DIRECTORY) - else() - set(lib_dir NOTFOUND) - endif() - set(${prefix}_LIB_DIR - "${lib_dir}" - PARENT_SCOPE) - # For backward compatibility - set(${prefix}_LIBS - "${lib_dir}" - PARENT_SCOPE) -endfunction() - -if(NOT "$ENV{ARROW_HOME}" STREQUAL "") - file(TO_CMAKE_PATH "$ENV{ARROW_HOME}" ARROW_HOME) -endif() -arrow_find_package(ARROW - "${ARROW_HOME}" - arrow - arrow/api.h - Arrow - arrow) - -if(ARROW_HOME) - if(ARROW_INCLUDE_DIR) - file(READ "${ARROW_INCLUDE_DIR}/arrow/util/config.h" ARROW_CONFIG_H_CONTENT) - arrow_extract_macro_value(ARROW_VERSION_MAJOR "ARROW_VERSION_MAJOR" - "${ARROW_CONFIG_H_CONTENT}") - arrow_extract_macro_value(ARROW_VERSION_MINOR "ARROW_VERSION_MINOR" - "${ARROW_CONFIG_H_CONTENT}") - arrow_extract_macro_value(ARROW_VERSION_PATCH "ARROW_VERSION_PATCH" - "${ARROW_CONFIG_H_CONTENT}") - if("${ARROW_VERSION_MAJOR}" STREQUAL "" - OR "${ARROW_VERSION_MINOR}" STREQUAL "" - OR "${ARROW_VERSION_PATCH}" STREQUAL "") - set(ARROW_VERSION "0.0.0") - else() - set(ARROW_VERSION - "${ARROW_VERSION_MAJOR}.${ARROW_VERSION_MINOR}.${ARROW_VERSION_PATCH}") - endif() - - arrow_extract_macro_value(ARROW_SO_VERSION_QUOTED "ARROW_SO_VERSION" - "${ARROW_CONFIG_H_CONTENT}") - string(REGEX REPLACE "^\"(.+)\"$" "\\1" ARROW_SO_VERSION "${ARROW_SO_VERSION_QUOTED}") - arrow_extract_macro_value(ARROW_FULL_SO_VERSION_QUOTED "ARROW_FULL_SO_VERSION" - "${ARROW_CONFIG_H_CONTENT}") - string(REGEX REPLACE "^\"(.+)\"$" "\\1" ARROW_FULL_SO_VERSION - "${ARROW_FULL_SO_VERSION_QUOTED}") - endif() -else() - if(ARROW_USE_CMAKE_PACKAGE_CONFIG) - find_package(Arrow CONFIG) - elseif(ARROW_USE_PKG_CONFIG) - pkg_get_variable(ARROW_SO_VERSION arrow so_version) - pkg_get_variable(ARROW_FULL_SO_VERSION arrow full_so_version) - endif() -endif() - -set(ARROW_ABI_VERSION ${ARROW_SO_VERSION}) - -mark_as_advanced(ARROW_ABI_VERSION - ARROW_CONFIG_SUFFIXES - ARROW_FULL_SO_VERSION - ARROW_IMPORT_LIB - ARROW_INCLUDE_DIR - ARROW_LIBS - ARROW_LIB_DIR - ARROW_SEARCH_LIB_PATH_SUFFIXES - ARROW_SHARED_IMP_LIB - ARROW_SHARED_LIB - ARROW_SO_VERSION - ARROW_STATIC_LIB - ARROW_VERSION - ARROW_VERSION_MAJOR - ARROW_VERSION_MINOR - ARROW_VERSION_PATCH) - -find_package_handle_standard_args( - Arrow - REQUIRED_VARS # The first required variable is shown - # in the found message. So this list is - # not sorted alphabetically. - ARROW_INCLUDE_DIR ARROW_LIB_DIR ARROW_FULL_SO_VERSION ARROW_SO_VERSION - VERSION_VAR ARROW_VERSION) -set(ARROW_FOUND ${Arrow_FOUND}) - -if(Arrow_FOUND AND NOT Arrow_FIND_QUIETLY) - message(STATUS "Arrow version: ${ARROW_VERSION} (${ARROW_FIND_APPROACH})") - message(STATUS "Arrow SO and ABI version: ${ARROW_SO_VERSION}") - message(STATUS "Arrow full SO version: ${ARROW_FULL_SO_VERSION}") - message(STATUS "Found the Arrow core shared library: ${ARROW_SHARED_LIB}") - message(STATUS "Found the Arrow core import library: ${ARROW_IMPORT_LIB}") - message(STATUS "Found the Arrow core static library: ${ARROW_STATIC_LIB}") -endif() diff --git a/cpp/cmake_modules/FindArrowCUDA.cmake b/cpp/cmake_modules/FindArrowCUDA.cmake deleted file mode 100644 index 014386f30122a..0000000000000 --- a/cpp/cmake_modules/FindArrowCUDA.cmake +++ /dev/null @@ -1,88 +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. - -# - Find Arrow CUDA (arrow/gpu/cuda_api.h, libarrow_cuda.a, libarrow_cuda.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# ARROW_CUDA_FOUND, whether Arrow CUDA has been found -# ARROW_CUDA_IMPORT_LIB, path to libarrow_cuda's import library (Windows only) -# ARROW_CUDA_INCLUDE_DIR, directory containing headers -# ARROW_CUDA_LIBS, deprecated. Use ARROW_CUDA_LIB_DIR instead -# ARROW_CUDA_LIB_DIR, directory containing Arrow CUDA libraries -# ARROW_CUDA_SHARED_IMP_LIB, deprecated. Use ARROW_CUDA_IMPORT_LIB instead -# ARROW_CUDA_SHARED_LIB, path to libarrow_cuda's shared library -# ARROW_CUDA_STATIC_LIB, path to libarrow_cuda.a - -if(DEFINED ARROW_CUDA_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) - -if(ARROW_FOUND) - arrow_find_package(ARROW_CUDA - "${ARROW_HOME}" - arrow_cuda - arrow/gpu/cuda_api.h - ArrowCUDA - arrow-cuda) - if(NOT ARROW_CUDA_VERSION) - set(ARROW_CUDA_VERSION "${ARROW_VERSION}") - endif() -endif() - -if("${ARROW_CUDA_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(ARROW_CUDA_VERSION_MATCH TRUE) -else() - set(ARROW_CUDA_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(ARROW_CUDA_IMPORT_LIB - ARROW_CUDA_INCLUDE_DIR - ARROW_CUDA_LIBS - ARROW_CUDA_LIB_DIR - ARROW_CUDA_SHARED_IMP_LIB - ARROW_CUDA_SHARED_LIB - ARROW_CUDA_STATIC_LIB - ARROW_CUDA_VERSION - ARROW_CUDA_VERSION_MATCH) - -find_package_handle_standard_args( - ArrowCUDA - REQUIRED_VARS ARROW_CUDA_INCLUDE_DIR ARROW_CUDA_LIB_DIR ARROW_CUDA_VERSION_MATCH - VERSION_VAR ARROW_CUDA_VERSION) -set(ARROW_CUDA_FOUND ${ArrowCUDA_FOUND}) - -if(ArrowCUDA_FOUND AND NOT ArrowCUDA_FIND_QUIETLY) - message(STATUS "Found the Arrow CUDA by ${ARROW_CUDA_FIND_APPROACH}") - message(STATUS "Found the Arrow CUDA shared library: ${ARROW_CUDA_SHARED_LIB}") - message(STATUS "Found the Arrow CUDA import library: ${ARROW_CUDA_IMPORT_LIB}") - message(STATUS "Found the Arrow CUDA static library: ${ARROW_CUDA_STATIC_LIB}") -endif() diff --git a/cpp/cmake_modules/FindArrowDataset.cmake b/cpp/cmake_modules/FindArrowDataset.cmake deleted file mode 100644 index e6ecc1b43ba41..0000000000000 --- a/cpp/cmake_modules/FindArrowDataset.cmake +++ /dev/null @@ -1,88 +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. - -# - Find Arrow Dataset (arrow/dataset/api.h, libarrow_dataset.a, libarrow_dataset.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# ARROW_DATASET_FOUND, whether Arrow Dataset has been found -# ARROW_DATASET_IMPORT_LIB, -# path to libarrow_dataset's import library (Windows only) -# ARROW_DATASET_INCLUDE_DIR, directory containing headers -# ARROW_DATASET_LIB_DIR, directory containing Arrow Dataset libraries -# ARROW_DATASET_SHARED_LIB, path to libarrow_dataset's shared library -# ARROW_DATASET_STATIC_LIB, path to libarrow_dataset.a - -if(DEFINED ARROW_DATASET_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) - -if(ARROW_FOUND) - arrow_find_package(ARROW_DATASET - "${ARROW_HOME}" - arrow_dataset - arrow/dataset/api.h - ArrowDataset - arrow-dataset) - if(NOT ARROW_DATASET_VERSION) - set(ARROW_DATASET_VERSION "${ARROW_VERSION}") - endif() -endif() - -if("${ARROW_DATASET_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(ARROW_DATASET_VERSION_MATCH TRUE) -else() - set(ARROW_DATASET_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(ARROW_DATASET_IMPORT_LIB - ARROW_DATASET_INCLUDE_DIR - ARROW_DATASET_LIBS - ARROW_DATASET_LIB_DIR - ARROW_DATASET_SHARED_IMP_LIB - ARROW_DATASET_SHARED_LIB - ARROW_DATASET_STATIC_LIB - ARROW_DATASET_VERSION - ARROW_DATASET_VERSION_MATCH) - -find_package_handle_standard_args( - ArrowDataset - REQUIRED_VARS ARROW_DATASET_INCLUDE_DIR ARROW_DATASET_LIB_DIR - ARROW_DATASET_VERSION_MATCH - VERSION_VAR ARROW_DATASET_VERSION) -set(ARROW_DATASET_FOUND ${ArrowDataset_FOUND}) - -if(ArrowDataset_FOUND AND NOT ArrowDataset_FIND_QUIETLY) - message(STATUS "Found the Arrow Dataset by ${ARROW_DATASET_FIND_APPROACH}") - message(STATUS "Found the Arrow Dataset shared library: ${ARROW_DATASET_SHARED_LIB}") - message(STATUS "Found the Arrow Dataset import library: ${ARROW_DATASET_IMPORT_LIB}") - message(STATUS "Found the Arrow Dataset static library: ${ARROW_DATASET_STATIC_LIB}") -endif() diff --git a/cpp/cmake_modules/FindArrowFlight.cmake b/cpp/cmake_modules/FindArrowFlight.cmake deleted file mode 100644 index 805a4ff38036e..0000000000000 --- a/cpp/cmake_modules/FindArrowFlight.cmake +++ /dev/null @@ -1,89 +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. - -# - Find Arrow Flight (arrow/flight/api.h, libarrow_flight.a, libarrow_flight.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# ARROW_FLIGHT_FOUND, whether Flight has been found -# ARROW_FLIGHT_IMPORT_LIB, -# path to libarrow_flight's import library (Windows only) -# ARROW_FLIGHT_INCLUDE_DIR, directory containing headers -# ARROW_FLIGHT_LIBS, deprecated. Use ARROW_FLIGHT_LIB_DIR instead -# ARROW_FLIGHT_LIB_DIR, directory containing Flight libraries -# ARROW_FLIGHT_SHARED_IMP_LIB, deprecated. Use ARROW_FLIGHT_IMPORT_LIB instead -# ARROW_FLIGHT_SHARED_LIB, path to libarrow_flight's shared library -# ARROW_FLIGHT_STATIC_LIB, path to libarrow_flight.a - -if(DEFINED ARROW_FLIGHT_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) - -if(ARROW_FOUND) - arrow_find_package(ARROW_FLIGHT - "${ARROW_HOME}" - arrow_flight - arrow/flight/api.h - ArrowFlight - arrow-flight) - if(NOT ARROW_FLIGHT_VERSION) - set(ARROW_FLIGHT_VERSION "${ARROW_VERSION}") - endif() -endif() - -if("${ARROW_FLIGHT_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(ARROW_FLIGHT_VERSION_MATCH TRUE) -else() - set(ARROW_FLIGHT_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(ARROW_FLIGHT_IMPORT_LIB - ARROW_FLIGHT_INCLUDE_DIR - ARROW_FLIGHT_LIBS - ARROW_FLIGHT_LIB_DIR - ARROW_FLIGHT_SHARED_IMP_LIB - ARROW_FLIGHT_SHARED_LIB - ARROW_FLIGHT_STATIC_LIB - ARROW_FLIGHT_VERSION - ARROW_FLIGHT_VERSION_MATCH) - -find_package_handle_standard_args( - ArrowFlight - REQUIRED_VARS ARROW_FLIGHT_INCLUDE_DIR ARROW_FLIGHT_LIB_DIR ARROW_FLIGHT_VERSION_MATCH - VERSION_VAR ARROW_FLIGHT_VERSION) -set(ARROW_FLIGHT_FOUND ${ArrowFlight_FOUND}) - -if(ArrowFlight_FOUND AND NOT ArrowFlight_FIND_QUIETLY) - message(STATUS "Found the Arrow Flight by ${ARROW_FLIGHT_FIND_APPROACH}") - message(STATUS "Found the Arrow Flight shared library: ${ARROW_FLIGHT_SHARED_LIB}") - message(STATUS "Found the Arrow Flight import library: ${ARROW_FLIGHT_IMPORT_LIB}") - message(STATUS "Found the Arrow Flight static library: ${ARROW_FLIGHT_STATIC_LIB}") -endif() diff --git a/cpp/cmake_modules/FindArrowFlightSql.cmake b/cpp/cmake_modules/FindArrowFlightSql.cmake deleted file mode 100644 index cbca81cac441c..0000000000000 --- a/cpp/cmake_modules/FindArrowFlightSql.cmake +++ /dev/null @@ -1,93 +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. - -# - Find Arrow Flight SQL -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# ARROW_FLIGHT_SQL_FOUND, whether Flight has been found -# ARROW_FLIGHT_SQL_IMPORT_LIB, -# path to libarrow_flight's import library (Windows only) -# ARROW_FLIGHT_SQL_INCLUDE_DIR, directory containing headers -# ARROW_FLIGHT_SQL_LIBS, deprecated. Use ARROW_FLIGHT_SQL_LIB_DIR instead -# ARROW_FLIGHT_SQL_LIB_DIR, directory containing Flight libraries -# ARROW_FLIGHT_SQL_SHARED_IMP_LIB, deprecated. Use ARROW_FLIGHT_SQL_IMPORT_LIB instead -# ARROW_FLIGHT_SQL_SHARED_LIB, path to libarrow_flight's shared library -# ARROW_FLIGHT_SQL_STATIC_LIB, path to libarrow_flight.a - -if(DEFINED ARROW_FLIGHT_SQL_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) - -if(ARROW_FOUND) - arrow_find_package(ARROW_FLIGHT_SQL - "${ARROW_HOME}" - arrow_flight_sql - arrow/flight/sql/api.h - ArrowFlightSql - arrow-flight-sql) - if(NOT ARROW_FLIGHT_SQL_VERSION) - set(ARROW_FLIGHT_SQL_VERSION "${ARROW_VERSION}") - endif() -endif() - -if("${ARROW_FLIGHT_SQL_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(ARROW_FLIGHT_SQL_VERSION_MATCH TRUE) -else() - set(ARROW_FLIGHT_SQL_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(ARROW_FLIGHT_SQL_IMPORT_LIB - ARROW_FLIGHT_SQL_INCLUDE_DIR - ARROW_FLIGHT_SQL_LIBS - ARROW_FLIGHT_SQL_LIB_DIR - ARROW_FLIGHT_SQL_SHARED_IMP_LIB - ARROW_FLIGHT_SQL_SHARED_LIB - ARROW_FLIGHT_SQL_STATIC_LIB - ARROW_FLIGHT_SQL_VERSION - ARROW_FLIGHT_SQL_VERSION_MATCH) - -find_package_handle_standard_args( - ArrowFlightSql - REQUIRED_VARS ARROW_FLIGHT_SQL_INCLUDE_DIR ARROW_FLIGHT_SQL_LIB_DIR - ARROW_FLIGHT_SQL_VERSION_MATCH - VERSION_VAR ARROW_FLIGHT_SQL_VERSION) -set(ARROW_FLIGHT_SQL_FOUND ${ArrowFlightSql_FOUND}) - -if(ArrowFlightSql_FOUND AND NOT ArrowFlightSql_FIND_QUIETLY) - message(STATUS "Found the Arrow Flight SQL by ${ARROW_FLIGHT_SQL_FIND_APPROACH}") - message(STATUS "Found the Arrow Flight SQL shared library: ${ARROW_FLIGHT_SQL_SHARED_LIB}" - ) - message(STATUS "Found the Arrow Flight SQL import library: ${ARROW_FLIGHT_SQL_IMPORT_LIB}" - ) - message(STATUS "Found the Arrow Flight SQL static library: ${ARROW_FLIGHT_SQL_STATIC_LIB}" - ) -endif() diff --git a/cpp/cmake_modules/FindArrowFlightTesting.cmake b/cpp/cmake_modules/FindArrowFlightTesting.cmake deleted file mode 100644 index c0756cf637c54..0000000000000 --- a/cpp/cmake_modules/FindArrowFlightTesting.cmake +++ /dev/null @@ -1,98 +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. - -# - Find Arrow Flight testing library -# (arrow/flight/test_util.h, -# libarrow_flight_testing.a, -# libarrow_flight_testing.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# ARROW_FLIGHT_TESTING_FOUND, -# whether Arrow Flight testing library has been found -# ARROW_FLIGHT_TESTING_IMPORT_LIB, -# path to libarrow_flight_testing's import library (Windows only) -# ARROW_FLIGHT_TESTING_INCLUDE_DIR, directory containing headers -# ARROW_FLIGHT_TESTING_LIB_DIR, directory containing Arrow testing libraries -# ARROW_FLIGHT_TESTING_SHARED_LIB, -# path to libarrow_flight_testing's shared library -# ARROW_FLIGHT_TESTING_STATIC_LIB, path to libarrow_flight_testing.a - -if(DEFINED ARROW_FLIGHT_TESTING_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(ArrowFlight ${find_package_arguments}) -find_package(ArrowTesting ${find_package_arguments}) - -if(ARROW_TESTING_FOUND AND ARROW_FLIGHT_FOUND) - arrow_find_package(ARROW_FLIGHT_TESTING - "${ARROW_HOME}" - arrow_flight_testing - arrow/flight/test_util.h - ArrowFlightTesting - arrow-flight-testing) - if(NOT ARROW_FLIGHT_TESTING_VERSION) - set(ARROW_FLIGHT_TESTING_VERSION "${ARROW_VERSION}") - endif() -endif() - -if("${ARROW_FLIGHT_TESTING_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(ARROW_FLIGHT_TESTING_VERSION_MATCH TRUE) -else() - set(ARROW_FLIGHT_TESTING_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(ARROW_FLIGHT_TESTING_IMPORT_LIB - ARROW_FLIGHT_TESTING_INCLUDE_DIR - ARROW_FLIGHT_TESTING_LIBS - ARROW_FLIGHT_TESTING_LIB_DIR - ARROW_FLIGHT_TESTING_SHARED_IMP_LIB - ARROW_FLIGHT_TESTING_SHARED_LIB - ARROW_FLIGHT_TESTING_STATIC_LIB - ARROW_FLIGHT_TESTING_VERSION - ARROW_FLIGHT_TESTING_VERSION_MATCH) - -find_package_handle_standard_args( - ArrowFlightTesting - REQUIRED_VARS ARROW_FLIGHT_TESTING_INCLUDE_DIR ARROW_FLIGHT_TESTING_LIB_DIR - ARROW_FLIGHT_TESTING_VERSION_MATCH - VERSION_VAR ARROW_FLIGHT_TESTING_VERSION) -set(ARROW_FLIGHT_TESTING_FOUND ${ArrowFlightTesting_FOUND}) - -if(ArrowFlightTesting_FOUND AND NOT ArrowFlightTesting_FIND_QUIETLY) - message(STATUS "Found the Arrow Flight testing by ${ARROW_FLIGHT_TESTING_FIND_APPROACH}" - ) - message(STATUS "Found the Arrow Flight testing shared library: ${ARROW_FLIGHT_TESTING_SHARED_LIB}" - ) - message(STATUS "Found the Arrow Flight testing import library: ${ARROW_FLIGHT_TESTING_IMPORT_LIB}" - ) - message(STATUS "Found the Arrow Flight testing static library: ${ARROW_FLIGHT_TESTING_STATIC_LIB}" - ) -endif() diff --git a/cpp/cmake_modules/FindArrowPython.cmake b/cpp/cmake_modules/FindArrowPython.cmake deleted file mode 100644 index 5acd3dab1d0de..0000000000000 --- a/cpp/cmake_modules/FindArrowPython.cmake +++ /dev/null @@ -1,87 +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. - -# - Find Arrow Python (arrow/python/api.h, libarrow_python.a, libarrow_python.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# ARROW_PYTHON_FOUND, whether Arrow Python has been found -# ARROW_PYTHON_IMPORT_LIB, -# path to libarrow_python's import library (Windows only) -# ARROW_PYTHON_INCLUDE_DIR, directory containing headers -# ARROW_PYTHON_LIB_DIR, directory containing Arrow Python libraries -# ARROW_PYTHON_SHARED_LIB, path to libarrow_python's shared library -# ARROW_PYTHON_STATIC_LIB, path to libarrow_python.a - -if(DEFINED ARROW_PYTHON_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) - -if(ARROW_FOUND) - arrow_find_package(ARROW_PYTHON - "${PYARROW_CPP_HOME}" - arrow_python - arrow/python/api.h - ArrowPython - arrow-python) - if(NOT ARROW_PYTHON_VERSION) - set(ARROW_PYTHON_VERSION "${ARROW_VERSION}") - endif() -endif() - -if("${ARROW_PYTHON_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(ARROW_PYTHON_VERSION_MATCH TRUE) -else() - set(ARROW_PYTHON_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(ARROW_PYTHON_IMPORT_LIB - ARROW_PYTHON_INCLUDE_DIR - ARROW_PYTHON_LIBS - ARROW_PYTHON_LIB_DIR - ARROW_PYTHON_SHARED_IMP_LIB - ARROW_PYTHON_SHARED_LIB - ARROW_PYTHON_STATIC_LIB - ARROW_PYTHON_VERSION - ARROW_PYTHON_VERSION_MATCH) - -find_package_handle_standard_args( - ArrowPython - REQUIRED_VARS ARROW_PYTHON_INCLUDE_DIR ARROW_PYTHON_LIB_DIR ARROW_PYTHON_VERSION_MATCH - VERSION_VAR ARROW_PYTHON_VERSION) -set(ARROW_PYTHON_FOUND ${ArrowPython_FOUND}) - -if(ArrowPython_FOUND AND NOT ArrowPython_FIND_QUIETLY) - message(STATUS "Found the Arrow Python by ${ARROW_PYTHON_FIND_APPROACH}") - message(STATUS "Found the Arrow Python shared library: ${ARROW_PYTHON_SHARED_LIB}") - message(STATUS "Found the Arrow Python import library: ${ARROW_PYTHON_IMPORT_LIB}") - message(STATUS "Found the Arrow Python static library: ${ARROW_PYTHON_STATIC_LIB}") -endif() diff --git a/cpp/cmake_modules/FindArrowPythonFlight.cmake b/cpp/cmake_modules/FindArrowPythonFlight.cmake deleted file mode 100644 index fb670fa7658f1..0000000000000 --- a/cpp/cmake_modules/FindArrowPythonFlight.cmake +++ /dev/null @@ -1,94 +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. - -# - Find Arrow Python Flight -# (arrow/python/flight.h, libarrow_python_flight.a, libarrow_python_flight.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# ARROW_PYTHON_FLIGHT_FOUND, whether Arrow Python Flight has been found -# ARROW_PYTHON_FLIGHT_IMPORT_LIB, -# path to libarrow_python_flight's import library (Windows only) -# ARROW_PYTHON_FLIGHT_INCLUDE_DIR, directory containing headers -# ARROW_PYTHON_FLIGHT_LIB_DIR, -# directory containing Arrow Python Flight libraries -# ARROW_PYTHON_FLIGHT_SHARED_LIB, path to libarrow_python_flight's shared library -# ARROW_PYTHON_FLIGHT_STATIC_LIB, path to libarrow_python_flight.a - -if(DEFINED ARROW_PYTHON_FLIGHT_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(ArrowFlight ${find_package_arguments}) -find_package(ArrowPython ${find_package_arguments}) - -if(ARROW_PYTHON_FOUND AND ARROW_FLIGHT_FOUND) - arrow_find_package(ARROW_PYTHON_FLIGHT - "${PYARROW_CPP_HOME}" - arrow_python_flight - arrow/python/flight.h - ArrowPythonFlight - arrow-python-flight) - if(NOT ARROW_PYTHON_FLIGHT_VERSION) - set(ARROW_PYTHON_FLIGHT_VERSION "${ARROW_VERSION}") - endif() -endif() - -if("${ARROW_PYTHON_FLIGHT_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(ARROW_PYTHON_FLIGHT_VERSION_MATCH TRUE) -else() - set(ARROW_PYTHON_FLIGHT_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(ARROW_PYTHON_FLIGHT_IMPORT_LIB - ARROW_PYTHON_FLIGHT_INCLUDE_DIR - ARROW_PYTHON_FLIGHT_LIBS - ARROW_PYTHON_FLIGHT_LIB_DIR - ARROW_PYTHON_FLIGHT_SHARED_IMP_LIB - ARROW_PYTHON_FLIGHT_SHARED_LIB - ARROW_PYTHON_FLIGHT_STATIC_LIB - ARROW_PYTHON_FLIGHT_VERSION - ARROW_PYTHON_FLIGHT_VERSION_MATCH) - -find_package_handle_standard_args( - ArrowPythonFlight - REQUIRED_VARS ARROW_PYTHON_FLIGHT_INCLUDE_DIR ARROW_PYTHON_FLIGHT_LIB_DIR - ARROW_PYTHON_FLIGHT_VERSION_MATCH - VERSION_VAR ARROW_PYTHON_FLIGHT_VERSION) -set(ARROW_PYTHON_FLIGHT_FOUND ${ArrowPythonFlight_FOUND}) - -if(ArrowPythonFlight_FOUND AND NOT ArrowPythonFlight_FIND_QUIETLY) - message(STATUS "Found the Arrow Python Flight by ${ARROW_PYTHON_FLIGHT_FIND_APPROACH}") - message(STATUS "Found the Arrow Python Flight shared library: ${ARROW_PYTHON_FLIGHT_SHARED_LIB}" - ) - message(STATUS "Found the Arrow Python Flight import library: ${ARROW_PYTHON_FLIGHT_IMPORT_LIB}" - ) - message(STATUS "Found the Arrow Python Flight static library: ${ARROW_PYTHON_FLIGHT_STATIC_LIB}" - ) -endif() diff --git a/cpp/cmake_modules/FindArrowSubstrait.cmake b/cpp/cmake_modules/FindArrowSubstrait.cmake deleted file mode 100644 index 165a05a0cb879..0000000000000 --- a/cpp/cmake_modules/FindArrowSubstrait.cmake +++ /dev/null @@ -1,92 +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. - -# - Find Arrow Substrait (libarrow_substrait.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# ARROW_SUBSTRAIT_FOUND, whether Arrow Substrait has been found -# ARROW_SUBSTRAIT_IMPORT_LIB, -# path to libarrow_substrait's import library (Windows only) -# ARROW_SUBSTRAIT_INCLUDE_DIR, directory containing headers -# ARROW_SUBSTRAIT_LIB_DIR, directory containing Arrow Substrait libraries -# ARROW_SUBSTRAIT_SHARED_LIB, path to libarrow_substrait's shared library -# ARROW_SUBSTRAIT_STATIC_LIB, path to libarrow_substrait.a - -if(DEFINED ARROW_SUBSTRAIT_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) -find_package(Parquet ${find_package_arguments}) - -if(ARROW_FOUND AND PARQUET_FOUND) - arrow_find_package(ARROW_SUBSTRAIT - "${ARROW_HOME}" - arrow_substrait - arrow/engine/substrait/api.h - ArrowSubstrait - arrow-substrait) - if(NOT ARROW_SUBSTRAIT_VERSION) - set(ARROW_SUBSTRAIT_VERSION "${ARROW_VERSION}") - endif() -endif() - -if("${ARROW_SUBSTRAIT_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(ARROW_SUBSTRAIT_VERSION_MATCH TRUE) -else() - set(ARROW_SUBSTRAIT_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(ARROW_SUBSTRAIT_IMPORT_LIB - ARROW_SUBSTRAIT_INCLUDE_DIR - ARROW_SUBSTRAIT_LIBS - ARROW_SUBSTRAIT_LIB_DIR - ARROW_SUBSTRAIT_SHARED_IMP_LIB - ARROW_SUBSTRAIT_SHARED_LIB - ARROW_SUBSTRAIT_STATIC_LIB - ARROW_SUBSTRAIT_VERSION - ARROW_SUBSTRAIT_VERSION_MATCH) - -find_package_handle_standard_args( - ArrowSubstrait - REQUIRED_VARS ARROW_SUBSTRAIT_INCLUDE_DIR ARROW_SUBSTRAIT_LIB_DIR - ARROW_SUBSTRAIT_VERSION_MATCH - VERSION_VAR ARROW_SUBSTRAIT_VERSION) -set(ARROW_SUBSTRAIT_FOUND ${ArrowSubstrait_FOUND}) - -if(ArrowSubstrait_FOUND AND NOT ArrowSubstrait_FIND_QUIETLY) - message(STATUS "Found the Arrow Substrait by ${ARROW_SUBSTRAIT_FIND_APPROACH}") - message(STATUS "Found the Arrow Substrait shared library: ${ARROW_SUBSTRAIT_SHARED_LIB}" - ) - message(STATUS "Found the Arrow Substrait import library: ${ARROW_SUBSTRAIT_IMPORT_LIB}" - ) - message(STATUS "Found the Arrow Substrait static library: ${ARROW_SUBSTRAIT_STATIC_LIB}" - ) -endif() diff --git a/cpp/cmake_modules/FindArrowTesting.cmake b/cpp/cmake_modules/FindArrowTesting.cmake deleted file mode 100644 index c405003ad70f4..0000000000000 --- a/cpp/cmake_modules/FindArrowTesting.cmake +++ /dev/null @@ -1,89 +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. - -# - Find Arrow testing library -# (arrow/testing/util.h, libarrow_testing.a, libarrow_testing.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# ARROW_TESTING_FOUND, whether Arrow testing library has been found -# ARROW_TESTING_IMPORT_LIB, -# path to libarrow_testing's import library (Windows only) -# ARROW_TESTING_INCLUDE_DIR, directory containing headers -# ARROW_TESTING_LIB_DIR, directory containing Arrow testing libraries -# ARROW_TESTING_SHARED_LIB, path to libarrow_testing's shared library -# ARROW_TESTING_STATIC_LIB, path to libarrow_testing.a - -if(DEFINED ARROW_TESTING_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) - -if(ARROW_FOUND) - arrow_find_package(ARROW_TESTING - "${ARROW_HOME}" - arrow_testing - arrow/testing/util.h - ArrowTesting - arrow-testing) - if(NOT ARROW_TESTING_VERSION) - set(ARROW_TESTING_VERSION "${ARROW_VERSION}") - endif() -endif() - -if("${ARROW_TESTING_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(ARROW_TESTING_VERSION_MATCH TRUE) -else() - set(ARROW_TESTING_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(ARROW_TESTING_IMPORT_LIB - ARROW_TESTING_INCLUDE_DIR - ARROW_TESTING_LIBS - ARROW_TESTING_LIB_DIR - ARROW_TESTING_SHARED_IMP_LIB - ARROW_TESTING_SHARED_LIB - ARROW_TESTING_STATIC_LIB - ARROW_TESTING_VERSION - ARROW_TESTING_VERSION_MATCH) - -find_package_handle_standard_args( - ArrowTesting - REQUIRED_VARS ARROW_TESTING_INCLUDE_DIR ARROW_TESTING_LIB_DIR - ARROW_TESTING_VERSION_MATCH - VERSION_VAR ARROW_TESTING_VERSION) -set(ARROW_TESTING_FOUND ${ArrowTesting_FOUND}) - -if(ArrowTesting_FOUND AND NOT ArrowTesting_FIND_QUIETLY) - message(STATUS "Found the Arrow testing by ${ARROW_TESTING_FIND_APPROACH}") - message(STATUS "Found the Arrow testing shared library: ${ARROW_TESTING_SHARED_LIB}") - message(STATUS "Found the Arrow testing import library: ${ARROW_TESTING_IMPORT_LIB}") - message(STATUS "Found the Arrow testing static library: ${ARROW_TESTING_STATIC_LIB}") -endif() diff --git a/cpp/cmake_modules/FindBrotli.cmake b/cpp/cmake_modules/FindBrotli.cmake index e2670b51a9eba..4053b79ca7e34 100644 --- a/cpp/cmake_modules/FindBrotli.cmake +++ b/cpp/cmake_modules/FindBrotli.cmake @@ -17,6 +17,10 @@ # # find_package(Brotli) +if(Brotli_FOUND) + return() +endif() + if(ARROW_BROTLI_USE_SHARED) set(BROTLI_COMMON_LIB_NAMES brotlicommon diff --git a/cpp/cmake_modules/FindClangTools.cmake b/cpp/cmake_modules/FindClangTools.cmake index da27d2afcdb1d..a00ff2c939db9 100644 --- a/cpp/cmake_modules/FindClangTools.cmake +++ b/cpp/cmake_modules/FindClangTools.cmake @@ -41,8 +41,21 @@ set(CLANG_TOOLS_SEARCH_PATHS /usr/bin "C:/Program Files/LLVM/bin" # Windows, non-conda "$ENV{CONDA_PREFIX}/Library/bin") # Windows, conda -if(CLANG_TOOLS_BREW_PREFIX) - list(APPEND CLANG_TOOLS_SEARCH_PATHS "${CLANG_TOOLS_BREW}/bin") +if(APPLE) + find_program(BREW brew) + if(BREW) + execute_process(COMMAND ${BREW} --prefix "llvm@${ARROW_CLANG_TOOLS_VERSION_MAJOR}" + OUTPUT_VARIABLE CLANG_TOOLS_BREW_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT CLANG_TOOLS_BREW_PREFIX) + execute_process(COMMAND ${BREW} --prefix llvm + OUTPUT_VARIABLE CLANG_TOOLS_BREW_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + if(CLANG_TOOLS_BREW_PREFIX) + list(APPEND CLANG_TOOLS_SEARCH_PATHS "${CLANG_TOOLS_BREW_PREFIX}/bin") + endif() + endif() endif() function(FIND_CLANG_TOOL NAME OUTPUT VERSION_CHECK_PATTERN) diff --git a/cpp/cmake_modules/FindGLOG.cmake b/cpp/cmake_modules/FindGLOG.cmake index d67eb005621fe..61b7d0694efd4 100644 --- a/cpp/cmake_modules/FindGLOG.cmake +++ b/cpp/cmake_modules/FindGLOG.cmake @@ -17,6 +17,10 @@ # # find_package(GLOG) +if(GLOG_FOUND) + return() +endif() + find_package(PkgConfig QUIET) pkg_check_modules(GLOG_PC libglog) if(GLOG_PC_FOUND) diff --git a/cpp/cmake_modules/FindGandiva.cmake b/cpp/cmake_modules/FindGandiva.cmake deleted file mode 100644 index c533abed733e0..0000000000000 --- a/cpp/cmake_modules/FindGandiva.cmake +++ /dev/null @@ -1,94 +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. - -# - Find Gandiva (gandiva/arrow.h, libgandiva.a, libgandiva.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# GANDIVA_FOUND, whether Gandiva has been found -# GANDIVA_IMPORT_LIB, path to libgandiva's import library (Windows only) -# GANDIVA_INCLUDE_DIR, directory containing headers -# GANDIVA_LIBS, deprecated. Use GANDIVA_LIB_DIR instead -# GANDIVA_LIB_DIR, directory containing Gandiva libraries -# GANDIVA_SHARED_IMP_LIB, deprecated. Use GANDIVA_IMPORT_LIB instead -# GANDIVA_SHARED_LIB, path to libgandiva's shared library -# GANDIVA_SO_VERSION, shared object version of found Gandiva such as "100" -# GANDIVA_STATIC_LIB, path to libgandiva.a - -if(DEFINED GANDIVA_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) - -if(ARROW_FOUND) - arrow_find_package(GANDIVA - "${ARROW_HOME}" - gandiva - gandiva/arrow.h - Gandiva - gandiva) - if(NOT GANDIVA_VERSION) - set(GANDIVA_VERSION "${ARROW_VERSION}") - endif() - set(GANDIVA_ABI_VERSION "${ARROW_ABI_VERSION}") - set(GANDIVA_SO_VERSION "${ARROW_SO_VERSION}") -endif() - -if("${GANDIVA_VERSION}" VERSION_EQUAL "${ARROW_VERSION}") - set(GANDIVA_VERSION_MATCH TRUE) -else() - set(GANDIVA_VERSION_MATCH FALSE) -endif() - -mark_as_advanced(GANDIVA_ABI_VERSION - GANDIVA_IMPORT_LIB - GANDIVA_INCLUDE_DIR - GANDIVA_LIBS - GANDIVA_LIB_DIR - GANDIVA_SHARED_IMP_LIB - GANDIVA_SHARED_LIB - GANDIVA_SO_VERSION - GANDIVA_STATIC_LIB - GANDIVA_VERSION - GANDIVA_VERSION_MATCH) - -find_package_handle_standard_args( - Gandiva - REQUIRED_VARS GANDIVA_INCLUDE_DIR GANDIVA_LIB_DIR GANDIVA_SO_VERSION - GANDIVA_VERSION_MATCH - VERSION_VAR GANDIVA_VERSION) -set(GANDIVA_FOUND ${Gandiva_FOUND}) - -if(Gandiva_FOUND AND NOT Gandiva_FIND_QUIETLY) - message(STATUS "Found the Gandiva by ${GANDIVA_FIND_APPROACH}") - message(STATUS "Found the Gandiva shared library: ${GANDIVA_SHARED_LIB}") - message(STATUS "Found the Gandiva import library: ${GANDIVA_IMPORT_LIB}") - message(STATUS "Found the Gandiva static library: ${GANDIVA_STATIC_LIB}") -endif() diff --git a/cpp/cmake_modules/FindLLVMAlt.cmake b/cpp/cmake_modules/FindLLVMAlt.cmake index e96e89850aeb3..56ceead941516 100644 --- a/cpp/cmake_modules/FindLLVMAlt.cmake +++ b/cpp/cmake_modules/FindLLVMAlt.cmake @@ -19,6 +19,10 @@ # # find_package(LLVMAlt) +if(LLVMAlt_FOUND) + return() +endif() + if(DEFINED LLVM_ROOT) # if llvm source is set to conda then prefer conda llvm over system llvm even # if the system one is newer @@ -37,8 +41,21 @@ endif() if(NOT LLVM_FOUND) set(LLVM_HINTS ${LLVM_ROOT} ${LLVM_DIR} /usr/lib /usr/share) - if(LLVM_BREW_PREFIX) - list(APPEND LLVM_HINTS ${LLVM_BREW_PREFIX}) + if(APPLE) + find_program(BREW brew) + if(BREW) + execute_process(COMMAND ${BREW} --prefix "llvm@${ARROW_LLVM_VERSION_PRIMARY_MAJOR}" + OUTPUT_VARIABLE LLVM_BREW_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT LLVM_BREW_PREFIX) + execute_process(COMMAND ${BREW} --prefix llvm + OUTPUT_VARIABLE LLVM_BREW_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + if(LLVM_BREW_PREFIX) + list(APPEND LLVM_HINTS ${LLVM_BREW_PREFIX}) + endif() + endif() endif() foreach(HINT ${LLVM_HINTS}) @@ -76,12 +93,14 @@ if(LLVM_FOUND) clang-${LLVM_VERSION_MAJOR} clang HINTS ${LLVM_TOOLS_BINARY_DIR}) - add_library(LLVM::LLVM_INTERFACE INTERFACE IMPORTED) - - set_target_properties(LLVM::LLVM_INTERFACE + add_library(LLVM::LLVM_HEADERS INTERFACE IMPORTED) + set_target_properties(LLVM::LLVM_HEADERS PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LLVM_INCLUDE_DIRS}" - INTERFACE_COMPILE_FLAGS "${LLVM_DEFINITIONS}" - INTERFACE_LINK_LIBRARIES "${LLVM_LIBS}") + INTERFACE_COMPILE_FLAGS "${LLVM_DEFINITIONS}") + + add_library(LLVM::LLVM_LIBS INTERFACE IMPORTED) + set_target_properties(LLVM::LLVM_LIBS PROPERTIES INTERFACE_LINK_LIBRARIES + "${LLVM_LIBS}") endif() mark_as_advanced(CLANG_EXECUTABLE LLVM_LINK_EXECUTABLE) diff --git a/cpp/cmake_modules/FindORC.cmake b/cpp/cmake_modules/FindORC.cmake index d45b1607833f8..aca915acc13d0 100644 --- a/cpp/cmake_modules/FindORC.cmake +++ b/cpp/cmake_modules/FindORC.cmake @@ -21,6 +21,10 @@ # ORC_STATIC_LIB, path to liborc.a # ORC_FOUND, whether orc has been found +if(ORC_FOUND) + return() +endif() + if(ORC_ROOT) find_library(ORC_STATIC_LIB NAMES orc diff --git a/cpp/cmake_modules/FindOpenSSLAlt.cmake b/cpp/cmake_modules/FindOpenSSLAlt.cmake index 603e7d066edd0..f027eb1026dde 100644 --- a/cpp/cmake_modules/FindOpenSSLAlt.cmake +++ b/cpp/cmake_modules/FindOpenSSLAlt.cmake @@ -15,40 +15,41 @@ # specific language governing permissions and limitations # under the License. -if(ARROW_OPENSSL_USE_SHARED) - # Find shared OpenSSL libraries. - set(OpenSSL_USE_STATIC_LIBS OFF) - set(OPENSSL_USE_STATIC_LIBS OFF) - find_package(OpenSSL) -else() - # Find static OpenSSL headers and libs - set(OpenSSL_USE_STATIC_LIBS ON) - set(OPENSSL_USE_STATIC_LIBS ON) - find_package(OpenSSL) -endif() - -if(OPENSSL_FOUND) - message(STATUS "OpenSSL found with ${OPENSSL_VERSION} version") - if(OPENSSL_VERSION LESS "1.1.0") - message(SEND_ERROR "The OpenSSL must be greater than or equal to 1.1.0") - endif() -else() - message(SEND_ERROR "Not found the OpenSSL library") +if(OpenSSLAlt_FOUND) + return() endif() -if(NOT GANDIVA_OPENSSL_LIBS) - if(WIN32) - if(CMAKE_VERSION VERSION_LESS 3.18) - set(GANDIVA_OPENSSL_LIBS OpenSSL::Crypto OpenSSL::SSL) +if(APPLE AND NOT OPENSSL_ROOT_DIR) + find_program(BREW brew) + if(BREW) + execute_process(COMMAND ${BREW} --prefix "openssl@1.1" + OUTPUT_VARIABLE OPENSSL11_BREW_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(OPENSSL11_BREW_PREFIX) + set(OPENSSL_ROOT_DIR ${OPENSSL11_BREW_PREFIX}) else() - set(GANDIVA_OPENSSL_LIBS OpenSSL::Crypto OpenSSL::SSL OpenSSL::applink) + execute_process(COMMAND ${BREW} --prefix "openssl" + OUTPUT_VARIABLE OPENSSL_BREW_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(OPENSSL_BREW_PREFIX) + set(OPENSSL_ROOT_DIR ${OPENSSL_BREW_PREFIX}) + endif() endif() - else() - set(GANDIVA_OPENSSL_LIBS OpenSSL::Crypto OpenSSL::SSL) endif() endif() -if(NOT GANDIVA_OPENSSL_INCLUDE_DIR) - set(GANDIVA_OPENSSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR}) - message(STATUS "OpenSSL include dir: ${GANDIVA_OPENSSL_INCLUDE_DIR}") +set(find_package_args) +if(OpenSSLAlt_FIND_VERSION) + list(APPEND find_package_args ${OpenSSLAlt_FIND_VERSION}) endif() +if(OpenSSLAlt_FIND_QUIETLY) + list(APPEND find_package_args QUIET) +endif() +if(ARROW_OPENSSL_USE_SHARED) + set(OPENSSL_USE_STATIC_LIBS OFF) +else() + set(OPENSSL_USE_STATIC_LIBS ON) +endif() +find_package(OpenSSL ${find_package_args}) + +set(OpenSSLAlt_FOUND ${OPENSSL_FOUND}) diff --git a/cpp/cmake_modules/FindParquet.cmake b/cpp/cmake_modules/FindParquet.cmake deleted file mode 100644 index e071fc822b63b..0000000000000 --- a/cpp/cmake_modules/FindParquet.cmake +++ /dev/null @@ -1,126 +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. - -# - Find Parquet (parquet/api/reader.h, libparquet.a, libparquet.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# PARQUET_FOUND, whether Parquet has been found -# PARQUET_IMPORT_LIB, path to libparquet's import library (Windows only) -# PARQUET_INCLUDE_DIR, directory containing headers -# PARQUET_LIBS, deprecated. Use PARQUET_LIB_DIR instead -# PARQUET_LIB_DIR, directory containing Parquet libraries -# PARQUET_SHARED_IMP_LIB, deprecated. Use PARQUET_IMPORT_LIB instead -# PARQUET_SHARED_LIB, path to libparquet's shared library -# PARQUET_SO_VERSION, shared object version of found Parquet such as "100" -# PARQUET_STATIC_LIB, path to libparquet.a - -if(DEFINED PARQUET_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) - -if(NOT "$ENV{PARQUET_HOME}" STREQUAL "") - file(TO_CMAKE_PATH "$ENV{PARQUET_HOME}" PARQUET_HOME) -endif() - -if((NOT PARQUET_HOME) AND ARROW_HOME) - set(PARQUET_HOME ${ARROW_HOME}) -endif() - -if(ARROW_FOUND) - arrow_find_package(PARQUET - "${PARQUET_HOME}" - parquet - parquet/api/reader.h - Parquet - parquet) - if(PARQUET_HOME) - if(PARQUET_INCLUDE_DIR) - file(READ "${PARQUET_INCLUDE_DIR}/parquet/parquet_version.h" - PARQUET_VERSION_H_CONTENT) - arrow_extract_macro_value(PARQUET_VERSION_MAJOR "PARQUET_VERSION_MAJOR" - "${PARQUET_VERSION_H_CONTENT}") - arrow_extract_macro_value(PARQUET_VERSION_MINOR "PARQUET_VERSION_MINOR" - "${PARQUET_VERSION_H_CONTENT}") - arrow_extract_macro_value(PARQUET_VERSION_PATCH "PARQUET_VERSION_PATCH" - "${PARQUET_VERSION_H_CONTENT}") - if("${PARQUET_VERSION_MAJOR}" STREQUAL "" - OR "${PARQUET_VERSION_MINOR}" STREQUAL "" - OR "${PARQUET_VERSION_PATCH}" STREQUAL "") - set(PARQUET_VERSION "0.0.0") - else() - set(PARQUET_VERSION - "${PARQUET_VERSION_MAJOR}.${PARQUET_VERSION_MINOR}.${PARQUET_VERSION_PATCH}") - endif() - - arrow_extract_macro_value(PARQUET_SO_VERSION_QUOTED "PARQUET_SO_VERSION" - "${PARQUET_VERSION_H_CONTENT}") - string(REGEX REPLACE "^\"(.+)\"$" "\\1" PARQUET_SO_VERSION - "${PARQUET_SO_VERSION_QUOTED}") - arrow_extract_macro_value(PARQUET_FULL_SO_VERSION_QUOTED "PARQUET_FULL_SO_VERSION" - "${PARQUET_VERSION_H_CONTENT}") - string(REGEX REPLACE "^\"(.+)\"$" "\\1" PARQUET_FULL_SO_VERSION - "${PARQUET_FULL_SO_VERSION_QUOTED}") - endif() - else() - if(PARQUET_USE_CMAKE_PACKAGE_CONFIG) - find_package(Parquet CONFIG) - elseif(PARQUET_USE_PKG_CONFIG) - pkg_get_variable(PARQUET_SO_VERSION parquet so_version) - pkg_get_variable(PARQUET_FULL_SO_VERSION parquet full_so_version) - endif() - endif() - set(PARQUET_ABI_VERSION "${PARQUET_SO_VERSION}") -endif() - -mark_as_advanced(PARQUET_ABI_VERSION - PARQUET_IMPORT_LIB - PARQUET_INCLUDE_DIR - PARQUET_LIBS - PARQUET_LIB_DIR - PARQUET_SHARED_IMP_LIB - PARQUET_SHARED_LIB - PARQUET_SO_VERSION - PARQUET_STATIC_LIB - PARQUET_VERSION) - -find_package_handle_standard_args( - Parquet - REQUIRED_VARS PARQUET_INCLUDE_DIR PARQUET_LIB_DIR PARQUET_SO_VERSION - VERSION_VAR PARQUET_VERSION) -set(PARQUET_FOUND ${Parquet_FOUND}) - -if(Parquet_FOUND AND NOT Parquet_FIND_QUIETLY) - message(STATUS "Parquet version: ${PARQUET_VERSION} (${PARQUET_FIND_APPROACH})") - message(STATUS "Found the Parquet shared library: ${PARQUET_SHARED_LIB}") - message(STATUS "Found the Parquet import library: ${PARQUET_IMPORT_LIB}") - message(STATUS "Found the Parquet static library: ${PARQUET_STATIC_LIB}") -endif() diff --git a/cpp/cmake_modules/FindPlasma.cmake b/cpp/cmake_modules/FindPlasma.cmake deleted file mode 100644 index 2e634844c5967..0000000000000 --- a/cpp/cmake_modules/FindPlasma.cmake +++ /dev/null @@ -1,102 +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. - -# - Find Plasma (plasma/client.h, libplasma.a, libplasma.so) -# -# This module requires Arrow from which it uses -# arrow_find_package() -# -# This module defines -# PLASMA_EXECUTABLE, deprecated. Use PLASMA_STORE_SERVER instead -# PLASMA_FOUND, whether Plasma has been found -# PLASMA_IMPORT_LIB, path to libplasma's import library (Windows only) -# PLASMA_INCLUDE_DIR, directory containing headers -# PLASMA_LIBS, deprecated. Use PLASMA_LIB_DIR instead -# PLASMA_LIB_DIR, directory containing Plasma libraries -# PLASMA_SHARED_IMP_LIB, deprecated. Use PLASMA_IMPORT_LIB instead -# PLASMA_SHARED_LIB, path to libplasma's shared library -# PLASMA_SO_VERSION, shared object version of found Plasma such as "100" -# PLASMA_STATIC_LIB, path to libplasma.a -# PLASMA_STORE_SERVER, path to plasma-store-server - -if(DEFINED PLASMA_FOUND) - return() -endif() - -set(find_package_arguments) -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - list(APPEND find_package_arguments REQUIRED) -endif() -if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND find_package_arguments QUIET) -endif() -find_package(Arrow ${find_package_arguments}) - -if(ARROW_FOUND) - arrow_find_package(PLASMA - "${ARROW_HOME}" - plasma - plasma/client.h - Plasma - plasma) - if(ARROW_HOME) - set(PLASMA_STORE_SERVER - ${ARROW_HOME}/bin/plasma-store-server${CMAKE_EXECUTABLE_SUFFIX}) - else() - if(PLASMA_USE_CMAKE_PACKAGE_CONFIG) - find_package(Plasma CONFIG) - elseif(PLASMA_USE_PKG_CONFIG) - pkg_get_variable(PLASMA_STORE_SERVER plasma plasma_store_server) - endif() - endif() - set(PLASMA_VERSION "${ARROW_VERSION}") - set(PLASMA_SO_VERSION "${ARROW_SO_VERSION}") - set(PLASMA_ABI_VERSION "${PLASMA_SO_VERSION}") - # For backward compatibility - set(PLASMA_EXECUTABLE "${PLASMA_STORE_SERVER}") - set(PLASMA_LIBS "${PLASMA_LIB_DIR}") -endif() - -mark_as_advanced(PLASMA_ABI_VERSION - PLASMA_EXECUTABLE - PLASMA_IMPORT_LIB - PLASMA_INCLUDE_DIR - PLASMA_LIBS - PLASMA_LIB_DIR - PLASMA_SHARED_IMP_LIB - PLASMA_SHARED_LIB - PLASMA_SO_VERSION - PLASMA_STATIC_LIB - PLASMA_STORE_SERVER - PLASMA_VERSION) - -find_package_handle_standard_args( - Plasma - REQUIRED_VARS PLASMA_INCLUDE_DIR PLASMA_LIB_DIR PLASMA_SO_VERSION PLASMA_STORE_SERVER - VERSION_VAR PLASMA_VERSION) -set(PLASMA_FOUND ${Plasma_FOUND}) - -if(Plasma_FOUND AND NOT Plasma_FIND_QUIETLY) - message(STATUS "Found the Plasma by ${PLASMA_FIND_APPROACH}") - message(STATUS "Found the plasma-store-server: ${PLASMA_STORE_SERVER}") - message(STATUS "Found the Plasma shared library: ${PLASMA_SHARED_LIB}") - message(STATUS "Found the Plasma import library: ${PLASMA_IMPORT_LIB}") - message(STATUS "Found the Plasma static library: ${PLASMA_STATIC_LIB}") -endif() diff --git a/cpp/cmake_modules/FindPython3Alt.cmake b/cpp/cmake_modules/FindPython3Alt.cmake index b003bb6a46f2a..0cc7fba399785 100644 --- a/cpp/cmake_modules/FindPython3Alt.cmake +++ b/cpp/cmake_modules/FindPython3Alt.cmake @@ -23,6 +23,10 @@ # - PYTHON_OTHER_LIBS # - NUMPY_INCLUDE_DIRS +if(Python3Alt_FOUND) + return() +endif() + set(Python3Alt_FIND_PACKAGE_OPTIONS) set(Python3Alt_NumPy_FIND_PACKAGE_OPTIONS) if(Python3Alt_FIND_VERSION) diff --git a/cpp/cmake_modules/FindRapidJSONAlt.cmake b/cpp/cmake_modules/FindRapidJSONAlt.cmake index 9a449a5280e59..ef5acf18b8223 100644 --- a/cpp/cmake_modules/FindRapidJSONAlt.cmake +++ b/cpp/cmake_modules/FindRapidJSONAlt.cmake @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. +if(RapidJSONAlt_FOUND) + return() +endif() + set(find_package_args) if(RapidJSONAlt_FIND_VERSION) list(APPEND find_package_args ${RapidJSONAlt_FIND_VERSION}) diff --git a/cpp/cmake_modules/FindSQLite3Alt.cmake b/cpp/cmake_modules/FindSQLite3Alt.cmake index 73a45f098c647..b60939841ef31 100644 --- a/cpp/cmake_modules/FindSQLite3Alt.cmake +++ b/cpp/cmake_modules/FindSQLite3Alt.cmake @@ -26,6 +26,10 @@ # Usage of this module as follows: # find_package(SQLite3Alt) +if(FindSQLite3Alt_FOUND) + return() +endif() + find_path(SQLite3_INCLUDE_DIR sqlite3.h) find_library(SQLite3_LIBRARY NAMES sqlite3) diff --git a/cpp/cmake_modules/FindSnappyAlt.cmake b/cpp/cmake_modules/FindSnappyAlt.cmake index aee5eac4bc72b..4d3134006471c 100644 --- a/cpp/cmake_modules/FindSnappyAlt.cmake +++ b/cpp/cmake_modules/FindSnappyAlt.cmake @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. +if(SnappyAlt_FOUND) + return() +endif() + set(find_package_args) if(SnappyAlt_FIND_VERSION) list(APPEND find_package_args ${SnappyAlt_FIND_VERSION}) diff --git a/cpp/cmake_modules/FindThrift.cmake b/cpp/cmake_modules/FindThrift.cmake index 07028971d9fcc..2f20a5cb59b2a 100644 --- a/cpp/cmake_modules/FindThrift.cmake +++ b/cpp/cmake_modules/FindThrift.cmake @@ -28,6 +28,10 @@ # thrift::thrift, a library target to use Thrift # thrift::compiler, a executable target to use Thrift compiler +if(Thrift_FOUND) + return() +endif() + function(EXTRACT_THRIFT_VERSION) if(THRIFT_INCLUDE_DIR) file(READ "${THRIFT_INCLUDE_DIR}/thrift/config.h" THRIFT_CONFIG_H_CONTENT) diff --git a/cpp/cmake_modules/Findc-aresAlt.cmake b/cpp/cmake_modules/Findc-aresAlt.cmake index 5213e8d12a1a5..152c843e373c5 100644 --- a/cpp/cmake_modules/Findc-aresAlt.cmake +++ b/cpp/cmake_modules/Findc-aresAlt.cmake @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. +if(c-aresAlt_FOUND) + return() +endif() + set(find_package_args) if(c-aresAlt_FIND_VERSION) list(APPEND find_package_args ${c-aresAlt_FIND_VERSION}) diff --git a/cpp/cmake_modules/FindgRPCAlt.cmake b/cpp/cmake_modules/FindgRPCAlt.cmake index 9bef477c13d0b..4e38605235b11 100644 --- a/cpp/cmake_modules/FindgRPCAlt.cmake +++ b/cpp/cmake_modules/FindgRPCAlt.cmake @@ -11,6 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +if(gRPCAlt_FOUND) + return() +endif() + set(find_package_args) if(gRPCAlt_FIND_VERSION) list(APPEND find_package_args ${gRPCAlt_FIND_VERSION}) diff --git a/cpp/cmake_modules/FindgflagsAlt.cmake b/cpp/cmake_modules/FindgflagsAlt.cmake index e092ea3e9b970..40733ee9bc480 100644 --- a/cpp/cmake_modules/FindgflagsAlt.cmake +++ b/cpp/cmake_modules/FindgflagsAlt.cmake @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. +if(gflagsAlt_FOUND) + return() +endif() + set(find_package_args) if(gflagsAlt_FIND_VERSION) list(APPEND find_package_args ${gflagsAlt_FIND_VERSION}) diff --git a/cpp/cmake_modules/Findjemalloc.cmake b/cpp/cmake_modules/Findjemalloc.cmake index db30f71d251b3..6f4c482c570f5 100644 --- a/cpp/cmake_modules/Findjemalloc.cmake +++ b/cpp/cmake_modules/Findjemalloc.cmake @@ -19,6 +19,10 @@ # This module defines # jemalloc::jemalloc, target to use jemalloc +if(jemalloc_FOUND) + return() +endif() + if(ARROW_JEMALLOC_USE_SHARED) set(jemalloc_LIB_NAMES) if(CMAKE_IMPORT_LIBRARY_SUFFIX) diff --git a/cpp/cmake_modules/Findlibrados.cmake b/cpp/cmake_modules/Findlibrados.cmake index 695d73fae1cb8..b993dbff114e9 100644 --- a/cpp/cmake_modules/Findlibrados.cmake +++ b/cpp/cmake_modules/Findlibrados.cmake @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. +if(librados_FOUND) + return() +endif() + find_path(LIBRADOS_INCLUDE_DIR rados/librados.hpp) find_library(LIBRADOS_LIBRARY NAMES rados) diff --git a/cpp/cmake_modules/Findlz4Alt.cmake b/cpp/cmake_modules/Findlz4Alt.cmake index 9fe8a31c1d490..77a22957f7964 100644 --- a/cpp/cmake_modules/Findlz4Alt.cmake +++ b/cpp/cmake_modules/Findlz4Alt.cmake @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. +if(lz4Alt_FOUND) + return() +endif() + set(find_package_args) if(lz4Alt_FIND_VERSION) list(APPEND find_package_args ${lz4Alt_FIND_VERSION}) diff --git a/cpp/cmake_modules/Findre2Alt.cmake b/cpp/cmake_modules/Findre2Alt.cmake index f66e35cf04692..1fe7a921f6bf0 100644 --- a/cpp/cmake_modules/Findre2Alt.cmake +++ b/cpp/cmake_modules/Findre2Alt.cmake @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. +if(re2Alt_FOUND) + return() +endif() + set(find_package_args) if(re2Alt_FIND_VERSION) list(APPEND find_package_args ${re2Alt_FIND_VERSION}) diff --git a/cpp/cmake_modules/Findutf8proc.cmake b/cpp/cmake_modules/Findutf8proc.cmake index 867361cd10478..2f0f59a02cdc1 100644 --- a/cpp/cmake_modules/Findutf8proc.cmake +++ b/cpp/cmake_modules/Findutf8proc.cmake @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. +if(utf8proc_FOUND) + return() +endif() + function(extract_utf8proc_version) if(utf8proc_INCLUDE_DIR) file(READ "${utf8proc_INCLUDE_DIR}/utf8proc.h" UTF8PROC_H_CONTENT) diff --git a/cpp/cmake_modules/Findzstd.cmake b/cpp/cmake_modules/Findzstd.cmake index 3fc14ec0d720d..d907467f94750 100644 --- a/cpp/cmake_modules/Findzstd.cmake +++ b/cpp/cmake_modules/Findzstd.cmake @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. +if(zstd_FOUND) + return() +endif() + if(MSVC AND NOT DEFINED ZSTD_MSVC_LIB_PREFIX) set(ZSTD_MSVC_LIB_PREFIX "lib") endif() diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index b904f3b62ece8..7c3e3a533229d 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -220,7 +220,7 @@ macro(provide_find_module PACKAGE_NAME) set(module_ "${CMAKE_SOURCE_DIR}/cmake_modules/Find${PACKAGE_NAME}.cmake") if(EXISTS "${module_}") message(STATUS "Providing CMake module for ${PACKAGE_NAME}") - install(FILES "${module_}" DESTINATION "${ARROW_CMAKE_DIR}") + install(FILES "${module_}" DESTINATION "${ARROW_CMAKE_DIR}/Arrow") endif() unset(module_) endmacro() @@ -1248,52 +1248,22 @@ if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) set(PARQUET_REQUIRE_ENCRYPTION OFF) endif() set(ARROW_OPENSSL_REQUIRED_VERSION "1.0.2") -if(BREW_BIN AND NOT OPENSSL_ROOT_DIR) - execute_process(COMMAND ${BREW_BIN} --prefix "openssl@1.1" - OUTPUT_VARIABLE OPENSSL11_BREW_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(OPENSSL11_BREW_PREFIX) - set(OPENSSL_ROOT_DIR ${OPENSSL11_BREW_PREFIX}) - else() - execute_process(COMMAND ${BREW_BIN} --prefix "openssl" - OUTPUT_VARIABLE OPENSSL_BREW_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(OPENSSL_BREW_PREFIX) - set(OPENSSL_ROOT_DIR ${OPENSSL_BREW_PREFIX}) - endif() - endif() -endif() - set(ARROW_USE_OPENSSL OFF) if(PARQUET_REQUIRE_ENCRYPTION OR ARROW_FLIGHT OR ARROW_S3) - # OpenSSL is required - if(ARROW_OPENSSL_USE_SHARED) - # Find shared OpenSSL libraries. - set(OpenSSL_USE_STATIC_LIBS OFF) - # Seems that different envs capitalize this differently? - set(OPENSSL_USE_STATIC_LIBS OFF) - set(BUILD_SHARED_LIBS_KEEP ${BUILD_SHARED_LIBS}) - set(BUILD_SHARED_LIBS ON) - - find_package(OpenSSL ${ARROW_OPENSSL_REQUIRED_VERSION} REQUIRED) - set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_KEEP}) - unset(BUILD_SHARED_LIBS_KEEP) - else() - # Find static OpenSSL headers and libs - set(OpenSSL_USE_STATIC_LIBS ON) - set(OPENSSL_USE_STATIC_LIBS ON) - find_package(OpenSSL ${ARROW_OPENSSL_REQUIRED_VERSION} REQUIRED) - endif() + set(OpenSSL_SOURCE "SYSTEM") + resolve_dependency(OpenSSL + HAVE_ALT + TRUE + REQUIRED_VERSION + ${ARROW_OPENSSL_REQUIRED_VERSION}) set(ARROW_USE_OPENSSL ON) endif() if(ARROW_USE_OPENSSL) message(STATUS "Found OpenSSL Crypto Library: ${OPENSSL_CRYPTO_LIBRARY}") message(STATUS "Building with OpenSSL (Version: ${OPENSSL_VERSION}) support") - - list(APPEND ARROW_SYSTEM_DEPENDENCIES OpenSSL) else() message(STATUS "Building without OpenSSL support. Minimum OpenSSL version ${ARROW_OPENSSL_REQUIRED_VERSION} required." ) @@ -1532,6 +1502,7 @@ macro(build_thrift) add_dependencies(toolchain thrift_ep) add_dependencies(thrift::thrift thrift_ep) set(Thrift_VERSION ${ARROW_THRIFT_BUILD_VERSION}) + set(THRIFT_VENDORED TRUE) list(APPEND ARROW_BUNDLED_STATIC_LIBS thrift::thrift) endmacro() @@ -4064,7 +4035,10 @@ macro(build_google_cloud_cpp_storage) # Curl is required on all platforms, but building it internally might also trip over S3's copy. # For now, force its inclusion from the underlying system or fail. find_curl() - find_package(OpenSSL ${ARROW_OPENSSL_REQUIRED_VERSION} REQUIRED) + if(NOT OpenSSL_FOUND) + resolve_dependency(OpenSSL HAVE_ALT REQUIRED_VERSION + ${ARROW_OPENSSL_REQUIRED_VERSION}) + endif() # Build google-cloud-cpp, with only storage_client diff --git a/cpp/examples/minimal_build/CMakeLists.txt b/cpp/examples/minimal_build/CMakeLists.txt index 420a7666f352c..6f4d9cefab4d6 100644 --- a/cpp/examples/minimal_build/CMakeLists.txt +++ b/cpp/examples/minimal_build/CMakeLists.txt @@ -40,9 +40,7 @@ message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}") add_executable(arrow-example example.cc) if(ARROW_LINK_SHARED) - target_link_libraries(arrow-example PRIVATE arrow_shared) + target_link_libraries(arrow-example PRIVATE Arrow::arrow_shared) else() - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries(arrow-example PRIVATE arrow_static Threads::Threads) + target_link_libraries(arrow-example PRIVATE Arrow::arrow_static) endif() diff --git a/cpp/examples/parquet/parquet_arrow/CMakeLists.txt b/cpp/examples/parquet/parquet_arrow/CMakeLists.txt index c89751731575f..63f009a8f6272 100644 --- a/cpp/examples/parquet/parquet_arrow/CMakeLists.txt +++ b/cpp/examples/parquet/parquet_arrow/CMakeLists.txt @@ -35,12 +35,11 @@ endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) # Look for installed packages the system -find_package(Arrow REQUIRED) find_package(Parquet REQUIRED) add_executable(parquet-arrow-example reader_writer.cc) if(PARQUET_LINK_SHARED) - target_link_libraries(parquet-arrow-example parquet_shared) + target_link_libraries(parquet-arrow-example Parquet::parquet_shared) else() - target_link_libraries(parquet-arrow-example parquet_static) + target_link_libraries(parquet-arrow-example Parquet::parquet_static) endif() diff --git a/cpp/src/arrow/ArrowConfig.cmake.in b/cpp/src/arrow/ArrowConfig.cmake.in index 44c8a66f67d14..83a0f849c486d 100644 --- a/cpp/src/arrow/ArrowConfig.cmake.in +++ b/cpp/src/arrow/ArrowConfig.cmake.in @@ -25,8 +25,8 @@ # # This config sets the following targets in your project:: # -# arrow_shared - for linked as shared library if shared library is built -# arrow_static - for linked as static library if static library is built +# Arrow::arrow_shared - for linked as shared library if shared library is built +# Arrow::arrow_static - for linked as static library if static library is built @PACKAGE_INIT@ @@ -34,61 +34,130 @@ set(ARROW_VERSION "@ARROW_VERSION@") set(ARROW_SO_VERSION "@ARROW_SO_VERSION@") set(ARROW_FULL_SO_VERSION "@ARROW_FULL_SO_VERSION@") -set(ARROW_LIBRARY_PATH_SUFFIXES "@ARROW_LIBRARY_PATH_SUFFIXES@") +set(ARROW_BUNDLED_STATIC_LIBS "@ARROW_BUNDLED_STATIC_LIBS@") set(ARROW_INCLUDE_PATH_SUFFIXES "@ARROW_INCLUDE_PATH_SUFFIXES@") +set(ARROW_LIBRARY_PATH_SUFFIXES "@ARROW_LIBRARY_PATH_SUFFIXES@") +set(ARROW_LLVM_VERSIONS "@ARROW_LLVM_VERSIONS@") +set(ARROW_LLVM_VERSION_PRIMARY_MAJOR "@ARROW_LLVM_VERSION_PRIMARY_MAJOR@") set(ARROW_SYSTEM_DEPENDENCIES "@ARROW_SYSTEM_DEPENDENCIES@") -set(ARROW_BUNDLED_STATIC_LIBS "@ARROW_BUNDLED_STATIC_LIBS@") -set(ARROW_STATIC_INSTALL_INTERFACE_LIBS "@ARROW_STATIC_INSTALL_INTERFACE_LIBS@") include("${CMAKE_CURRENT_LIST_DIR}/ArrowOptions.cmake") -include(CMakeFindDependencyMacro) +if(ARROW_BUILD_STATIC) + include(CMakeFindDependencyMacro) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_shared OR TARGET arrow_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowTargets.cmake") + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) + find_dependency(Threads) - if(TARGET arrow_static) - set(CMAKE_THREAD_PREFER_PTHREAD TRUE) - set(THREADS_PREFER_PTHREAD_FLAG TRUE) - find_dependency(Threads) + if(DEFINED CMAKE_MODULE_PATH) + set(_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH}) + endif() + set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") - if(DEFINED CMAKE_MODULE_PATH) - set(_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH}) + foreach(_DEPENDENCY ${ARROW_SYSTEM_DEPENDENCIES}) + set(ARROW_OPENSSL_HOMEBREW_MAKE_DETECTABLE FALSE) + if(${_DEPENDENCY} STREQUAL "OpenSSL" AND NOT OPENSSL_ROOT_DIR) + find_program(ARROW_BREW brew) + if(ARROW_BREW) + set(ARROW_OPENSSL_ROOT_DIR_ORIGINAL ${OPENSSL_ROOT_DIR}) + execute_process(COMMAND ${ARROW_BREW} --prefix "openssl@1.1" + OUTPUT_VARIABLE OPENSSL11_BREW_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(OPENSSL11_BREW_PREFIX) + set(OPENSSL_ROOT_DIR ${OPENSSL11_BREW_PREFIX}) + set(ARROW_OPENSSL_HOMEBREW_MAKE_DETECTABLE TRUE) + else() + execute_process(COMMAND ${ARROW_BREW} --prefix "openssl" + OUTPUT_VARIABLE OPENSSL_BREW_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(OPENSSL_BREW_PREFIX) + set(OPENSSL_ROOT_DIR ${OPENSSL_BREW_PREFIX}) + set(ARROW_OPENSSL_HOMEBREW_MAKE_DETECTABLE TRUE) + endif() + endif() + endif() + endif() + find_dependency(${_DEPENDENCY}) + if(ARROW_OPENSSL_HOMEBREW_MAKE_DETECTABLE) + set(OPENSSL_ROOT_DIR ${ARROW_OPENSSL_ROOT_DIR_ORIGINAL}) endif() - set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + endforeach() - foreach(_DEPENDENCY ${ARROW_SYSTEM_DEPENDENCIES}) - find_dependency(${_DEPENDENCY}) - endforeach() + if(DEFINED _CMAKE_MODULE_PATH_OLD) + set(CMAKE_MODULE_PATH ${_CMAKE_MODULE_PATH_OLD}) + unset(_CMAKE_MODULE_PATH_OLD) + else() + unset(CMAKE_MODULE_PATH) + endif() +endif() - if(DEFINED _CMAKE_MODULE_PATH_OLD) - set(CMAKE_MODULE_PATH ${_CMAKE_MODULE_PATH_OLD}) - unset(_CMAKE_MODULE_PATH_OLD) - else() - unset(CMAKE_MODULE_PATH) - endif() +include("${CMAKE_CURRENT_LIST_DIR}/ArrowTargets.cmake") + +if(TARGET Arrow::arrow_static AND NOT TARGET Arrow::arrow_bundled_dependencies) + add_library(Arrow::arrow_bundled_dependencies STATIC IMPORTED) + get_target_property(arrow_static_location Arrow::arrow_static LOCATION) + get_filename_component(arrow_lib_dir "${arrow_static_location}" DIRECTORY) + set_target_properties(Arrow::arrow_bundled_dependencies + PROPERTIES IMPORTED_LOCATION + "${arrow_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) +endif() - get_property(arrow_static_loc TARGET arrow_static PROPERTY LOCATION) - get_filename_component(arrow_lib_dir ${arrow_static_loc} DIRECTORY) - - if(ARROW_BUNDLED_STATIC_LIBS) - add_library(arrow_bundled_dependencies STATIC IMPORTED) - set_target_properties( - arrow_bundled_dependencies - PROPERTIES - IMPORTED_LOCATION - "${arrow_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}" - INTERFACE_LINK_LIBRARIES - "${ARROW_STATIC_INSTALL_INTERFACE_LIBS}" - ) - get_property(arrow_static_interface_link_libraries - TARGET arrow_static - PROPERTY INTERFACE_LINK_LIBRARIES) - set_target_properties( - arrow_static PROPERTIES INTERFACE_LINK_LIBRARIES - "${arrow_static_interface_link_libraries};arrow_bundled_dependencies") +macro(arrow_keep_backward_compatibility namespace target_base_name) + string(TOUPPER ${target_base_name} target_base_name_upper) + + if(NOT CMAKE_VERSION VERSION_LESS 3.18) + if(TARGET ${namespace}::${target_base_name} AND NOT TARGET ${target_base_name}_shared) + add_library(${target_base_name}_shared ALIAS + ${namespace}::${target_base_name}_shared) + endif() + if(TARGET ${namespace}::${target_base_name}_static AND NOT TARGET + ${target_base_name}_static) + add_library(${target_base_name}_static ALIAS + ${namespace}::${target_base_name}_static) endif() endif() -endif() + + if(TARGET ${namespace}::${target_base_name}_shared) + get_target_property(${target_base_name_upper}_INCLUDE_DIR + ${namespace}::${target_base_name}_shared + INTERFACE_INCLUDE_DIRECTORIES) + else() + get_target_property(${target_base_name_upper}_INCLUDE_DIR + ${namespace}::${target_base_name}_static + INTERFACE_INCLUDE_DIRECTORIES) + endif() + + foreach(BUILD_TYPE_SUFFIX + "_RELEASE" + "_RELWITHDEBINFO" + "_MINSIZEREL" + "_DEBUG" + "") + if(TARGET ${namespace}::${target_base_name}_shared) + if(NOT ${target_base_name_upper}_SHARED_LIB) + get_target_property(${target_base_name_upper}_SHARED_LIB + ${namespace}::${target_base_name}_shared + IMPORTED_LOCATION${BUILD_TYPE_SUFFIX}) + endif() + if(NOT ${target_base_name_upper}_IMPORT_LIB) + get_target_property(${target_base_name_upper}_IMPORT_LIB + ${namespace}::${target_base_name}_shared + IMPORTED_IMPLIB${BUILD_TYPE_SUFFIX}) + endif() + endif() + + if(TARGET ${namespace}::${target_base_name}_static) + if(NOT ${target_base_name_upper}_STATIC_LIB) + get_target_property(${target_base_name_upper}_STATIC_LIB + ${namespace}::${target_base_name}_static + IMPORTED_LOCATION${BUILD_TYPE_SUFFIX}) + endif() + endif() + endforeach() +endmacro() + +arrow_keep_backward_compatibility(Arrow arrow) + +check_required_components(Arrow) diff --git a/cpp/src/arrow/ArrowTestingConfig.cmake.in b/cpp/src/arrow/ArrowTestingConfig.cmake.in index 2b5548c8b1abd..03775b043ed83 100644 --- a/cpp/src/arrow/ArrowTestingConfig.cmake.in +++ b/cpp/src/arrow/ArrowTestingConfig.cmake.in @@ -21,16 +21,16 @@ # # This config sets the following targets in your project:: # -# arrow_testing_shared - for linked as shared library if shared library is built -# arrow_testing_static - for linked as static library if static library is built +# ArrowTesting::arrow_testing_shared - for linked as shared library if shared library is built +# ArrowTesting::arrow_testing_static - for linked as static library if static library is built @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(Arrow) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_testing_shared OR TARGET arrow_testing_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowTestingTargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/ArrowTestingTargets.cmake") + +arrow_keep_backward_compatibility(ArrowTesting arrow_testing) + +check_required_components(ArrowTesting) diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index 1e30e50a31700..2cae7a731f9d7 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -551,7 +551,23 @@ else() endif() if(ARROW_BUILD_BUNDLED_DEPENDENCIES) + arrow_car(_FIRST_LIB ${ARROW_BUNDLED_STATIC_LIBS}) + arrow_cdr(_OTHER_LIBS ${ARROW_BUNDLED_STATIC_LIBS}) + arrow_create_merged_static_lib(arrow_bundled_dependencies + NAME + arrow_bundled_dependencies + ROOT + ${_FIRST_LIB} + TO_MERGE + ${_OTHER_LIBS}) + # We can't use install(TARGETS) here because + # arrow_bundled_dependencies is an IMPORTED library. + get_target_property(arrow_bundled_dependencies_path arrow_bundled_dependencies + IMPORTED_LOCATION) + install(FILES ${arrow_bundled_dependencies_path} ${INSTALL_IS_OPTIONAL} + DESTINATION ${CMAKE_INSTALL_LIBDIR}) string(APPEND ARROW_PC_LIBS_PRIVATE " -larrow_bundled_dependencies") + list(INSERT ARROW_STATIC_INSTALL_INTERFACE_LIBS 0 "Arrow::arrow_bundled_dependencies") endif() # Need -latomic on Raspbian. # See also: https://issues.apache.org/jira/browse/ARROW-12860 @@ -575,11 +591,12 @@ add_arrow_lib(arrow SHARED_LINK_FLAGS ${ARROW_SHARED_LINK_FLAGS} SHARED_LINK_LIBS - ${ARROW_LINK_LIBS} + ${ARROW_SHARED_LINK_LIBS} SHARED_PRIVATE_LINK_LIBS ${ARROW_SHARED_PRIVATE_LINK_LIBS} STATIC_LINK_LIBS ${ARROW_STATIC_LINK_LIBS} + STATIC_INSTALL_INTERFACE_LIBS ${ARROW_STATIC_INSTALL_INTERFACE_LIBS} SHARED_INSTALL_INTERFACE_LIBS ${ARROW_SHARED_INSTALL_INTERFACE_LIBS}) @@ -631,18 +648,6 @@ if(ARROW_WITH_BACKTRACE) endforeach() endif() -if(ARROW_BUILD_BUNDLED_DEPENDENCIES) - arrow_car(_FIRST_LIB ${ARROW_BUNDLED_STATIC_LIBS}) - arrow_cdr(_OTHER_LIBS ${ARROW_BUNDLED_STATIC_LIBS}) - create_merged_static_lib(arrow_bundled_dependencies - NAME - arrow_bundled_dependencies - ROOT - ${_FIRST_LIB} - TO_MERGE - ${_OTHER_LIBS}) -endif() - if(ARROW_TESTING) # that depend on gtest add_arrow_lib(arrow_testing @@ -663,10 +668,16 @@ if(ARROW_TESTING) rapidjson::rapidjson arrow_shared GTest::gtest + SHARED_INSTALL_INTERFACE_LIBS + Arrow::arrow_shared + GTest::gtest STATIC_LINK_LIBS arrow::flatbuffers rapidjson::rapidjson arrow_static + GTest::gtest + STATIC_INSTALL_INTERFACE_LIBS + Arrow::arrow_static GTest::gtest) add_custom_target(arrow_testing) @@ -685,11 +696,11 @@ arrow_install_all_headers("arrow") config_summary_cmake_setters("${CMAKE_CURRENT_BINARY_DIR}/ArrowOptions.cmake") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ArrowOptions.cmake - DESTINATION "${ARROW_CMAKE_DIR}") + DESTINATION "${ARROW_CMAKE_DIR}/Arrow") # For backward compatibility for find_package(arrow) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arrow-config.cmake - DESTINATION "${ARROW_CMAKE_DIR}") + DESTINATION "${ARROW_CMAKE_DIR}/Arrow") # # Unit tests diff --git a/cpp/src/arrow/dataset/ArrowDatasetConfig.cmake.in b/cpp/src/arrow/dataset/ArrowDatasetConfig.cmake.in index ee732cfd5bed9..38b9baf408926 100644 --- a/cpp/src/arrow/dataset/ArrowDatasetConfig.cmake.in +++ b/cpp/src/arrow/dataset/ArrowDatasetConfig.cmake.in @@ -21,8 +21,8 @@ # # This config sets the following targets in your project:: # -# arrow_dataset_shared - for linked as shared library if shared library is built -# arrow_dataset_static - for linked as static library if static library is built +# ArrowDataset::arrow_dataset_shared - for linked as shared library if shared library is built +# ArrowDataset::arrow_dataset_static - for linked as static library if static library is built @PACKAGE_INIT@ @@ -30,8 +30,8 @@ include(CMakeFindDependencyMacro) find_dependency(Arrow) find_dependency(Parquet) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_dataset_shared OR TARGET arrow_dataset_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowDatasetTargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/ArrowDatasetTargets.cmake") + +arrow_keep_backward_compatibility(ArrowDataset arrow_dataset) + +check_required_components(ArrowDataset) diff --git a/cpp/src/arrow/dataset/CMakeLists.txt b/cpp/src/arrow/dataset/CMakeLists.txt index 478c13691b03a..2b164269ce619 100644 --- a/cpp/src/arrow/dataset/CMakeLists.txt +++ b/cpp/src/arrow/dataset/CMakeLists.txt @@ -30,8 +30,10 @@ set(ARROW_DATASET_SRCS projector.cc scanner.cc) -set(ARROW_DATASET_LINK_STATIC arrow_static ${ARROW_STATIC_LINK_LIBS}) -set(ARROW_DATASET_LINK_SHARED arrow_shared) +set(ARROW_DATASET_STATIC_LINK_LIBS) +set(ARROW_DATASET_SHARED_LINK_LIBS) +set(ARROW_DATASET_STATIC_INSTALL_INTERFACE_LIBS) +set(ARROW_DATASET_SHARED_INSTALL_INTERFACE_LIBS) if(ARROW_CSV) set(ARROW_DATASET_SRCS ${ARROW_DATASET_SRCS} file_csv.cc) @@ -42,12 +44,20 @@ if(ARROW_ORC) endif() if(ARROW_PARQUET) - set(ARROW_DATASET_LINK_STATIC ${ARROW_DATASET_LINK_STATIC} parquet_static) - set(ARROW_DATASET_LINK_SHARED ${ARROW_DATASET_LINK_SHARED} parquet_shared) - set(ARROW_DATASET_SRCS ${ARROW_DATASET_SRCS} file_parquet.cc) - set(ARROW_DATASET_PRIVATE_INCLUDES ${PROJECT_SOURCE_DIR}/src/parquet) + list(APPEND ARROW_DATASET_STATIC_LINK_LIBS parquet_static) + list(APPEND ARROW_DATASET_SHARED_LINK_LIBS parquet_shared) + list(APPEND ARROW_DATASET_STATIC_INSTALL_INTERFACE_LIBS Parquet::parquet_static) + list(APPEND ARROW_DATASET_SHARED_INSTALL_INTERFACE_LIBS Parquet::parquet_shared) + list(APPEND ARROW_DATASET_SRCS file_parquet.cc) + list(APPEND ARROW_DATASET_PRIVATE_INCLUDES ${PROJECT_SOURCE_DIR}/src/parquet) +else() + list(APPEND ARROW_DATASET_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static) + list(APPEND ARROW_DATASET_SHARED_INSTALL_INTERFACE_LIBS Arrow::arrow_shared) endif() +list(APPEND ARROW_DATASET_STATIC_LINK_LIBS arrow_static ${ARROW_STATIC_LINK_LIBS}) +list(APPEND ARROW_DATASET_SHARED_LINK_LIBS arrow_shared) + add_arrow_lib(arrow_dataset CMAKE_PACKAGE_NAME ArrowDataset @@ -64,9 +74,13 @@ add_arrow_lib(arrow_dataset PRIVATE_INCLUDES ${ARROW_DATASET_PRIVATE_INCLUDES} SHARED_LINK_LIBS - ${ARROW_DATASET_LINK_SHARED} + ${ARROW_DATASET_SHARED_LINK_LIBS} + SHARED_INSTALL_INTERFACE_LIBS + ${ARROW_DATASET_SHARED_INSTALL_INTERFACE_LIBS} STATIC_LINK_LIBS - ${ARROW_DATASET_LINK_STATIC}) + ${ARROW_DATASET_STATIC_LINK_LIBS} + STATIC_INSTALL_INTERFACE_LIBS + ${ARROW_DATASET_STATIC_INSTALL_INTERFACE_LIBS}) if(ARROW_TEST_LINKAGE STREQUAL "static") set(ARROW_DATASET_TEST_LINK_LIBS arrow_dataset_static ${ARROW_TEST_STATIC_LINK_LIBS}) diff --git a/cpp/src/arrow/engine/ArrowSubstraitConfig.cmake.in b/cpp/src/arrow/engine/ArrowSubstraitConfig.cmake.in index a796ab4e8af2c..2263c735d26ce 100644 --- a/cpp/src/arrow/engine/ArrowSubstraitConfig.cmake.in +++ b/cpp/src/arrow/engine/ArrowSubstraitConfig.cmake.in @@ -21,8 +21,8 @@ # # This config sets the following targets in your project:: # -# arrow_substrait_shared - for linked as shared library if shared library is built -# arrow_substrait_static - for linked as static library if static library is built +# ArrowSubstrait::arrow_substrait_shared - for linked as shared library if shared library is built +# ArrowSubstrait::arrow_substrait_static - for linked as static library if static library is built @PACKAGE_INIT@ @@ -31,8 +31,8 @@ find_dependency(Arrow) find_dependency(ArrowDataset) find_dependency(Parquet) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_substrait_shared OR TARGET arrow_substrait_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowSubstraitTargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/ArrowSubstraitTargets.cmake") + +arrow_keep_backward_compatibility(ArrowSubstrait arrow_substrait) + +check_required_components(ArrowSubstrait) diff --git a/cpp/src/arrow/engine/CMakeLists.txt b/cpp/src/arrow/engine/CMakeLists.txt index 4109b7b3bcdf3..a8d5be90af872 100644 --- a/cpp/src/arrow/engine/CMakeLists.txt +++ b/cpp/src/arrow/engine/CMakeLists.txt @@ -44,13 +44,15 @@ add_arrow_lib(arrow_substrait SHARED_LINK_FLAGS ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt SHARED_LINK_LIBS - arrow_shared arrow_dataset_shared substrait + SHARED_INSTALL_INTERFACE_LIBS + ArrowDataset::arrow_dataset_shared STATIC_LINK_LIBS - arrow_static arrow_dataset_static substrait + STATIC_INSTALL_INTERFACE_LIBS + ArrowDataset::arrow_dataset_static PRIVATE_INCLUDES ${SUBSTRAIT_INCLUDES}) diff --git a/cpp/src/arrow/flight/ArrowFlightConfig.cmake.in b/cpp/src/arrow/flight/ArrowFlightConfig.cmake.in index 11be4579477a1..04560f91e08ce 100644 --- a/cpp/src/arrow/flight/ArrowFlightConfig.cmake.in +++ b/cpp/src/arrow/flight/ArrowFlightConfig.cmake.in @@ -21,16 +21,16 @@ # # This config sets the following targets in your project:: # -# arrow_flight_shared - for linked as shared library if shared library is built -# arrow_flight_static - for linked as static library if static library is built +# ArrowFlight::arrow_flight_shared - for linked as shared library if shared library is built +# ArrowFlight::arrow_flight_static - for linked as static library if static library is built @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(Arrow) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_flight_shared OR TARGET arrow_flight_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowFlightTargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/ArrowFlightTargets.cmake") + +arrow_keep_backward_compatibility(ArrowFlight arrow_flight) + +check_required_components(ArrowFlight) diff --git a/cpp/src/arrow/flight/ArrowFlightTestingConfig.cmake.in b/cpp/src/arrow/flight/ArrowFlightTestingConfig.cmake.in index f3e1a63d6abd9..0c42c5c1ff837 100644 --- a/cpp/src/arrow/flight/ArrowFlightTestingConfig.cmake.in +++ b/cpp/src/arrow/flight/ArrowFlightTestingConfig.cmake.in @@ -21,8 +21,8 @@ # # This config sets the following targets in your project:: # -# arrow_flight_testing_shared - for linked as shared library if shared library is built -# arrow_flight_testing_static - for linked as static library if static library is built +# ArrowFlightTesting::arrow_flight_testing_shared - for linked as shared library if shared library is built +# ArrowFlightTesting::arrow_flight_testing_static - for linked as static library if static library is built @PACKAGE_INIT@ @@ -30,8 +30,8 @@ include(CMakeFindDependencyMacro) find_dependency(ArrowFlight) find_dependency(ArrowTesting) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_flight_testing_shared OR TARGET arrow_flight_testing_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowFlightTestingTargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/ArrowFlightTestingTargets.cmake") + +arrow_keep_backward_compatibility(ArrowFlightTetsing arrow_flight_testing) + +check_required_components(ArrowFlightTesting) diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt index a4bb287dfeb18..212db853d6682 100644 --- a/cpp/src/arrow/flight/CMakeLists.txt +++ b/cpp/src/arrow/flight/CMakeLists.txt @@ -228,9 +228,13 @@ add_arrow_lib(arrow_flight SHARED_LINK_LIBS arrow_shared ${ARROW_FLIGHT_LINK_LIBS} + SHARED_INSTALL_INTERFACE_LIBS + Arrow::arrow_shared STATIC_LINK_LIBS arrow_static - ${ARROW_FLIGHT_LINK_LIBS}) + ${ARROW_FLIGHT_LINK_LIBS} + STATIC_INSTALL_INTERFACE_LIBS + Arrow::arrow_static) foreach(LIB_TARGET ${ARROW_FLIGHT_LIBRARIES}) target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_EXPORTING) @@ -239,21 +243,41 @@ endforeach() # Define arrow_flight_testing library if(ARROW_TESTING) if(ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC) - set(ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_shared arrow_flight_shared) - set(ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_static arrow_flight_static) + set(ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_flight_shared) + set(ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_flight_static) + set(ARROW_FLIGHT_TESTING_SHARED_INSTALL_INTERFACE_LIBS + ArrowFlight::arrow_flight_shared) + set(ARROW_FLIGHT_TESTING_STATIC_INSTALL_INTERFACE_LIBS + ArrowFlight::arrow_flight_static) elseif(ARROW_BUILD_SHARED) - set(ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_shared arrow_flight_shared) - set(ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_shared arrow_flight_shared) + set(ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_flight_shared) + set(ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_flight_shared) + set(ARROW_FLIGHT_TESTING_SHARED_INSTALL_INTERFACE_LIBS + ArrowFlight::arrow_flight_shared) + set(ARROW_FLIGHT_TESTING_STATIC_INSTALL_INTERFACE_LIBS + ArrowFlight::arrow_flight_shared) else() - set(ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_static arrow_flight_static) - set(ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_static arrow_flight_static) + set(ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_flight_static) + set(ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_flight_static) + set(ARROW_FLIGHT_TESTING_SHARED_INSTALL_INTERFACE_LIBS + ArrowFlight::arrow_flight_static) + set(ARROW_FLIGHT_TESTING_STATIC_INSTALL_INTERFACE_LIBS + ArrowFlight::arrow_flight_static) endif() if(ARROW_TEST_LINKAGE STREQUAL "shared") list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_testing_shared) list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_testing_shared) + list(APPEND ARROW_FLIGHT_TESTING_SHARED_INSTALL_INTERFACE_LIBS + ArrowTesting::arrow_testing_shared) + list(APPEND ARROW_FLIGHT_TESTING_STATIC_INSTALL_INTERFACE_LIBS + ArrowTesting::arrow_testing_shared) else() list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS arrow_testing_static) list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS arrow_testing_static) + list(APPEND ARROW_FLIGHT_TESTING_SHARED_INSTALL_INTERFACE_LIBS + ArrowTesting::arrow_testing_static) + list(APPEND ARROW_FLIGHT_TESTING_STATIC_INSTALL_INTERFACE_LIBS + ArrowTesting::arrow_testing_static) endif() list(APPEND ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS ${ARROW_FLIGHT_TEST_INTERFACE_LIBS}) list(APPEND ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS ${ARROW_FLIGHT_TEST_INTERFACE_LIBS}) @@ -273,8 +297,12 @@ if(ARROW_TESTING) arrow_dependencies SHARED_LINK_LIBS ${ARROW_FLIGHT_TESTING_SHARED_LINK_LIBS} + SHARED_INSTALL_INTERFACE_LIBS + ${ARROW_FLIGHT_TESTING_SHARED_INSTALL_INTERFACE_LIBS} STATIC_LINK_LIBS ${ARROW_FLIGHT_TESTING_STATIC_LINK_LIBS} + STATIC_INSTALL_INTERFACE_LIBS + ${ARROW_FLIGHT_TESTING_STATIC_INSTALL_INTERFACE_LIBS} PRIVATE_INCLUDES "${Protobuf_INCLUDE_DIRS}") diff --git a/cpp/src/arrow/flight/sql/ArrowFlightSqlConfig.cmake.in b/cpp/src/arrow/flight/sql/ArrowFlightSqlConfig.cmake.in index 1658f44f4188e..9d0e9ea2dac9e 100644 --- a/cpp/src/arrow/flight/sql/ArrowFlightSqlConfig.cmake.in +++ b/cpp/src/arrow/flight/sql/ArrowFlightSqlConfig.cmake.in @@ -21,16 +21,16 @@ # # This config sets the following targets in your project:: # -# arrow_flight_sql_shared - for linked as shared library if shared library is built -# arrow_flight_sql_static - for linked as static library if static library is built +# ArrowFlightSql::arrow_flight_sql_shared - for linked as shared library if shared library is built +# ArrowFlightSql::arrow_flight_sql_static - for linked as static library if static library is built @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(ArrowFlight) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_flight_sql_shared OR TARGET arrow_flight_sql_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowFlightSqlTargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/ArrowFlightSqlTargets.cmake") + +arrow_keep_backward_compatibility(ArrowFlightSql arrow_flight_sql) + +check_required_components(ArrowFlightSql) diff --git a/cpp/src/arrow/flight/transport/ucx/CMakeLists.txt b/cpp/src/arrow/flight/transport/ucx/CMakeLists.txt index d682ead6336bd..75a21d5e5c01e 100644 --- a/cpp/src/arrow/flight/transport/ucx/CMakeLists.txt +++ b/cpp/src/arrow/flight/transport/ucx/CMakeLists.txt @@ -38,11 +38,9 @@ add_arrow_lib(arrow_flight_transport_ucx SHARED_LINK_FLAGS ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt SHARED_LINK_LIBS - arrow_shared arrow_flight_shared ucx::ucx STATIC_LINK_LIBS - arrow_static arrow_flight_static ucx::ucx) diff --git a/cpp/src/arrow/gpu/ArrowCUDAConfig.cmake.in b/cpp/src/arrow/gpu/ArrowCUDAConfig.cmake.in index 67bb58093fb85..e987d82a3a1fa 100644 --- a/cpp/src/arrow/gpu/ArrowCUDAConfig.cmake.in +++ b/cpp/src/arrow/gpu/ArrowCUDAConfig.cmake.in @@ -21,16 +21,16 @@ # # This config sets the following targets in your project:: # -# arrow_cuda_shared - for linked as shared library if shared library is built -# arrow_cuda_static - for linked as static library if static library is built +# ArrowCUDA::arrow_cuda_shared - for linked as shared library if shared library is built +# ArrowCUDA::arrow_cuda_static - for linked as static library if static library is built @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(Arrow) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_cuda_shared OR TARGET arrow_cuda_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowCUDATargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/ArrowCUDATargets.cmake") + +arrow_keep_backward_compatibility(ArrowCUDA arrow_cuda) + +check_required_components(ArrowCUDA) diff --git a/cpp/src/arrow/gpu/CMakeLists.txt b/cpp/src/arrow/gpu/CMakeLists.txt index 934a11f810c84..00265a8fc1f87 100644 --- a/cpp/src/arrow/gpu/CMakeLists.txt +++ b/cpp/src/arrow/gpu/CMakeLists.txt @@ -59,9 +59,14 @@ add_arrow_lib(arrow_cuda arrow_shared ${ARROW_CUDA_LINK_LIBS} ${ARROW_CUDA_SHARED_LINK_LIBS} + SHARED_INSTALL_INTERFACE_LIBS + Arrow::arrow_shared # Static arrow_cuda must also link against CUDA shared libs STATIC_LINK_LIBS ${ARROW_CUDA_LINK_LIBS} + ${ARROW_CUDA_SHARED_LINK_LIBS} + STATIC_INSTALL_INTERFACE_LIBS + Arrow::arrow_static ${ARROW_CUDA_SHARED_LINK_LIBS}) add_dependencies(arrow_cuda ${ARROW_CUDA_LIBRARIES}) diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt index 56c416ffb43fc..3794b7a6c435c 100644 --- a/cpp/src/gandiva/CMakeLists.txt +++ b/cpp/src/gandiva/CMakeLists.txt @@ -97,10 +97,20 @@ set(SRC_FILES random_generator_holder.cc ${GANDIVA_PRECOMPILED_CC_PATH}) -set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared LLVM::LLVM_INTERFACE - ${GANDIVA_OPENSSL_LIBS} Boost::headers) -set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_INTERFACE ${GANDIVA_OPENSSL_LIBS} - Boost::headers) +set(GANDIVA_OPENSSL_LIBS OpenSSL::Crypto OpenSSL::SSL) +if(WIN32 AND NOT CMAKE_VERSION VERSION_LESS 3.18) + list(APPEND GANDIVA_OPENSSL_TARGETS 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} + Boost::headers) +set(GANDIVA_STATIC_LINK_LIBS + arrow_static + LLVM::LLVM_HEADERS + LLVM::LLVM_LIBS + ${GANDIVA_OPENSSL_TARGETS} + Boost::headers) if(ARROW_WITH_RE2) list(APPEND GANDIVA_SHARED_PRIVATE_LINK_LIBS re2::re2) list(APPEND GANDIVA_STATIC_LINK_LIBS re2::re2) @@ -109,10 +119,6 @@ if(ARROW_WITH_UTF8PROC) list(APPEND GANDIVA_SHARED_PRIVATE_LINK_LIBS utf8proc::utf8proc) list(APPEND GANDIVA_STATIC_LINK_LIBS utf8proc::utf8proc) endif() -if(ARROW_USE_XSIMD) - list(APPEND GANDIVA_SHARED_PRIVATE_LINK_LIBS xsimd) - list(APPEND GANDIVA_STATIC_LINK_LIBS xsimd) -endif() if(ARROW_GANDIVA_STATIC_LIBSTDCPP AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )) @@ -149,18 +155,20 @@ add_arrow_lib(gandiva DEPENDENCIES arrow_dependencies precompiled - EXTRA_INCLUDES - $ - ${GANDIVA_OPENSSL_INCLUDE_DIR} - ${UTF8PROC_INCLUDE_DIR} SHARED_LINK_FLAGS ${GANDIVA_SHARED_LINK_FLAGS} SHARED_LINK_LIBS - arrow_shared + ${GANDIVA_SHARED_LINK_LIBS} SHARED_PRIVATE_LINK_LIBS ${GANDIVA_SHARED_PRIVATE_LINK_LIBS} + SHARED_INSTALL_INTERFACE_LIBS + Arrow::arrow_shared + LLVM::LLVM_HEADERS STATIC_LINK_LIBS - ${GANDIVA_STATIC_LINK_LIBS}) + ${GANDIVA_STATIC_LINK_LIBS} + STATIC_INSTALL_INTERFACE_LIBS + Arrow::arrow_static + LLVM::LLVM_HEADERS) foreach(LIB_TARGET ${GANDIVA_LIBRARIES}) target_compile_definitions(${LIB_TARGET} PRIVATE GANDIVA_EXPORTING) @@ -176,8 +184,15 @@ 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}) +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 LLVM::LLVM_LIBS ${GANDIVA_OPENSSL_TARGETS}) +endif() function(ADD_GANDIVA_TEST REL_TEST_NAME) set(options USE_STATIC_LINKING) @@ -222,14 +237,6 @@ function(ADD_GANDIVA_TEST REL_TEST_NAME) set_target_properties(${TEST_NAME} PROPERTIES CXX_STANDARD ${GANDIVA_CXX_STANDARD}) endfunction() -set(GANDIVA_INTERNALS_TEST_ARGUMENTS) -if(WIN32) - list(APPEND - GANDIVA_INTERNALS_TEST_ARGUMENTS - EXTRA_LINK_LIBS - LLVM::LLVM_INTERFACE - ${GANDIVA_OPENSSL_LIBS}) -endif() add_gandiva_test(internals-test SOURCES bitmap_accumulator_test.cc @@ -252,15 +259,7 @@ add_gandiva_test(internals-test random_generator_holder_test.cc hash_utils_test.cc gdv_function_stubs_test.cc - interval_holder_test.cc - EXTRA_DEPENDENCIES - LLVM::LLVM_INTERFACE - ${GANDIVA_OPENSSL_LIBS} - EXTRA_INCLUDES - $ - ${GANDIVA_INTERNALS_TEST_ARGUMENTS} - ${GANDIVA_OPENSSL_INCLUDE_DIR} - ${UTF8PROC_INCLUDE_DIR}) + interval_holder_test.cc) if(ARROW_GANDIVA_JAVA) add_subdirectory(jni) diff --git a/cpp/src/gandiva/GandivaConfig.cmake.in b/cpp/src/gandiva/GandivaConfig.cmake.in index 09bc339017706..861166dc3d9fc 100644 --- a/cpp/src/gandiva/GandivaConfig.cmake.in +++ b/cpp/src/gandiva/GandivaConfig.cmake.in @@ -21,16 +21,17 @@ # # This config sets the following targets in your project:: # -# gandiva_shared - for linked as shared library if shared library is built -# gandiva_static - for linked as static library if static library is built +# Gandiva::gandiva_shared - for linked as shared library if shared library is built +# Gandiva::gandiva_static - for linked as static library if static library is built @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(Arrow) +find_dependency(LLVMAlt) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET gandiva_shared OR TARGET gandiva_static)) - include("${CMAKE_CURRENT_LIST_DIR}/GandivaTargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/GandivaTargets.cmake") + +arrow_keep_backward_compatibility(Gandiva gandiva) + +check_required_components(Gandiva) diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt index caed261734280..bd5c5f172afb5 100644 --- a/cpp/src/parquet/CMakeLists.txt +++ b/cpp/src/parquet/CMakeLists.txt @@ -106,11 +106,11 @@ endfunction() if(ARROW_BUILD_STATIC) set(PARQUET_STATIC_LINK_LIBS arrow_static ${ARROW_STATIC_LINK_LIBS}) - set(PARQUET_STATIC_INTERFACE_INSTALL_LIBS arrow_static) + set(PARQUET_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static) set(ARROW_LIBRARIES_FOR_STATIC_TESTS arrow_testing_static arrow_static ${ARROW_STATIC_LINK_LIBS}) else() - set(PARQUET_STATIC_INTERFACE_INSTALL_LIBS) + set(PARQUET_STATIC_INSTALL_INTERFACE_LIBS) set(ARROW_LIBRARIES_FOR_STATIC_TESTS arrow_testing_shared arrow_shared) endif() @@ -221,7 +221,9 @@ if(NOT PARQUET_MINIMAL_DEPENDENCY) # Link publicly with parquet_static (because internal users need to # transitively link all dependencies) list(APPEND PARQUET_STATIC_LINK_LIBS thrift::thrift) - list(APPEND PARQUET_STATIC_INTERFACE_INSTALL_LIBS thrift::thrift) + if(NOT THRIFT_VENDORED) + list(APPEND PARQUET_STATIC_INSTALL_INTERFACE_LIBS thrift::thrift) + endif() endif() if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT) @@ -247,11 +249,11 @@ add_arrow_lib(parquet SHARED_PRIVATE_LINK_LIBS ${PARQUET_SHARED_PRIVATE_LINK_LIBS} SHARED_INSTALL_INTERFACE_LIBS - arrow_shared + Arrow::arrow_shared STATIC_LINK_LIBS ${PARQUET_STATIC_LINK_LIBS} STATIC_INSTALL_INTERFACE_LIBS - ${PARQUET_STATIC_INTERFACE_INSTALL_LIBS}) + ${PARQUET_STATIC_INSTALL_INTERFACE_LIBS}) if(WIN32 AND NOT (ARROW_TEST_LINKAGE STREQUAL "static")) add_library(parquet_test_support STATIC @@ -274,8 +276,6 @@ if(ARROW_BUILD_STATIC AND WIN32) target_compile_definitions(parquet_static PUBLIC ARROW_STATIC) endif() -add_dependencies(parquet ${PARQUET_LIBRARIES} thrift::thrift) - add_definitions(-DPARQUET_THRIFT_VERSION_MAJOR=${Thrift_VERSION_MAJOR}) add_definitions(-DPARQUET_THRIFT_VERSION_MINOR=${Thrift_VERSION_MINOR}) diff --git a/cpp/src/parquet/ParquetConfig.cmake.in b/cpp/src/parquet/ParquetConfig.cmake.in index afdecc517c843..19f1b4b639523 100644 --- a/cpp/src/parquet/ParquetConfig.cmake.in +++ b/cpp/src/parquet/ParquetConfig.cmake.in @@ -24,8 +24,8 @@ # # This config sets the following targets in your project:: # -# parquet_shared - for linked as shared library if shared library is built -# parquet_static - for linked as static library if static library is built +# Parquet::parquet_shared - for linked as shared library if shared library is built +# Parquet::parquet_static - for linked as static library if static library is built @PACKAGE_INIT@ @@ -36,8 +36,8 @@ set(PARQUET_VERSION "@ARROW_VERSION@") set(PARQUET_SO_VERSION "@ARROW_SO_VERSION@") set(PARQUET_FULL_SO_VERSION "@ARROW_FULL_SO_VERSION@") -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET parquet_shared OR TARGET parquet_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ParquetTargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/ParquetTargets.cmake") + +arrow_keep_backward_compatibility(Parquet parquet) + +check_required_components(Parquet) diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt index 2573693738590..c98a66367bcde 100644 --- a/cpp/src/plasma/CMakeLists.txt +++ b/cpp/src/plasma/CMakeLists.txt @@ -52,15 +52,25 @@ set(PLASMA_STORE_SRCS store.cc thirdparty/ae/ae.c) -set(PLASMA_LINK_LIBS arrow::flatbuffers arrow_shared) -set(PLASMA_STATIC_LINK_LIBS arrow::flatbuffers arrow_static) +set(PLASMA_SHARED_LINK_LIBS arrow::flatbuffers) +set(PLASMA_STATIC_LINK_LIBS arrow::flatbuffers) +set(PLASMA_SHARED_INSTALL_INTERFACE_LIBS) +set(PLASMA_STATIC_INSTALL_INTERFACE_LIBS) if(ARROW_CUDA) - list(INSERT PLASMA_LINK_LIBS 0 arrow_cuda_shared) - list(INSERT PLASMA_STATIC_LINK_LIBS 0 arrow_cuda_static) + list(APPEND PLASMA_SHARED_LINK_LIBS arrow_cuda_shared) + list(APPEND PLASMA_STATIC_LINK_LIBS arrow_cuda_static) + list(APPEND PLASMA_SHARED_INSTALL_INTERFACE_LIBS ArrowCUDA::arrow_cuda_shared) + list(APPEND PLASMA_STATIC_INSTALL_INTERFACE_LIBS ArrowCUDA::arrow_cuda_static) add_definitions(-DPLASMA_CUDA) +else() + list(APPEND PLASMA_SHARED_INSTALL_INTERFACE_LIBS Arrow::arrow_shared) + list(APPEND PLASMA_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static) endif() +list(APPEND PLASMA_SHARED_LINK_LIBS arrow_shared) +list(APPEND PLASMA_STATIC_LINK_LIBS arrow_static) + if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT) set(PLASMA_SHARED_LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map") @@ -78,9 +88,13 @@ add_arrow_lib(plasma SHARED_LINK_FLAGS ${PLASMA_SHARED_LINK_FLAGS} SHARED_LINK_LIBS - ${PLASMA_LINK_LIBS} + ${PLASMA_SHARED_LINK_LIBS} + SHARED_INSTALL_INTERFACE_LIBS + ${PLASMA_SHARED_INSTALL_INTERFACE_LIBS} STATIC_LINK_LIBS - ${PLASMA_STATIC_LINK_LIBS}) + ${PLASMA_STATIC_LINK_LIBS} + STATIC_INSTALL_INTERFACE_LIBS + ${PLASMA_STATIC_INSTALL_INTERFACE_LIBS}) add_dependencies(plasma ${PLASMA_LIBRARIES}) @@ -154,6 +168,7 @@ install(FILES common.h # Plasma store set_target_properties(plasma-store-server PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) install(TARGETS plasma-store-server ${INSTALL_IS_OPTIONAL} + EXPORT plasma_targets DESTINATION ${CMAKE_INSTALL_BINDIR}) if(ARROW_PLASMA_JAVA_CLIENT) @@ -217,7 +232,7 @@ function(ADD_PLASMA_TEST REL_TEST_NAME) endfunction() if(ARROW_BUILD_SHARED) - set(PLASMA_TEST_LIBS plasma_shared ${PLASMA_LINK_LIBS}) + set(PLASMA_TEST_LIBS plasma_shared ${PLASMA_SHARED_LINK_LIBS}) else() set(PLASMA_TEST_LIBS plasma_static ${PLASMA_STATIC_LINK_LIBS}) endif() diff --git a/cpp/src/plasma/PlasmaConfig.cmake.in b/cpp/src/plasma/PlasmaConfig.cmake.in index b4b39afd0c933..cdd312d04cb94 100644 --- a/cpp/src/plasma/PlasmaConfig.cmake.in +++ b/cpp/src/plasma/PlasmaConfig.cmake.in @@ -22,18 +22,27 @@ # # This config sets the following targets in your project:: # -# plasma_shared - for linked as shared library if shared library is built -# plasma_static - for linked as static library if static library is built +# Plasma::plasma_shared - for linked as shared library if shared library is built +# Plasma::plasma_static - for linked as static library if static library is built +# Plasma::plasma-store-server - for plasma-store-server executable @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(Arrow) +if(ARROW_CUDA) + find_dependency(ArrowCUDA) +endif() -set(PLASMA_STORE_SERVER "@CMAKE_INSTALL_FULL_BINDIR@/plasma-store-server@CMAKE_EXECUTABLE_SUFFIX@") +set(PLASMA_VERSION "@ARROW_VERSION@") +set(PLASMA_SO_VERSION "@ARROW_SO_VERSION@") +set(PLASMA_FULL_SO_VERSION "@ARROW_FULL_SO_VERSION@") -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET plasma_shared OR TARGET plasma_static)) - include("${CMAKE_CURRENT_LIST_DIR}/PlasmaTargets.cmake") -endif() +set(PLASMA_STORE_SERVER + "@CMAKE_INSTALL_FULL_BINDIR@/plasma-store-server@CMAKE_EXECUTABLE_SUFFIX@") + +include("${CMAKE_CURRENT_LIST_DIR}/PlasmaTargets.cmake") + +arrow_keep_backward_compatibility(Plasma plasma) + +check_required_components(Plasma) diff --git a/dev/archery/archery/utils/lint.py b/dev/archery/archery/utils/lint.py index 696dafe2b5073..03a4a3e6bf95d 100644 --- a/dev/archery/archery/utils/lint.py +++ b/dev/archery/archery/utils/lint.py @@ -149,6 +149,7 @@ def cmake_linter(src, fix=False): include_patterns=[ 'ci/**/*.cmake', 'cpp/CMakeLists.txt', + 'cpp/src/**/*.cmake.in', 'cpp/src/**/CMakeLists.txt', 'cpp/examples/**/CMakeLists.txt', 'cpp/cmake_modules/*.cmake', diff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.sh index 6127cd68d203f..eb44e3e4fecfe 100755 --- a/dev/release/verify-release-candidate.sh +++ b/dev/release/verify-release-candidate.sh @@ -582,6 +582,7 @@ test_and_install_cpp() { if [ "${USE_CONDA}" -gt 0 ]; then DEFAULT_DEPENDENCY_SOURCE="CONDA" + CMAKE_PREFIX_PATH="${CONDA_BACKUP_CMAKE_PREFIX_PATH}:${CMAKE_PREFIX_PATH}" else DEFAULT_DEPENDENCY_SOURCE="AUTO" fi @@ -657,6 +658,10 @@ test_python() { maybe_setup_virtualenv cython numpy setuptools_scm setuptools || exit 1 maybe_setup_conda --file ci/conda_env_python.txt || exit 1 + if [ "${USE_CONDA}" -gt 0 ]; then + CMAKE_PREFIX_PATH="${CONDA_BACKUP_CMAKE_PREFIX_PATH}:${CMAKE_PREFIX_PATH}" + fi + export PYARROW_PARALLEL=$NPROC export PYARROW_WITH_DATASET=1 export PYARROW_WITH_HDFS=1 @@ -935,8 +940,9 @@ ensure_source_directory() { test_source_distribution() { export ARROW_HOME=$ARROW_TMPDIR/install + export CMAKE_PREFIX_PATH=$ARROW_HOME${CMAKE_PREFIX_PATH:+:${CMAKE_PREFIX_PATH}} export PARQUET_HOME=$ARROW_TMPDIR/install - export PKG_CONFIG_PATH=$ARROW_HOME/lib/pkgconfig:${PKG_CONFIG_PATH:-} + export PKG_CONFIG_PATH=$ARROW_HOME/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}} if [ "$(uname)" == "Darwin" ]; then NPROC=$(sysctl -n hw.ncpu) diff --git a/dev/tasks/conda-recipes/arrow-cpp/meta.yaml b/dev/tasks/conda-recipes/arrow-cpp/meta.yaml index 8f1ba74e3afaa..59a3de085d972 100644 --- a/dev/tasks/conda-recipes/arrow-cpp/meta.yaml +++ b/dev/tasks/conda-recipes/arrow-cpp/meta.yaml @@ -181,10 +181,12 @@ outputs: - {{ compiler("cuda") }} # [cuda_compiler_version != "None"] host: - {{ pin_subpackage('arrow-cpp', exact=True) }} + - clangdev 10 # [not (osx and arm64)] - cython + - llvmdev 10 # [not (osx and arm64)] - numpy - - python - openssl + - python - setuptools - setuptools_scm - six @@ -257,7 +259,9 @@ outputs: host: - {{ pin_subpackage('arrow-cpp', exact=True) }} - {{ pin_subpackage('pyarrow', exact=True) }} + - clangdev 10 # [not (osx and arm64)] - cython + - llvmdev 10 # [not (osx and arm64)] - numpy - python - openssl diff --git a/dev/tasks/homebrew-formulae/apache-arrow.rb b/dev/tasks/homebrew-formulae/apache-arrow.rb index edb86d659f490..cceaad05397b1 100644 --- a/dev/tasks/homebrew-formulae/apache-arrow.rb +++ b/dev/tasks/homebrew-formulae/apache-arrow.rb @@ -45,7 +45,7 @@ class ApacheArrow < Formula depends_on "numpy" depends_on "openssl@1.1" depends_on "protobuf" - depends_on "python@3.9" + depends_on "python@3.10" depends_on "rapidjson" depends_on "re2" depends_on "snappy" @@ -60,6 +60,8 @@ class ApacheArrow < Formula fails_with gcc: "5" def install + python = "python3.10" + # https://github.com/Homebrew/homebrew-core/issues/76537 ENV.runtime_cpu_detection if Hardware::CPU.intel? @@ -91,7 +93,7 @@ def install -DARROW_WITH_ZSTD=ON -DCMAKE_CXX_STANDARD=17 -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE - -DPython3_EXECUTABLE=#{Formula["python@3.9"].bin/"python3"} + -DPython3_EXECUTABLE=#{which(python)} ] mkdir "build" do diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-cuda-dev.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-cuda-dev.install index 77e0b70f672fe..60061f0eece4a 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-cuda-dev.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-cuda-dev.install @@ -1,6 +1,4 @@ -usr/lib/*/cmake/arrow/ArrowCUDAConfig*.cmake -usr/lib/*/cmake/arrow/ArrowCUDATargets*.cmake -usr/lib/*/cmake/arrow/FindArrowCUDA.cmake +usr/lib/*/cmake/ArrowCUDA/ usr/lib/*/libarrow_cuda.a usr/lib/*/libarrow_cuda.so usr/lib/*/pkgconfig/arrow-cuda.pc diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-dev.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-dev.install index 53e727ae0526a..ec14ed67549ed 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-dev.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-dev.install @@ -1,6 +1,4 @@ -usr/lib/*/cmake/arrow/ArrowDatasetConfig*.cmake -usr/lib/*/cmake/arrow/ArrowDatasetTargets*.cmake -usr/lib/*/cmake/arrow/FindArrowDataset.cmake +usr/lib/*/cmake/ArrowDataset/ usr/lib/*/libarrow_dataset.a usr/lib/*/libarrow_dataset.so usr/lib/*/pkgconfig/arrow-dataset.pc diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dev.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dev.install index 40a834ced42f1..9df014c54ca24 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dev.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dev.install @@ -1,11 +1,5 @@ usr/include/arrow/ -usr/lib/*/cmake/arrow/ArrowConfig*.cmake -usr/lib/*/cmake/arrow/ArrowOptions.cmake -usr/lib/*/cmake/arrow/ArrowTargets*.cmake -usr/lib/*/cmake/arrow/Find*Alt.cmake -usr/lib/*/cmake/arrow/FindArrow.cmake -usr/lib/*/cmake/arrow/Find[BTuz]*.cmake -usr/lib/*/cmake/arrow/arrow-config.cmake +usr/lib/*/cmake/Arrow/ usr/lib/*/libarrow.a usr/lib/*/libarrow.so usr/lib/*/libarrow_bundled_dependencies.a diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-dev.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-dev.install index 20ca33d843625..a2c4914766340 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-dev.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-dev.install @@ -1,6 +1,4 @@ -usr/lib/*/cmake/arrow/ArrowFlightConfig*.cmake -usr/lib/*/cmake/arrow/ArrowFlightTargets*.cmake -usr/lib/*/cmake/arrow/FindArrowFlight.cmake +usr/lib/*/cmake/ArrowFlight/ usr/lib/*/libarrow_flight.a usr/lib/*/libarrow_flight.so usr/lib/*/pkgconfig/arrow-flight.pc diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-dev.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-dev.install index d71e84ff16cfe..542443434810f 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-dev.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-dev.install @@ -1,6 +1,4 @@ -usr/lib/*/cmake/arrow/ArrowFlightSqlConfig*.cmake -usr/lib/*/cmake/arrow/ArrowFlightSqlTargets*.cmake -usr/lib/*/cmake/arrow/FindArrowFlightSql.cmake +usr/lib/*/cmake/ArrowFlightSql/ usr/lib/*/libarrow_flight_sql.a usr/lib/*/libarrow_flight_sql.so usr/lib/*/pkgconfig/arrow-flight-sql.pc diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-dev.install b/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-dev.install index 26e7e76fb3806..27790f00a0db8 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-dev.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-dev.install @@ -1,7 +1,5 @@ usr/include/gandiva/ -usr/lib/*/cmake/arrow/GandivaConfig*.cmake -usr/lib/*/cmake/arrow/GandivaTargets*.cmake -usr/lib/*/cmake/arrow/FindGandiva.cmake +usr/lib/*/cmake/Gandiva/ usr/lib/*/libgandiva.a usr/lib/*/libgandiva.so usr/lib/*/pkgconfig/gandiva.pc diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libparquet-dev.install b/dev/tasks/linux-packages/apache-arrow/debian/libparquet-dev.install index e163115f0351e..73c4784adc8b5 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libparquet-dev.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libparquet-dev.install @@ -1,7 +1,5 @@ usr/include/parquet/ -usr/lib/*/cmake/arrow/ParquetConfig*.cmake -usr/lib/*/cmake/arrow/ParquetTargets*.cmake -usr/lib/*/cmake/arrow/FindParquet.cmake +usr/lib/*/cmake/Parquet/ usr/lib/*/libparquet.a usr/lib/*/libparquet.so usr/lib/*/pkgconfig/parquet.pc diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libplasma-dev.install b/dev/tasks/linux-packages/apache-arrow/debian/libplasma-dev.install index c315d4dfc7706..f5fcc3fcaea76 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libplasma-dev.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libplasma-dev.install @@ -1,7 +1,5 @@ usr/include/plasma/ -usr/lib/*/cmake/arrow/PlasmaConfig*.cmake -usr/lib/*/cmake/arrow/PlasmaTargets*.cmake -usr/lib/*/cmake/arrow/FindPlasma.cmake +usr/lib/*/cmake/Plasma/ usr/lib/*/libplasma.a usr/lib/*/libplasma.so usr/lib/*/pkgconfig/plasma.pc diff --git a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in index 872f461fa4a8d..3d72d23b90381 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in +++ b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in @@ -312,29 +312,7 @@ Libraries and header files for Apache Arrow C++. %exclude %{_includedir}/arrow/flight/ %endif %exclude %{_includedir}/arrow/python/ -%{_libdir}/cmake/arrow/ArrowConfig*.cmake -%{_libdir}/cmake/arrow/ArrowOptions.cmake -%{_libdir}/cmake/arrow/ArrowTargets*.cmake -%{_libdir}/cmake/arrow/FindArrow.cmake -%{_libdir}/cmake/arrow/FindBrotli.cmake -%{_libdir}/cmake/arrow/FindSnappyAlt.cmake -%if %{have_thrift} -%{_libdir}/cmake/arrow/FindThrift.cmake -%endif -%if %{use_flight} -%{_libdir}/cmake/arrow/Findc-aresAlt.cmake -%endif -%{_libdir}/cmake/arrow/Findlz4Alt.cmake -%if %{have_re2} -%{_libdir}/cmake/arrow/Findre2Alt.cmake -%endif -%if %{have_utf8proc} -%{_libdir}/cmake/arrow/Findutf8proc.cmake -%endif -%if %{have_zstd} -%{_libdir}/cmake/arrow/Findzstd.cmake -%endif -%{_libdir}/cmake/arrow/arrow-config.cmake +%{_libdir}/cmake/Arrow/ %{_libdir}/libarrow.a %{_libdir}/libarrow.so %{_libdir}/libarrow_bundled_dependencies.a @@ -373,9 +351,7 @@ Libraries and header files for Apache Arrow dataset. %doc README.md %license LICENSE.txt NOTICE.txt %{_includedir}/arrow/dataset/ -%{_libdir}/cmake/arrow/ArrowDatasetConfig*.cmake -%{_libdir}/cmake/arrow/ArrowDatasetTargets*.cmake -%{_libdir}/cmake/arrow/FindArrowDataset.cmake +%{_libdir}/cmake/ArrowDataset/ %{_libdir}/libarrow_dataset.a %{_libdir}/libarrow_dataset.so %{_libdir}/pkgconfig/arrow-dataset.pc @@ -412,9 +388,7 @@ Libraries and header files for Apache Arrow Flight. %license LICENSE.txt NOTICE.txt %{_includedir}/arrow/flight/ %exclude %{_includedir}/arrow/flight/sql/ -%{_libdir}/cmake/arrow/ArrowFlightConfig*.cmake -%{_libdir}/cmake/arrow/ArrowFlightTargets*.cmake -%{_libdir}/cmake/arrow/FindArrowFlight.cmake +%{_libdir}/cmake/ArrowFlight/ %{_libdir}/libarrow_flight.a %{_libdir}/libarrow_flight.so %{_libdir}/pkgconfig/arrow-flight.pc @@ -447,9 +421,7 @@ Libraries and header files for Apache Arrow Flight SQL. %doc README.md %license LICENSE.txt NOTICE.txt %{_includedir}/arrow/flight/sql/ -%{_libdir}/cmake/arrow/ArrowFlightSqlConfig*.cmake -%{_libdir}/cmake/arrow/ArrowFlightSqlTargets*.cmake -%{_libdir}/cmake/arrow/FindArrowFlightSql.cmake +%{_libdir}/cmake/ArrowFlightSql/ %{_libdir}/libarrow_flight_sql.a %{_libdir}/libarrow_flight_sql.so %{_libdir}/pkgconfig/arrow-flight-sql.pc @@ -486,9 +458,7 @@ Libraries and header files for Gandiva. %doc README.md %license LICENSE.txt NOTICE.txt %{_includedir}/gandiva/ -%{_libdir}/cmake/arrow/GandivaConfig*.cmake -%{_libdir}/cmake/arrow/GandivaTargets*.cmake -%{_libdir}/cmake/arrow/FindGandiva.cmake +%{_libdir}/cmake/Gandiva/ %{_libdir}/libgandiva.a %{_libdir}/libgandiva.so %{_libdir}/pkgconfig/gandiva.pc @@ -536,9 +506,7 @@ Libraries and header files for Plasma in-memory object store. %doc README.md %license LICENSE.txt NOTICE.txt %{_includedir}/plasma/ -%{_libdir}/cmake/arrow/PlasmaConfig*.cmake -%{_libdir}/cmake/arrow/PlasmaTargets*.cmake -%{_libdir}/cmake/arrow/FindPlasma.cmake +%{_libdir}/cmake/Plasma/ %{_libdir}/libplasma.a %{_libdir}/libplasma.so %{_libdir}/pkgconfig/plasma*.pc @@ -587,9 +555,7 @@ Libraries and header files for Apache Parquet C++. %doc README.md %license LICENSE.txt NOTICE.txt %{_includedir}/parquet/ -%{_libdir}/cmake/arrow/ParquetConfig*.cmake -%{_libdir}/cmake/arrow/ParquetTargets*.cmake -%{_libdir}/cmake/arrow/FindParquet.cmake +%{_libdir}/cmake/Parquet/ %{_libdir}/libparquet.a %{_libdir}/libparquet.so %{_libdir}/pkgconfig/parquet*.pc diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index e2878f6c8ecbd..2951e3de8f83e 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -33,6 +33,10 @@ if(EXISTS "${CPP_CMAKE_MODULES}") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CPP_CMAKE_MODULES}) endif() +if(PYARROW_CPP_HOME) + list(INSERT CMAKE_PREFIX_PATH 0 "${PYARROW_CPP_HOME}") +endif() + include(CMakeParseArguments) # Only interpret if() arguments as variables or keywords when unquoted. @@ -263,7 +267,7 @@ function(bundle_arrow_lib library_path) ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME}.${ARG_SO_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} COPYONLY) else() - configure_file(${${library_path}}.${ARG_SO_VERSION} + configure_file(${LIBRARY_DIR}/${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${ARG_SO_VERSION} ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${ARG_SO_VERSION} COPYONLY) endif() @@ -410,7 +414,7 @@ set(CYTHON_EXTENSIONS _hdfsio _json) -set(LINK_LIBS arrow_shared arrow_python_shared) +set(LINK_LIBS ArrowPython::arrow_python_shared) if(PYARROW_BUILD_GCS) set(CYTHON_EXTENSIONS ${CYTHON_EXTENSIONS} _gcsfs) @@ -434,7 +438,7 @@ if(PYARROW_BUILD_CUDA) bundle_arrow_import_lib(ARROW_CUDA_IMPORT_LIB) endif() endif() - set(CUDA_LINK_LIBS arrow_cuda_shared) + set(CUDA_LINK_LIBS ArrowCUDA::arrow_cuda_shared) set(CYTHON_EXTENSIONS ${CYTHON_EXTENSIONS} _cuda) endif() @@ -450,7 +454,7 @@ if(PYARROW_BUILD_DATASET) endif() endif() - set(DATASET_LINK_LIBS arrow_dataset_shared) + set(DATASET_LINK_LIBS ArrowDataset::arrow_dataset_shared) set(CYTHON_EXTENSIONS ${CYTHON_EXTENSIONS} _dataset) endif() @@ -472,7 +476,7 @@ if(PYARROW_BUILD_PARQUET) bundle_arrow_import_lib(PARQUET_IMPORT_LIB) endif() endif() - set(PARQUET_LINK_LIBS parquet_shared) + set(PARQUET_LINK_LIBS Parquet::parquet_shared) else() find_package(Thrift) if(PYARROW_BOOST_USE_SHARED) @@ -508,7 +512,7 @@ if(PYARROW_BUILD_PLASMA) if(PYARROW_BUNDLE_ARROW_CPP) bundle_arrow_lib(PLASMA_SHARED_LIB SO_VERSION ${PLASMA_SO_VERSION}) endif() - set(PLASMA_LINK_LIBS plasma_shared) + set(PLASMA_LINK_LIBS Plasma::plasma_shared) set(CYTHON_EXTENSIONS ${CYTHON_EXTENSIONS} _plasma) file(COPY ${PLASMA_STORE_SERVER} DESTINATION ${BUILD_OUTPUT_ROOT_DIRECTORY}) endif() @@ -540,7 +544,7 @@ if(PYARROW_BUILD_FLIGHT) endif() endif() - set(FLIGHT_LINK_LIBS arrow_flight_shared arrow_python_flight_shared) + set(FLIGHT_LINK_LIBS ArrowPythonFlight::arrow_python_flight_shared) set(CYTHON_EXTENSIONS ${CYTHON_EXTENSIONS} _flight) endif() @@ -554,7 +558,7 @@ if(PYARROW_BUILD_SUBSTRAIT) endif() endif() - set(SUBSTRAIT_LINK_LIBS arrow_substrait_shared) + set(SUBSTRAIT_LINK_LIBS ArrowSubstrait::arrow_substrait_shared) set(CYTHON_EXTENSIONS ${CYTHON_EXTENSIONS} _substrait) endif() @@ -575,7 +579,7 @@ if(PYARROW_BUILD_GANDIVA) endif() endif() - set(GANDIVA_LINK_LIBS gandiva_shared) + set(GANDIVA_LINK_LIBS Gandiva::gandiva_shared) set(CYTHON_EXTENSIONS ${CYTHON_EXTENSIONS} gandiva) endif() diff --git a/python/examples/minimal_build/build_conda.sh b/python/examples/minimal_build/build_conda.sh index 61378b9fecac7..48cada6355b8b 100755 --- a/python/examples/minimal_build/build_conda.sh +++ b/python/examples/minimal_build/build_conda.sh @@ -99,6 +99,7 @@ pushd $ARROW_ROOT/python rm -rf build/ # remove any pesky pre-existing build directory +export CMAKE_PREFIX_PATH=${ARROW_HOME}${CMAKE_PREFIX_PATH:+:${CMAKE_PREFIX_PATH}} export PYARROW_BUILD_TYPE=Debug export PYARROW_CMAKE_GENERATOR=Ninja diff --git a/python/examples/minimal_build/build_venv.sh b/python/examples/minimal_build/build_venv.sh index 56dd54abbae9c..2f1bc4ed304dd 100755 --- a/python/examples/minimal_build/build_venv.sh +++ b/python/examples/minimal_build/build_venv.sh @@ -66,6 +66,7 @@ pushd $ARROW_ROOT/python rm -rf build/ # remove any pesky pre-existing build directory +export CMAKE_PREFIX_PATH=${ARROW_HOME}${CMAKE_PREFIX_PATH:+:${CMAKE_PREFIX_PATH}} export PYARROW_BUILD_TYPE=Debug export PYARROW_CMAKE_GENERATOR=Ninja diff --git a/python/pyarrow/src/ArrowPythonConfig.cmake.in b/python/pyarrow/src/ArrowPythonConfig.cmake.in index 4cae0c2df5c9e..cab92cddfd3bd 100644 --- a/python/pyarrow/src/ArrowPythonConfig.cmake.in +++ b/python/pyarrow/src/ArrowPythonConfig.cmake.in @@ -21,16 +21,19 @@ # # This config sets the following targets in your project:: # -# arrow_python_shared - for linked as shared library if shared library is built -# arrow_python_static - for linked as static library if static library is built +# ArrowPython::arrow_python_shared - for linked as shared library if shared library is built +# ArrowPython::arrow_python_static - for linked as static library if static library is built @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(Arrow) - -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_python_shared OR TARGET arrow_python_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowPythonTargets.cmake") +if(PARQUET_REQUIRE_ENCRYPTION) + find_dependency(Parquet) endif() + +include("${CMAKE_CURRENT_LIST_DIR}/ArrowPythonTargets.cmake") + +arrow_keep_backward_compatibility(ArrowPython arrow_python) + +check_required_components(ArrowPython) diff --git a/python/pyarrow/src/ArrowPythonFlightConfig.cmake.in b/python/pyarrow/src/ArrowPythonFlightConfig.cmake.in index 5dc9deec56049..fb2ad918fc867 100644 --- a/python/pyarrow/src/ArrowPythonFlightConfig.cmake.in +++ b/python/pyarrow/src/ArrowPythonFlightConfig.cmake.in @@ -21,8 +21,8 @@ # # This config sets the following targets in your project:: # -# arrow_python_flight_shared - for linked as shared library if shared library is built -# arrow_python_flight_static - for linked as static library if static library is built +# ArrowPythonFlight::arrow_python_flight_shared - for linked as shared library if shared library is built +# ArrowPythonFlight::arrow_python_flight_static - for linked as static library if static library is built @PACKAGE_INIT@ @@ -30,8 +30,8 @@ include(CMakeFindDependencyMacro) find_dependency(ArrowFlight) find_dependency(ArrowPython) -# Load targets only once. If we load targets multiple times, CMake reports -# already existent target error. -if(NOT (TARGET arrow_python_flight_shared OR TARGET arrow_python_flight_static)) - include("${CMAKE_CURRENT_LIST_DIR}/ArrowPythonFlightTargets.cmake") -endif() +include("${CMAKE_CURRENT_LIST_DIR}/ArrowPythonFlightTargets.cmake") + +arrow_keep_backward_compatibility(ArrowPythonFlight arrow_python_flight) + +check_required_components(ArrowPythonFlight) diff --git a/python/pyarrow/src/CMakeLists.txt b/python/pyarrow/src/CMakeLists.txt index 178b156a5c0a1..a1dd330603d54 100644 --- a/python/pyarrow/src/CMakeLists.txt +++ b/python/pyarrow/src/CMakeLists.txt @@ -37,9 +37,11 @@ get_filename_component(PYTHON_SOURCE_DIR ${PYARROW_SOURCE_DIR} DIRECTORY) get_filename_component(ARROW_SOURCE_DIR ${PYTHON_SOURCE_DIR} DIRECTORY) set(ARROW_CPP_SOURCE_DIR "${ARROW_SOURCE_DIR}/cpp") +set(CMAKE_MODULE_PATH "${PYTHON_SOURCE_DIR}/cmake_modules") + # normalize ARROW_HOME path file(TO_CMAKE_PATH "$ENV{ARROW_HOME}" ARROW_HOME) -set(CMAKE_MODULE_PATH "${PYTHON_SOURCE_DIR}/cmake_modules" "${ARROW_HOME}/lib/cmake/arrow") +list(INSERT CMAKE_PREFIX_PATH 0 "${ARROW_HOME}") # # Arrow version @@ -59,7 +61,6 @@ endif() # find_package(Arrow REQUIRED) -include(ArrowOptions) # # Python @@ -104,18 +105,36 @@ set_source_files_properties(init.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON SKIP_UNITY_BUILD_INCLUSION ON) # -# Arrow vs PyArrow cpp options +# Shared/static link libs +# + +set(ARROW_PYTHON_SHARED_LINK_LIBS) +set(ARROW_PYTHON_SHARED_PRIVATE_LINK_LIBS) +set(ARROW_PYTHON_SHARED_INSTALL_INTERFACE_LIBS) +set(ARROW_PYTHON_STATIC_LINK_LIBS) +set(ARROW_PYTHON_STATIC_INSTALL_INTERFACE_LIBS) + +# +# Arrow vs PyArrow C++ options # -# Check all the options from Arrow and PyArrow cpp to be in line +# Check all the options from Arrow and PyArrow C++ to be in line if(PYARROW_WITH_DATASET) find_package(ArrowDataset REQUIRED) + list(APPEND ARROW_PYTHON_SHARED_LINK_LIBS ArrowDataset::arrow_dataset_shared) + list(APPEND ARROW_PYTHON_SHARED_INSTALL_INTERFACE_LIBS ArrowDataset::arrow_dataset_shared) + list(APPEND ARROW_PYTHON_STATIC_LINK_LIBS ArrowDataset::arrow_dataset_static) + list(APPEND ARROW_PYTHON_STATIC_INSTALL_INTERFACE_LIBS ArrowDataset::arrow_dataset_static) endif() if(PYARROW_WITH_PARQUET_ENCRYPTION) if(PARQUET_REQUIRE_ENCRYPTION) list(APPEND ARROW_PYTHON_SRCS parquet_encryption.cc) find_package(Parquet REQUIRED) + list(APPEND ARROW_PYTHON_SHARED_LINK_LIBS Parquet::parquet_shared) + list(APPEND ARROW_PYTHON_SHARED_INSTALL_INTERFACE_LIBS Parquet::parquet_shared) + list(APPEND ARROW_PYTHON_STATIC_LINK_LIBS Parquet::parquet_static) + list(APPEND ARROW_PYTHON_STATIC_INSTALL_INTERFACE_LIBS Parquet::parquet_static) else() message(FATAL_ERROR "You must build Arrow C++ with PARQUET_REQUIRE_ENCRYPTION=ON") endif() @@ -136,21 +155,30 @@ if(ARROW_FILESYSTEM) list(APPEND ARROW_PYTHON_SRCS filesystem.cc) endif() -# Link to arrow dependecies -if(ARROW_BUILD_SHARED) - set(ARROW_PYTHON_DEPENDENCIES arrow_shared) -else() - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - set(ARROW_PYTHON_DEPENDENCIES arrow_static Threads::Threads) -endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set_property(SOURCE pyarrow.cc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-cast-qual ") endif() +if(NOT ARROW_PYTHON_SHARED_LINK_LIBS) + list(APPEND ARROW_PYTHON_SHARED_LINK_LIBS Arrow::arrow_shared) +endif() +if(NOT ARROW_PYTHON_SHARED_INSTALL_INTERFACE_LIBS) + list(APPEND ARROW_PYTHON_SHARED_INSTALL_INTERFACE_LIBS Arrow::arrow_shared) +endif() +if(NOT ARROW_PYTHON_STATIC_LINK_LIBS) + list(APPEND ARROW_PYTHON_STATIC_LINK_LIBS Arrow::arrow_static) +endif() +list(APPEND ARROW_PYTHON_STATIC_LINK_LIBS ${PYTHON_OTHER_LIBS}) +if(NOT ARROW_PYTHON_STATIC_INSTALL_INTERFACE_LIBS) + list(APPEND ARROW_PYTHON_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static) +endif() + +if(WIN32) + list(APPEND ARROW_PYTHON_SHARED_LINK_LIBS ${PYTHON_LIBRARIES} ${PYTHON_OTHER_LIBS}) +endif() + # # Compiler stuff # @@ -168,35 +196,19 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # Needed compiler flags include(SetupCxxFlags) -# -# Shared/static link libs -# - -set(ARROW_PYTHON_SHARED_LINK_LIBS arrow_shared) -set(ARROW_PYTHON_SHARED_PRIVATE_LINK_LIBS) -set(ARROW_PYTHON_STATIC_LINK_LIBS ${PYTHON_OTHER_LIBS}) - -if(WIN32) - list(APPEND ARROW_PYTHON_SHARED_LINK_LIBS ${PYTHON_LIBRARIES} ${PYTHON_OTHER_LIBS}) -endif() - -if(PARQUET_REQUIRE_ENCRYPTION AND PYARROW_WITH_PARQUET_ENCRYPTION) - list(APPEND ARROW_PYTHON_SHARED_LINK_LIBS parquet_shared) -endif() - set(ARROW_PYTHON_INCLUDES ${NUMPY_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}) # Inlude macros needed to find and use add_arrow_lib function include(BuildUtils) include(CMakePackageConfigHelpers) -# Set the output directory for cmake module +# Set the output directory for CMake files # (CMAKE_INSTALL_PREFIX = python/build/dist! should be set in setup.py!) -set(ARROW_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +set(ARROW_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake") # Changing ARROW_SOURCE_DIR for sdist build # In this case cpp/cmake_modules doesn't exist -if(NOT EXISTS "${ARROW_SOURCE_DIR}/cpp/cmake_modules/Find${MODULE}.cmake") +if(NOT EXISTS "${ARROW_SOURCE_DIR}/cpp/cmake_modules") set(ARROW_SOURCE_DIR ${PYTHON_SOURCE_DIR}) endif() @@ -211,16 +223,18 @@ add_arrow_lib(arrow_python "$<$:pch.h>" OUTPUTS ARROW_PYTHON_LIBRARIES - DEPENDENCIES - ${ARROW_PYTHON_DEPENDENCIES} SHARED_LINK_FLAGS ${ARROW_VERSION_SCRIPT_FLAGS} SHARED_LINK_LIBS ${ARROW_PYTHON_SHARED_LINK_LIBS} SHARED_PRIVATE_LINK_LIBS ${ARROW_PYTHON_SHARED_PRIVATE_LINK_LIBS} + SHARED_INSTALL_INTERFACE_LIBS + ${ARROW_PYTHON_SHARED_INSTALL_INTERFACE_LIBS} STATIC_LINK_LIBS ${ARROW_PYTHON_STATIC_LINK_LIBS} + STATIC_INSTALL_INTERFACE_LIBS + ${ARROW_PYTHON_STATIC_INSTALL_INTERFACE_LIBS} EXTRA_INCLUDES "${ARROW_PYTHON_INCLUDES}") @@ -242,7 +256,7 @@ if(ARROW_FLIGHT AND ARROW_BUILD_SHARED) # in Flight) find_package(ArrowFlight REQUIRED) - set(FLIGHT_LINK_LIBS arrow_flight_shared) + set(FLIGHT_LINK_LIBS ArrowFlight::arrow_flight_shared) add_arrow_lib(arrow_python_flight CMAKE_PACKAGE_NAME @@ -257,9 +271,16 @@ if(ARROW_FLIGHT AND ARROW_BUILD_SHARED) ${ARROW_VERSION_SCRIPT_FLAGS} SHARED_LINK_LIBS arrow_python_shared - arrow_flight_shared + ArrowFlight::arrow_flight_shared + SHARED_INSTALL_INTERFACE_LIBS + ArrowPython::arrow_python_shared + ArrowFlight::arrow_flight_shared STATIC_LINK_LIBS - ${PYTHON_OTHER_LIBS} + arrow_python_static + ArrowFlight::arrow_flight_static + STATIC_INSTALL_INTERFACE_LIBS + ArrowPython::arrow_python_static + ArrowFlight::arrow_flight_static EXTRA_INCLUDES "${ARROW_PYTHON_INCLUDES}" PRIVATE_INCLUDES @@ -272,7 +293,7 @@ if(ARROW_FLIGHT AND ARROW_BUILD_SHARED) endforeach() if(ARROW_BUILD_STATIC AND MSVC) - target_compile_definitions(arrow_python_flight_static PUBLIC ARROW_STATIC) + target_compile_definitions(arrow_python_flight_static PUBLIC ARROW_PYTHON_STATIC) endif() endif() @@ -367,9 +388,9 @@ if(ARROW_BUILD_TESTS) # Link libraries to avoid include error on Linux if(ARROW_TEST_LINKAGE STREQUAL shared) - target_link_libraries(arrow_python_test_main arrow_shared) + target_link_libraries(arrow_python_test_main Arrow::arrow_shared) else() - target_link_libraries(arrow_python_test_main arrow_static) + target_link_libraries(arrow_python_test_main Arrow::arrow_static) endif() if(APPLE) @@ -382,10 +403,10 @@ if(ARROW_BUILD_TESTS) if(ARROW_TEST_LINKAGE STREQUAL shared) set(ARROW_PYTHON_TEST_LINK_LIBS arrow_python_test_main arrow_python_shared - arrow_testing_shared arrow_shared) + ArrowTesting::arrow_testing_shared) else() set(ARROW_PYTHON_TEST_LINK_LIBS arrow_python_test_main arrow_python_static - arrow_testing_static arrow_static) + ArrowTesting::arrow_testing_static) endif() # @@ -450,8 +471,8 @@ if(ARROW_BUILD_TESTS) PROPERTY LABELS ${LABELS}) else() - message(STATUS "Tests for PyArrow CPP not build") + message(STATUS "Tests for PyArrow C++ not build") message(STATUS "Set -DGTest_SOURCE=BUNDLED when building Arrow C++ - to enable building tests for PyArrow CPP") + to enable building tests for PyArrow C++") endif() -endif() \ No newline at end of file +endif() diff --git a/python/pyarrow/src/flight.h b/python/pyarrow/src/flight.h index 7e0136fcc3e94..37bc1d1c9f28a 100644 --- a/python/pyarrow/src/flight.h +++ b/python/pyarrow/src/flight.h @@ -32,7 +32,7 @@ #pragma GCC diagnostic ignored "-Wattributes" #endif -#ifdef ARROW_STATIC +#ifdef ARROW_PYTHON_STATIC #define ARROW_PYFLIGHT_EXPORT #elif defined(ARROW_PYFLIGHT_EXPORTING) #define ARROW_PYFLIGHT_EXPORT __declspec(dllexport) diff --git a/python/pyarrow/src/visibility.h b/python/pyarrow/src/visibility.h index c0b343c70e976..dd43b32fd43ff 100644 --- a/python/pyarrow/src/visibility.h +++ b/python/pyarrow/src/visibility.h @@ -24,7 +24,7 @@ #pragma GCC diagnostic ignored "-Wattributes" #endif -#ifdef ARROW_STATIC +#ifdef ARROW_PYTHON_STATIC #define ARROW_PYTHON_EXPORT #elif defined(ARROW_PYTHON_EXPORTING) #define ARROW_PYTHON_EXPORT __declspec(dllexport) diff --git a/python/setup.py b/python/setup.py index 09623142dceb6..fc868ff7addaf 100755 --- a/python/setup.py +++ b/python/setup.py @@ -93,8 +93,9 @@ def build_extensions(self): _build_ext.build_extensions(self) def run(self): - self._run_cmake_pyarrow_cpp() - self._run_cmake() + pyarrow_cpp_home = pjoin(os.getcwd(), 'build', 'dist') + self._run_cmake_pyarrow_cpp(pyarrow_cpp_home) + self._run_cmake(pyarrow_cpp_home) _build_ext.run(self) # adapted from cmake_build_ext in dynd-python @@ -228,7 +229,7 @@ def initialize_options(self): '_hdfsio', 'gandiva'] - def _run_cmake_pyarrow_cpp(self): + def _run_cmake_pyarrow_cpp(self, pyarrow_cpp_home): # check if build_type is correctly passed / set if self.build_type.lower() not in ('release', 'debug'): raise ValueError("--build-type (or PYARROW_BUILD_TYPE) needs to " @@ -236,35 +237,26 @@ def _run_cmake_pyarrow_cpp(self): # The directory containing this setup.py source = os.path.dirname(os.path.abspath(__file__)) - # The directory containing this PyArrow cpp CMakeLists.txt + # The directory containing this PyArrow C++ CMakeLists.txt source_pyarrow_cpp = pjoin(source, "pyarrow/src") # The directory for the module being built - build_cmd = self.get_finalized_command('build') - saved_cwd = os.getcwd() - build_dir = pjoin(saved_cwd, 'build', 'dist') - build_include = pjoin(saved_cwd, 'build', 'dist', 'include') - build_lib = pjoin(os.getcwd(), build_cmd.build_lib) + build_dir = pjoin(os.getcwd(), 'build', 'cpp') # The directory containing Arrow C++ build arrow_build_dir = os.environ.get('ARROW_BUILD_DIR', 'build') - if self.inplace: - # a bit hacky - build_lib = saved_cwd + if not os.path.isdir(build_dir): self.mkpath(build_dir) - if not os.path.isdir(build_lib): - self.mkpath(build_lib) - if not os.path.isdir(build_include): - self.mkpath(build_include) # Change to the build directory with changed_dir(build_dir): # cmake args cmake_options = [ - '-DCMAKE_INSTALL_PREFIX=' + str(build_dir), - '-DCMAKE_BUILD_TYPE=' + str(self.build_type.lower()), '-DARROW_BUILD_DIR=' + str(arrow_build_dir), + '-DCMAKE_BUILD_TYPE=' + str(self.build_type.lower()), + '-DCMAKE_INSTALL_LIBDIR=lib', + '-DCMAKE_INSTALL_PREFIX=' + str(pyarrow_cpp_home), '-DPYTHON_EXECUTABLE=' + str(sys.executable), '-DPython3_EXECUTABLE=' + str(sys.executable), ] @@ -292,63 +284,17 @@ def append_cmake_bool(value, varname): '-j{0}'.format(os.environ['PYARROW_PARALLEL'])) # run cmake - print("-- Running cmake for pyarrow cpp") + print("-- Running CMake for PyArrow C++") self.spawn(['cmake'] + cmake_options + [source_pyarrow_cpp]) - print("-- Finished cmake for pyarrow cpp") + print("-- Finished CMake for PyArrow C++") # run make & install - print("-- Running cmake build and install for pyarrow cpp") + print("-- Running CMake build and install for PyArrow C++") self.spawn(['cmake', '--build', '.', '--config', self.build_type, '--target', 'install'] + build_tool_args) - print("-- Finished cmake build and install for pyarrow cpp") - - # Move the libraries to the place expected by the Python build - try: - os.makedirs(pjoin(build_lib, 'pyarrow')) - except OSError: - pass + print("-- Finished CMake build and install for PyArrow C++") - # helper function - def copy_libs(folder_name): - for libname in os.listdir(pjoin(build_dir, folder_name)): - if "python" in libname: - libname_path = pjoin(build_lib, "pyarrow", libname) - if os.path.exists(libname_path): - os.remove(libname_path) - print( - f"Copying {pjoin(build_dir, folder_name, libname)}" - f" to {pjoin(build_lib, 'pyarrow', libname)}") - shutil.copy(pjoin(build_dir, folder_name, libname), - pjoin(build_lib, "pyarrow")) - - # Move libraries to python/pyarrow - # For windows builds, move dll from bin - try: - copy_libs("bin") - except OSError: - pass - try: - folder_name, = (name for name in ["lib", "lib64"] - if os.path.exists(pjoin(build_dir, name))) - copy_libs(folder_name) - except ValueError: - print("There are multiple or none libraries for PyArrow cpp ") - print("installed in the python/build/dist folder. Check the ") - print("installation process and be sure there is exactly one ") - print("library folder created") - - # Copy headers to python/pyarrow/include - pyarrow_cpp_include = pjoin(build_include, "arrow", "python") - pyarrow_include = pjoin( - build_lib, "pyarrow", "include", "arrow", "python") - if os.path.exists(pyarrow_include): - shutil.rmtree(pyarrow_include) - print( - f"Copying include folder: {pyarrow_cpp_include}" - f" to {pyarrow_include}") - shutil.copytree(pyarrow_cpp_include, pyarrow_include) - - def _run_cmake(self): + def _run_cmake(self, pyarrow_cpp_home): # check if build_type is correctly passed / set if self.build_type.lower() not in ('release', 'debug'): raise ValueError("--build-type (or PYARROW_BUILD_TYPE) needs to " @@ -359,9 +305,9 @@ def _run_cmake(self): # The staging directory for the module being built build_cmd = self.get_finalized_command('build') - build_temp = pjoin(os.getcwd(), build_cmd.build_temp) - build_lib = pjoin(os.getcwd(), build_cmd.build_lib) saved_cwd = os.getcwd() + build_temp = pjoin(saved_cwd, build_cmd.build_temp) + build_lib = pjoin(saved_cwd, build_cmd.build_lib) if not os.path.isdir(build_temp): self.mkpath(build_temp) @@ -391,7 +337,7 @@ def _run_cmake(self): cmake_options = [ '-DPYTHON_EXECUTABLE=%s' % sys.executable, '-DPython3_EXECUTABLE=%s' % sys.executable, - '-DPYARROW_CPP_HOME=' + str(pjoin(build_lib, "pyarrow")), + '-DPYARROW_CPP_HOME=' + str(pyarrow_cpp_home), static_lib_option, ] @@ -449,14 +395,14 @@ def append_cmake_bool(value, varname): '-j{0}'.format(os.environ['PYARROW_PARALLEL'])) # Generate the build files - print("-- Running cmake for pyarrow") + print("-- Running cmake for PyArrow") self.spawn(['cmake'] + extra_cmake_args + cmake_options + [source]) - print("-- Finished cmake for pyarrow") + print("-- Finished cmake for PyArrow") - print("-- Running cmake --build for pyarrow") + print("-- Running cmake --build for PyArrow") self.spawn(['cmake', '--build', '.', '--config', self.build_type] + build_tool_args) - print("-- Finished cmake --build for pyarrow") + print("-- Finished cmake --build for PyArrow") # Move the libraries to the place expected by the Python build try: @@ -464,27 +410,42 @@ def append_cmake_bool(value, varname): except OSError: pass + def copy_libs(dir): + for path in os.listdir(pjoin(pyarrow_cpp_home, dir)): + if "python" in path: + pyarrow_path = pjoin(build_lib, "pyarrow", path) + if os.path.exists(pyarrow_path): + os.remove(pyarrow_path) + pyarrow_cpp_path = pjoin(pyarrow_cpp_home, dir, path) + print(f"Copying {pyarrow_cpp_path} to {pyarrow_path}") + shutil.copy(pyarrow_cpp_path, pyarrow_path) + + # Move libraries to python/pyarrow + # For windows builds, move DLL from bin/ + try: + copy_libs("bin") + except OSError: + pass + copy_libs("lib") + if sys.platform == 'win32': build_prefix = '' else: build_prefix = self.build_type if self.bundle_arrow_cpp or self.bundle_arrow_cpp_headers: - print('Bundling includes: ' + pjoin(build_prefix, 'include')) - if os.path.exists(pjoin(build_lib, 'pyarrow', 'include')): - shutil.rmtree(pjoin(build_lib, 'pyarrow', 'include')) - shutil.move(pjoin(build_prefix, 'include'), - pjoin(build_lib, 'pyarrow')) + arrow_cpp_include = pjoin(build_prefix, 'include') + print('Bundling includes: ' + arrow_cpp_include) + pyarrow_include = pjoin(build_lib, 'pyarrow', 'include') + if os.path.exists(pyarrow_include): + shutil.rmtree(pyarrow_include) + shutil.move(arrow_cpp_include, pyarrow_include) # pyarrow/include file is first deleted in the previous step - # so we need to add the PyArrow cpp include folder again - build_pyarrow_cpp_include = pjoin( - saved_cwd, 'build/dist/include') - shutil.move(pjoin( - build_pyarrow_cpp_include, "arrow", "python"), - pjoin( - build_lib, "pyarrow", "include", - "arrow", "python")) + # so we need to add the PyArrow C++ include folder again + pyarrow_cpp_include = pjoin(pyarrow_cpp_home, 'include') + shutil.move(pjoin(pyarrow_cpp_include, 'arrow', 'python'), + pjoin(pyarrow_include, 'arrow', 'python')) # Move the built C-extension to the place expected by the Python # build @@ -497,7 +458,7 @@ def append_cmake_bool(value, varname): print('Cython module {0} failure permitted' .format(name)) continue - raise RuntimeError('pyarrow C-extension failed to build:', + raise RuntimeError('PyArrow C-extension failed to build:', os.path.abspath(built_path)) # The destination path to move the built C extension to diff --git a/r/configure b/r/configure index 68dfd5f5eeee1..eab213b631f3e 100755 --- a/r/configure +++ b/r/configure @@ -229,7 +229,7 @@ echo "#include $PKG_TEST_HEADER" | ${TEST_CMD} >/dev/null 2>&1 if [ $? -eq 0 ]; then # Check for features LIB_DIR=`echo $PKG_DIRS | sed -e 's/^-L//'` - ARROW_OPTS_CMAKE="$LIB_DIR/cmake/arrow/ArrowOptions.cmake" + ARROW_OPTS_CMAKE="$LIB_DIR/cmake/Arrow/ArrowOptions.cmake" arrow_built_with() { # Function to check cmake options for features diff --git a/r/configure.win b/r/configure.win index 7aa7e47fc1d8b..8aa05ef5970d6 100755 --- a/r/configure.win +++ b/r/configure.win @@ -63,7 +63,7 @@ function configure_release() { -DARROW_R_WITH_JSON" PKG_LIBS="-L${RWINLIB}/lib"'$(subst gcc,,$(COMPILED_BY))$(R_ARCH) ' PKG_LIBS="$PKG_LIBS -L${RWINLIB}/lib"'$(R_ARCH)$(CRT) ' - PKG_LIBS="$PKG_LIBS -lparquet -larrow_dataset -larrow -larrow_bundled_dependencies \ + PKG_LIBS="$PKG_LIBS -larrow_dataset -lparquet -larrow -larrow_bundled_dependencies \ -lutf8proc -lthrift -lsnappy -lz -lzstd -llz4 -lbz2 ${BROTLI_LIBS} -lole32 \ ${MIMALLOC_LIBS} ${OPENSSL_LIBS}" @@ -80,7 +80,7 @@ function configure_release() { # Returns 1 if CMAKE options is set "ON", otherwise 0 function cmake_option() { - ARROW_OPTS_CMAKE="$ARROW_HOME/lib/cmake/arrow/ArrowOptions.cmake" + ARROW_OPTS_CMAKE="$ARROW_HOME/lib/cmake/Arrow/ArrowOptions.cmake" grep -cm1 "set($1 \"ON\")" $ARROW_OPTS_CMAKE }