From c56dc1270fe2e76903e9356c7a920da3cfc998ec Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 30 Dec 2020 11:45:40 +0000 Subject: [PATCH] run cmake format --- .pre-commit-config.yaml | 7 +- cpp/CMakeLists.txt | 349 +++-- cpp/cmake_modules/BuildUtils.cmake | 315 ++--- cpp/cmake_modules/DefineOptions.cmake | 163 +-- cpp/cmake_modules/FindArrow.cmake | 262 ++-- cpp/cmake_modules/FindArrowCUDA.cmake | 36 +- cpp/cmake_modules/FindArrowDataset.cmake | 39 +- cpp/cmake_modules/FindArrowFlight.cmake | 38 +- .../FindArrowFlightTesting.cmake | 39 +- cpp/cmake_modules/FindArrowPython.cmake | 38 +- cpp/cmake_modules/FindArrowPythonFlight.cmake | 39 +- cpp/cmake_modules/FindArrowTesting.cmake | 39 +- cpp/cmake_modules/FindBoostAlt.cmake | 6 +- cpp/cmake_modules/FindBrotli.cmake | 132 +- cpp/cmake_modules/FindClangTools.cmake | 46 +- cpp/cmake_modules/FindGLOG.cmake | 49 +- cpp/cmake_modules/FindGandiva.cmake | 43 +- cpp/cmake_modules/FindInferTools.cmake | 15 +- cpp/cmake_modules/FindLLVMAlt.cmake | 59 +- cpp/cmake_modules/FindLz4.cmake | 63 +- cpp/cmake_modules/FindNumPy.cmake | 53 +- cpp/cmake_modules/FindORC.cmake | 43 +- cpp/cmake_modules/FindParquet.cmake | 47 +- cpp/cmake_modules/FindPlasma.cmake | 44 +- cpp/cmake_modules/FindPython3Alt.cmake | 24 +- cpp/cmake_modules/FindPythonLibsNew.cmake | 191 ++- cpp/cmake_modules/FindRapidJSONAlt.cmake | 46 +- cpp/cmake_modules/FindSnappy.cmake | 44 +- cpp/cmake_modules/FindThrift.cmake | 90 +- cpp/cmake_modules/FindgRPCAlt.cmake | 247 ++-- cpp/cmake_modules/FindgflagsAlt.cmake | 35 +- cpp/cmake_modules/Findjemalloc.cmake | 33 +- cpp/cmake_modules/Findre2Alt.cmake | 41 +- cpp/cmake_modules/Findutf8proc.cmake | 36 +- cpp/cmake_modules/Findzstd.cmake | 62 +- cpp/cmake_modules/SetupCxxFlags.cmake | 82 +- cpp/cmake_modules/ThirdpartyToolchain.cmake | 1171 ++++++++--------- cpp/cmake_modules/UseCython.cmake | 65 +- cpp/cmake_modules/san-config.cmake | 68 +- cpp/examples/arrow/CMakeLists.txt | 11 +- cpp/examples/minimal_build/CMakeLists.txt | 2 +- cpp/examples/parquet/CMakeLists.txt | 40 +- cpp/src/arrow/CMakeLists.txt | 396 +++--- cpp/src/arrow/adapters/orc/CMakeLists.txt | 20 +- cpp/src/arrow/compute/CMakeLists.txt | 30 +- cpp/src/arrow/compute/kernels/CMakeLists.txt | 40 +- cpp/src/arrow/csv/CMakeLists.txt | 15 +- cpp/src/arrow/dataset/CMakeLists.txt | 57 +- cpp/src/arrow/dbi/hiveserver2/CMakeLists.txt | 57 +- .../dbi/hiveserver2/thrift/CMakeLists.txt | 51 +- cpp/src/arrow/filesystem/CMakeLists.txt | 23 +- cpp/src/arrow/flight/CMakeLists.txt | 176 +-- cpp/src/arrow/gpu/CMakeLists.txt | 34 +- cpp/src/arrow/ipc/CMakeLists.txt | 13 +- cpp/src/arrow/json/CMakeLists.txt | 17 +- cpp/src/arrow/python/CMakeLists.txt | 129 +- cpp/src/arrow/python/util/CMakeLists.txt | 4 +- cpp/src/arrow/util/CMakeLists.txt | 56 +- cpp/src/gandiva/CMakeLists.txt | 132 +- cpp/src/gandiva/jni/CMakeLists.txt | 72 +- cpp/src/gandiva/precompiled/CMakeLists.txt | 132 +- cpp/src/gandiva/tests/CMakeLists.txt | 6 +- cpp/src/jni/orc/CMakeLists.txt | 37 +- cpp/src/parquet/CMakeLists.txt | 257 ++-- cpp/src/plasma/CMakeLists.txt | 101 +- go/arrow/math/_lib/CMakeLists.txt | 2 - go/arrow/memory/_lib/CMakeLists.txt | 2 - java/adapter/orc/CMakeLists.txt | 21 +- java/gandiva/CMakeLists.txt | 22 +- matlab/CMakeLists.txt | 25 +- python/CMakeLists.txt | 62 +- 71 files changed, 3006 insertions(+), 3235 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e70eaceaf4176..a741e80e58d00 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,9 +40,10 @@ repos: - id: cmake-format name: CMake Format language: python - entry: bash -c "pip install cmake-format && python run-cmake-format.py --check" - entry: echo - files: ^(.*/CMakeLists.txt|.*.cmake)$ + entry: cmake-format --in-place --autosort=false + files: CMakeLists\.txt$|^cpp/cmake_modules/ + additional_dependencies: + - cmake_format==0.6.13 - id: hadolint name: Docker Format language: docker_image diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 30f919607a89c..93bf288c84408 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -53,7 +53,9 @@ string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" ARROW_BASE_VERSION "${ARROW_VERSI # if no build build type is specified, default to release builds if(NOT DEFINED CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build.") + set(CMAKE_BUILD_TYPE + Release + CACHE STRING "Choose the type of build.") endif() string(TOLOWER ${CMAKE_BUILD_TYPE} LOWERCASE_BUILD_TYPE) string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_BUILD_TYPE) @@ -102,46 +104,41 @@ set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support") set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}") -set(ARROW_LLVM_VERSIONS - "11" - "10" - "9" - "8" - "7") +set(ARROW_LLVM_VERSIONS "11" "10" "9" "8" "7") list(GET ARROW_LLVM_VERSIONS 0 ARROW_LLVM_VERSION_PRIMARY) -string(REGEX - REPLACE "^([0-9]+)(\\..+)?" "\\1" ARROW_LLVM_VERSION_PRIMARY_MAJOR - "${ARROW_LLVM_VERSION_PRIMARY}") +string(REGEX REPLACE "^([0-9]+)(\\..+)?" "\\1" ARROW_LLVM_VERSION_PRIMARY_MAJOR + "${ARROW_LLVM_VERSION_PRIMARY}") file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.env ARROW_ENV) string(REGEX MATCH "CLANG_TOOLS=[^\n]+" ARROW_ENV_CLANG_TOOLS_VERSION "${ARROW_ENV}") -string(REGEX - REPLACE "^CLANG_TOOLS=" "" ARROW_CLANG_TOOLS_VERSION - "${ARROW_ENV_CLANG_TOOLS_VERSION}") -string(REGEX - REPLACE "^([0-9]+)(\\..+)?" "\\1" ARROW_CLANG_TOOLS_VERSION_MAJOR - "${ARROW_CLANG_TOOLS_VERSION}") +string(REGEX REPLACE "^CLANG_TOOLS=" "" ARROW_CLANG_TOOLS_VERSION + "${ARROW_ENV_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) + 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) + 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) + 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) + execute_process( + COMMAND ${BREW_BIN} --prefix llvm + OUTPUT_VARIABLE CLANG_TOOLS_BREW_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) endif() endif() endif() @@ -155,7 +152,9 @@ endif() find_package(ClangTools) find_package(InferTools) -if("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR CLANG_TIDY_FOUND OR INFER_FOUND) +if("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" + OR CLANG_TIDY_FOUND + OR INFER_FOUND) # Generate a Clang compile_commands.json "compilation database" file for use # with various development tools, such as Vim's YouCompleteMe plugin. # See http://clang.llvm.org/docs/JSONCompilationDatabase.html @@ -218,52 +217,58 @@ if(NOT LINT_EXCLUSIONS_FILE) set(LINT_EXCLUSIONS_FILE ${BUILD_SUPPORT_DIR}/lint_exclusions.txt) endif() -find_program(CPPLINT_BIN NAMES cpplint cpplint.py HINTS ${BUILD_SUPPORT_DIR}) +find_program( + CPPLINT_BIN + NAMES cpplint cpplint.py + HINTS ${BUILD_SUPPORT_DIR}) message(STATUS "Found cpplint executable at ${CPPLINT_BIN}") -add_custom_target(lint - ${PYTHON_EXECUTABLE} - ${BUILD_SUPPORT_DIR}/run_cpplint.py - --cpplint_binary - ${CPPLINT_BIN} - --exclude_globs - ${LINT_EXCLUSIONS_FILE} - --source_dir - ${CMAKE_CURRENT_SOURCE_DIR}/src - ${ARROW_LINT_QUIET}) +add_custom_target( + lint + ${PYTHON_EXECUTABLE} + ${BUILD_SUPPORT_DIR}/run_cpplint.py + --cpplint_binary + ${CPPLINT_BIN} + --exclude_globs + ${LINT_EXCLUSIONS_FILE} + --source_dir + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${ARROW_LINT_QUIET}) # # "make format" and "make check-format" targets # if(${CLANG_FORMAT_FOUND}) # runs clang format and updates files in place. - add_custom_target(format - ${PYTHON_EXECUTABLE} - ${BUILD_SUPPORT_DIR}/run_clang_format.py - --clang_format_binary - ${CLANG_FORMAT_BIN} - --exclude_globs - ${LINT_EXCLUSIONS_FILE} - --source_dir - ${CMAKE_CURRENT_SOURCE_DIR}/src - --fix - ${ARROW_LINT_QUIET}) + add_custom_target( + format + ${PYTHON_EXECUTABLE} + ${BUILD_SUPPORT_DIR}/run_clang_format.py + --clang_format_binary + ${CLANG_FORMAT_BIN} + --exclude_globs + ${LINT_EXCLUSIONS_FILE} + --source_dir + ${CMAKE_CURRENT_SOURCE_DIR}/src + --fix + ${ARROW_LINT_QUIET}) # runs clang format and exits with a non-zero exit code if any files need to be reformatted - add_custom_target(check-format - ${PYTHON_EXECUTABLE} - ${BUILD_SUPPORT_DIR}/run_clang_format.py - --clang_format_binary - ${CLANG_FORMAT_BIN} - --exclude_globs - ${LINT_EXCLUSIONS_FILE} - --source_dir - ${CMAKE_CURRENT_SOURCE_DIR}/src - ${ARROW_LINT_QUIET}) + add_custom_target( + check-format + ${PYTHON_EXECUTABLE} + ${BUILD_SUPPORT_DIR}/run_clang_format.py + --clang_format_binary + ${CLANG_FORMAT_BIN} + --exclude_globs + ${LINT_EXCLUSIONS_FILE} + --source_dir + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${ARROW_LINT_QUIET}) endif() add_custom_target(lint_cpp_cli ${PYTHON_EXECUTABLE} ${BUILD_SUPPORT_DIR}/lint_cpp_cli.py - ${CMAKE_CURRENT_SOURCE_DIR}/src) + ${CMAKE_CURRENT_SOURCE_DIR}/src) if(ARROW_LINT_ONLY) message("ARROW_LINT_ONLY was specified, this is only a partial build directory") @@ -277,33 +282,35 @@ if(${CLANG_TIDY_FOUND}) # TODO check to make sure .clang-tidy is being respected # runs clang-tidy and attempts to fix any warning automatically - add_custom_target(clang-tidy - ${PYTHON_EXECUTABLE} - ${BUILD_SUPPORT_DIR}/run_clang_tidy.py - --clang_tidy_binary - ${CLANG_TIDY_BIN} - --exclude_globs - ${LINT_EXCLUSIONS_FILE} - --compile_commands - ${CMAKE_BINARY_DIR}/compile_commands.json - --source_dir - ${CMAKE_CURRENT_SOURCE_DIR}/src - --fix - ${ARROW_LINT_QUIET}) + add_custom_target( + clang-tidy + ${PYTHON_EXECUTABLE} + ${BUILD_SUPPORT_DIR}/run_clang_tidy.py + --clang_tidy_binary + ${CLANG_TIDY_BIN} + --exclude_globs + ${LINT_EXCLUSIONS_FILE} + --compile_commands + ${CMAKE_BINARY_DIR}/compile_commands.json + --source_dir + ${CMAKE_CURRENT_SOURCE_DIR}/src + --fix + ${ARROW_LINT_QUIET}) # runs clang-tidy and exits with a non-zero exit code if any errors are found. - add_custom_target(check-clang-tidy - ${PYTHON_EXECUTABLE} - ${BUILD_SUPPORT_DIR}/run_clang_tidy.py - --clang_tidy_binary - ${CLANG_TIDY_BIN} - --exclude_globs - ${LINT_EXCLUSIONS_FILE} - --compile_commands - ${CMAKE_BINARY_DIR}/compile_commands.json - --source_dir - ${CMAKE_CURRENT_SOURCE_DIR}/src - ${ARROW_LINT_QUIET}) + add_custom_target( + check-clang-tidy + ${PYTHON_EXECUTABLE} + ${BUILD_SUPPORT_DIR}/run_clang_tidy.py + --clang_tidy_binary + ${CLANG_TIDY_BIN} + --exclude_globs + ${LINT_EXCLUSIONS_FILE} + --compile_commands + ${CMAKE_BINARY_DIR}/compile_commands.json + --source_dir + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${ARROW_LINT_QUIET}) endif() if(UNIX) @@ -380,12 +387,7 @@ if(NOT ARROW_BUILD_TESTS) set(NO_TESTS 1) else() add_custom_target(all-tests) - add_custom_target(unittest - ctest - -j4 - -L - unittest - --output-on-failure) + add_custom_target(unittest ctest -j4 -L unittest --output-on-failure) add_dependencies(unittest all-tests) endif() @@ -457,10 +459,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) if(NOT APPLE) set(MORE_ARGS "-T") endif() - execute_process(COMMAND ln - ${MORE_ARGS} - -sf - ${BUILD_OUTPUT_ROOT_DIRECTORY} + execute_process(COMMAND ln ${MORE_ARGS} -sf ${BUILD_OUTPUT_ROOT_DIRECTORY} ${CMAKE_CURRENT_BINARY_DIR}/build/latest) else() set(BUILD_OUTPUT_ROOT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${BUILD_SUBDIR_NAME}/") @@ -537,13 +536,11 @@ include_directories(src/generated) # Visibility # if(PARQUET_BUILD_SHARED) - set_target_properties(arrow_shared - PROPERTIES C_VISIBILITY_PRESET - hidden - CXX_VISIBILITY_PRESET - hidden - VISIBILITY_INLINES_HIDDEN - 1) + set_target_properties( + arrow_shared + PROPERTIES C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN 1) endif() # @@ -557,29 +554,30 @@ endif(UNIX) # "make etags" target # if(UNIX) - add_custom_target(tags - etags - --members - --declarations - `find - ${CMAKE_CURRENT_SOURCE_DIR}/src - -name - \\*.cc - -or - -name - \\*.hh - -or - -name - \\*.cpp - -or - -name - \\*.h - -or - -name - \\*.c - -or - -name - \\*.f`) + add_custom_target( + tags + etags + --members + --declarations + `find + ${CMAKE_CURRENT_SOURCE_DIR}/src + -name + \\*.cc + -or + -name + \\*.hh + -or + -name + \\*.cpp + -or + -name + \\*.h + -or + -name + \\*.c + -or + -name + \\*.f`) add_custom_target(etags DEPENDS tags) endif(UNIX) @@ -587,35 +585,38 @@ endif(UNIX) # "make cscope" target # if(UNIX) - add_custom_target(cscope find ${CMAKE_CURRENT_SOURCE_DIR} - (-name - \\*.cc - -or - -name - \\*.hh - -or - -name - \\*.cpp - -or - -name - \\*.h - -or - -name - \\*.c - -or - -name - \\*.f) - -exec - echo - \"{}\" - \; - > - cscope.files - && - cscope - -q - -b - VERBATIM) + add_custom_target( + cscope + find + ${CMAKE_CURRENT_SOURCE_DIR} + (-name + \\*.cc + -or + -name + \\*.hh + -or + -name + \\*.cpp + -or + -name + \\*.h + -or + -name + \\*.c + -or + -name + \\*.f) + -exec + echo + \"{}\" + \; + > + cscope.files + && + cscope + -q + -b + VERBATIM) endif(UNIX) # @@ -624,23 +625,14 @@ endif(UNIX) if(${INFER_FOUND}) # runs infer capture - add_custom_target(infer - ${BUILD_SUPPORT_DIR}/run-infer.sh - ${INFER_BIN} - ${CMAKE_BINARY_DIR}/compile_commands.json - 1) + add_custom_target(infer ${BUILD_SUPPORT_DIR}/run-infer.sh ${INFER_BIN} + ${CMAKE_BINARY_DIR}/compile_commands.json 1) # runs infer analyze - add_custom_target(infer-analyze - ${BUILD_SUPPORT_DIR}/run-infer.sh - ${INFER_BIN} - ${CMAKE_BINARY_DIR}/compile_commands.json - 2) + add_custom_target(infer-analyze ${BUILD_SUPPORT_DIR}/run-infer.sh ${INFER_BIN} + ${CMAKE_BINARY_DIR}/compile_commands.json 2) # runs infer report - add_custom_target(infer-report - ${BUILD_SUPPORT_DIR}/run-infer.sh - ${INFER_BIN} - ${CMAKE_BINARY_DIR}/compile_commands.json - 3) + add_custom_target(infer-report ${BUILD_SUPPORT_DIR}/run-infer.sh ${INFER_BIN} + ${CMAKE_BINARY_DIR}/compile_commands.json 3) endif() # @@ -709,7 +701,7 @@ if(ARROW_ORC) 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 - ${ARROW_PROTOBUF_LIBPROTOBUF}) + ${ARROW_PROTOBUF_LIBPROTOBUF}) endif() endif() @@ -775,12 +767,8 @@ if(NOT MSVC_TOOLCHAIN) list(APPEND ARROW_SHARED_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS}) endif() -set(ARROW_TEST_LINK_TOOLCHAIN - GTest::gtest_main - GTest::gtest - GTest::gmock - ${BOOST_FILESYSTEM_LIBRARY} - ${BOOST_SYSTEM_LIBRARY}) +set(ARROW_TEST_LINK_TOOLCHAIN GTest::gtest_main GTest::gtest GTest::gmock + ${BOOST_FILESYSTEM_LIBRARY} ${BOOST_SYSTEM_LIBRARY}) if(ARROW_BUILD_TESTS) add_dependencies(arrow_test_dependencies ${ARROW_TEST_LINK_TOOLCHAIN}) @@ -904,8 +892,7 @@ endif() install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE.txt ${CMAKE_CURRENT_SOURCE_DIR}/../NOTICE.txt - ${CMAKE_CURRENT_SOURCE_DIR}/README.md - DESTINATION "${ARROW_DOC_DIR}") + ${CMAKE_CURRENT_SOURCE_DIR}/README.md DESTINATION "${ARROW_DOC_DIR}") # # Validate and print out Arrow configuration options diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index 2fd897b5d1d85..e3e3cd94d4fc1 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -50,10 +50,7 @@ function(ADD_THIRDPARTY_LIB LIB_NAME) set(options) set(one_value_args SHARED_LIB STATIC_LIB) set(multi_value_args DEPS INCLUDE_DIRECTORIES) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") @@ -62,17 +59,16 @@ function(ADD_THIRDPARTY_LIB LIB_NAME) if(ARG_STATIC_LIB AND ARG_SHARED_LIB) set(AUG_LIB_NAME "${LIB_NAME}_static") add_library(${AUG_LIB_NAME} STATIC IMPORTED) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES IMPORTED_LOCATION "${ARG_STATIC_LIB}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES IMPORTED_LOCATION + "${ARG_STATIC_LIB}") if(ARG_DEPS) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES INTERFACE_LINK_LIBRARIES "${ARG_DEPS}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES INTERFACE_LINK_LIBRARIES + "${ARG_DEPS}") endif() message(STATUS "Added static library dependency ${AUG_LIB_NAME}: ${ARG_STATIC_LIB}") if(ARG_INCLUDE_DIRECTORIES) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${ARG_INCLUDE_DIRECTORIES}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${ARG_INCLUDE_DIRECTORIES}") endif() set(AUG_LIB_NAME "${LIB_NAME}_shared") @@ -80,36 +76,34 @@ function(ADD_THIRDPARTY_LIB LIB_NAME) if(WIN32) # Mark the ".lib" location as part of a Windows DLL - set_target_properties(${AUG_LIB_NAME} - PROPERTIES IMPORTED_IMPLIB "${ARG_SHARED_LIB}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES IMPORTED_IMPLIB + "${ARG_SHARED_LIB}") else() - set_target_properties(${AUG_LIB_NAME} - PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES IMPORTED_LOCATION + "${ARG_SHARED_LIB}") endif() if(ARG_DEPS) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES INTERFACE_LINK_LIBRARIES "${ARG_DEPS}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES INTERFACE_LINK_LIBRARIES + "${ARG_DEPS}") endif() message(STATUS "Added shared library dependency ${AUG_LIB_NAME}: ${ARG_SHARED_LIB}") if(ARG_INCLUDE_DIRECTORIES) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${ARG_INCLUDE_DIRECTORIES}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${ARG_INCLUDE_DIRECTORIES}") endif() elseif(ARG_STATIC_LIB) set(AUG_LIB_NAME "${LIB_NAME}_static") add_library(${AUG_LIB_NAME} STATIC IMPORTED) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES IMPORTED_LOCATION "${ARG_STATIC_LIB}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES IMPORTED_LOCATION + "${ARG_STATIC_LIB}") if(ARG_DEPS) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES INTERFACE_LINK_LIBRARIES "${ARG_DEPS}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES INTERFACE_LINK_LIBRARIES + "${ARG_DEPS}") endif() message(STATUS "Added static library dependency ${AUG_LIB_NAME}: ${ARG_STATIC_LIB}") if(ARG_INCLUDE_DIRECTORIES) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${ARG_INCLUDE_DIRECTORIES}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${ARG_INCLUDE_DIRECTORIES}") endif() elseif(ARG_SHARED_LIB) set(AUG_LIB_NAME "${LIB_NAME}_shared") @@ -117,21 +111,20 @@ function(ADD_THIRDPARTY_LIB LIB_NAME) if(WIN32) # Mark the ".lib" location as part of a Windows DLL - set_target_properties(${AUG_LIB_NAME} - PROPERTIES IMPORTED_IMPLIB "${ARG_SHARED_LIB}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES IMPORTED_IMPLIB + "${ARG_SHARED_LIB}") else() - set_target_properties(${AUG_LIB_NAME} - PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES IMPORTED_LOCATION + "${ARG_SHARED_LIB}") endif() message(STATUS "Added shared library dependency ${AUG_LIB_NAME}: ${ARG_SHARED_LIB}") if(ARG_DEPS) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES INTERFACE_LINK_LIBRARIES "${ARG_DEPS}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES INTERFACE_LINK_LIBRARIES + "${ARG_DEPS}") endif() if(ARG_INCLUDE_DIRECTORIES) - set_target_properties(${AUG_LIB_NAME} - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${ARG_INCLUDE_DIRECTORIES}") + set_target_properties(${AUG_LIB_NAME} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${ARG_INCLUDE_DIRECTORIES}") endif() else() message(FATAL_ERROR "No static or shared library provided for ${LIB_NAME}") @@ -150,19 +143,15 @@ function(create_merged_static_lib output_target) set(options) set(one_value_args NAME ROOT) set(multi_value_args TO_MERGE) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() - set( - output_lib_path - ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_STATIC_LIBRARY_PREFIX}${ARG_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} - ) + set(output_lib_path + ${BUILD_OUTPUT_ROOT_DIRECTORY}${CMAKE_STATIC_LIBRARY_PREFIX}${ARG_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} + ) set(all_library_paths $) foreach(lib ${ARG_TO_MERGE}) @@ -170,13 +159,8 @@ function(create_merged_static_lib output_target) endforeach() if(APPLE) - set(BUNDLE_COMMAND - "libtool" - "-no_warning_for_no_symbols" - "-static" - "-o" - ${output_lib_path} - ${all_library_paths}) + set(BUNDLE_COMMAND "libtool" "-no_warning_for_no_symbols" "-static" "-o" + ${output_lib_path} ${all_library_paths}) elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|GNU|Intel)$") set(ar_script_path ${CMAKE_BINARY_DIR}/${ARG_NAME}.ar) @@ -188,7 +172,10 @@ function(create_merged_static_lib output_target) endforeach() file(APPEND ${ar_script_path}.in "SAVE\nEND\n") - file(GENERATE OUTPUT ${ar_script_path} INPUT ${ar_script_path}.in) + file( + GENERATE + OUTPUT ${ar_script_path} + INPUT ${ar_script_path}.in) set(ar_tool ${CMAKE_AR}) if(CMAKE_INTERPROCEDURAL_OPTIMIZATION) @@ -213,14 +200,15 @@ 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_command( + COMMAND ${BUNDLE_COMMAND} + OUTPUT ${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}) @@ -230,13 +218,8 @@ endfunction() # \arg OUTPUTS list to append built targets to function(ADD_ARROW_LIB LIB_NAME) set(options) - set(one_value_args - BUILD_SHARED - BUILD_STATIC - CMAKE_PACKAGE_NAME - PKG_CONFIG_NAME - SHARED_LINK_FLAGS - PRECOMPILED_HEADER_LIB) + set(one_value_args BUILD_SHARED BUILD_STATIC CMAKE_PACKAGE_NAME PKG_CONFIG_NAME + SHARED_LINK_FLAGS PRECOMPILED_HEADER_LIB) set(multi_value_args SOURCES PRECOMPILED_HEADERS @@ -250,10 +233,7 @@ function(ADD_ARROW_LIB LIB_NAME) SHARED_INSTALL_INTERFACE_LIBS STATIC_INSTALL_INTERFACE_LIBS OUTPUT_PATH) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") @@ -355,7 +335,9 @@ function(ADD_ARROW_LIB LIB_NAME) endif() # On iOS, specifying -undefined conflicts with enabling bitcode - if(APPLE AND NOT IOS AND NOT DEFINED ENV{EMSCRIPTEN}) + if(APPLE + AND NOT IOS + AND NOT DEFINED ENV{EMSCRIPTEN}) # On OS X, you can avoid linking at library load time and instead # expecting that the symbols have been loaded separately. This happens # with libpython* where there can be conflicts between system Python and @@ -366,28 +348,20 @@ function(ADD_ARROW_LIB LIB_NAME) set(ARG_SHARED_LINK_FLAGS "-undefined dynamic_lookup ${ARG_SHARED_LINK_FLAGS}") endif() - set_target_properties(${LIB_NAME}_shared - PROPERTIES LIBRARY_OUTPUT_DIRECTORY - "${OUTPUT_PATH}" - RUNTIME_OUTPUT_DIRECTORY - "${OUTPUT_PATH}" - PDB_OUTPUT_DIRECTORY - "${OUTPUT_PATH}" - LINK_FLAGS - "${ARG_SHARED_LINK_FLAGS}" - OUTPUT_NAME - ${LIB_NAME} - VERSION - "${ARROW_FULL_SO_VERSION}" - SOVERSION - "${ARROW_SO_VERSION}") - - target_link_libraries(${LIB_NAME}_shared - LINK_PUBLIC - "$" - "$" - LINK_PRIVATE - ${ARG_SHARED_PRIVATE_LINK_LIBS}) + set_target_properties( + ${LIB_NAME}_shared + PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_PATH}" + RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_PATH}" + PDB_OUTPUT_DIRECTORY "${OUTPUT_PATH}" + LINK_FLAGS "${ARG_SHARED_LINK_FLAGS}" + OUTPUT_NAME ${LIB_NAME} + VERSION "${ARROW_FULL_SO_VERSION}" + SOVERSION "${ARROW_SO_VERSION}") + + target_link_libraries( + ${LIB_NAME}_shared LINK_PUBLIC "$" + "$" LINK_PRIVATE + ${ARG_SHARED_PRIVATE_LINK_LIBS}) if(ARROW_RPATH_ORIGIN) if(APPLE) @@ -395,8 +369,8 @@ function(ADD_ARROW_LIB LIB_NAME) else() set(_lib_install_rpath "\$ORIGIN") endif() - set_target_properties(${LIB_NAME}_shared - PROPERTIES INSTALL_RPATH ${_lib_install_rpath}) + set_target_properties(${LIB_NAME}_shared PROPERTIES INSTALL_RPATH + ${_lib_install_rpath}) endif() if(APPLE) @@ -405,17 +379,19 @@ function(ADD_ARROW_LIB LIB_NAME) else() set(_lib_install_name "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") endif() - set_target_properties(${LIB_NAME}_shared - PROPERTIES BUILD_WITH_INSTALL_RPATH ON INSTALL_NAME_DIR - "${_lib_install_name}") + set_target_properties( + ${LIB_NAME}_shared PROPERTIES BUILD_WITH_INSTALL_RPATH ON INSTALL_NAME_DIR + "${_lib_install_name}") endif() - install(TARGETS ${LIB_NAME}_shared ${INSTALL_IS_OPTIONAL} - EXPORT ${LIB_NAME}_targets - RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install( + TARGETS ${LIB_NAME}_shared ${INSTALL_IS_OPTIONAL} + EXPORT ${LIB_NAME}_targets + RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) endif() if(BUILD_STATIC) @@ -450,9 +426,9 @@ function(ADD_ARROW_LIB LIB_NAME) target_compile_definitions(${LIB_NAME}_static PUBLIC ARROW_STATIC) endif() - set_target_properties(${LIB_NAME}_static - PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_PATH}" OUTPUT_NAME - ${LIB_NAME_STATIC}) + set_target_properties( + ${LIB_NAME}_static PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_PATH}" + OUTPUT_NAME ${LIB_NAME_STATIC}) if(ARG_STATIC_INSTALL_INTERFACE_LIBS) target_link_libraries(${LIB_NAME}_static LINK_PUBLIC @@ -464,21 +440,24 @@ function(ADD_ARROW_LIB LIB_NAME) "$") endif() - install(TARGETS ${LIB_NAME}_static ${INSTALL_IS_OPTIONAL} - EXPORT ${LIB_NAME}_targets - RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install( + TARGETS ${LIB_NAME}_static ${INSTALL_IS_OPTIONAL} + EXPORT ${LIB_NAME}_targets + RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 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_INSTALL_DIR}") + install( + EXPORT ${LIB_NAME}_targets + FILE "${TARGETS_CMAKE}" + DESTINATION "${ARROW_CMAKE_INSTALL_DIR}") set(CONFIG_CMAKE "${ARG_CMAKE_PACKAGE_NAME}Config.cmake") set(BUILT_CONFIG_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_CMAKE}") @@ -488,9 +467,10 @@ function(ADD_ARROW_LIB LIB_NAME) 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) + write_basic_package_version_file( + "${BUILT_CONFIG_VERSION_CMAKE}" + VERSION ${${PROJECT_NAME}_VERSION} + COMPATIBILITY AnyNewerVersion) install(FILES "${BUILT_CONFIG_VERSION_CMAKE}" DESTINATION "${ARROW_CMAKE_INSTALL_DIR}") endif() @@ -501,7 +481,9 @@ function(ADD_ARROW_LIB LIB_NAME) # Modify variable in calling scope if(ARG_OUTPUTS) - set(${ARG_OUTPUTS} ${${ARG_OUTPUTS}} PARENT_SCOPE) + set(${ARG_OUTPUTS} + ${${ARG_OUTPUTS}} + PARENT_SCOPE) endif() endfunction() @@ -532,16 +514,8 @@ endfunction() function(ADD_BENCHMARK REL_BENCHMARK_NAME) set(options) set(one_value_args) - set(multi_value_args - EXTRA_LINK_LIBS - STATIC_LINK_LIBS - DEPENDENCIES - PREFIX - LABELS) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + set(multi_value_args EXTRA_LINK_LIBS STATIC_LINK_LIBS DEPENDENCIES PREFIX LABELS) + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") @@ -588,13 +562,11 @@ function(ADD_BENCHMARK REL_BENCHMARK_NAME) # $ENV{CONDA_PREFIX}/lib but our test libraries and executables are not # installed there. if(NOT "$ENV{CONDA_PREFIX}" STREQUAL "" AND APPLE) - set_target_properties(${BENCHMARK_NAME} - PROPERTIES BUILD_WITH_INSTALL_RPATH - TRUE - INSTALL_RPATH_USE_LINK_PATH - TRUE - INSTALL_RPATH - "$ENV{CONDA_PREFIX}/lib;${EXECUTABLE_OUTPUT_PATH}") + set_target_properties( + ${BENCHMARK_NAME} + PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE + INSTALL_RPATH_USE_LINK_PATH TRUE + INSTALL_RPATH "$ENV{CONDA_PREFIX}/lib;${EXECUTABLE_OUTPUT_PATH}") endif() # Add test as dependency of relevant label targets @@ -613,13 +585,12 @@ function(ADD_BENCHMARK REL_BENCHMARK_NAME) set(ARG_LABELS benchmark) endif() - add_test(${BENCHMARK_NAME} - ${BUILD_SUPPORT_DIR}/run-test.sh - ${CMAKE_BINARY_DIR} - benchmark - ${BENCHMARK_PATH} - ${NO_COLOR}) - set_property(TEST ${BENCHMARK_NAME} APPEND PROPERTY LABELS ${ARG_LABELS}) + add_test(${BENCHMARK_NAME} ${BUILD_SUPPORT_DIR}/run-test.sh ${CMAKE_BINARY_DIR} + benchmark ${BENCHMARK_PATH} ${NO_COLOR}) + set_property( + TEST ${BENCHMARK_NAME} + APPEND + PROPERTY LABELS ${ARG_LABELS}) endfunction() # @@ -662,10 +633,7 @@ function(ADD_TEST_CASE REL_TEST_NAME) LABELS EXTRA_LABELS PREFIX) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") @@ -698,13 +666,11 @@ function(ADD_TEST_CASE REL_TEST_NAME) # $ENV{CONDA_PREFIX}/lib but our test libraries and executables are not # installed there. if(NOT "$ENV{CONDA_PREFIX}" STREQUAL "" AND APPLE) - set_target_properties(${TEST_NAME} - PROPERTIES BUILD_WITH_INSTALL_RPATH - TRUE - INSTALL_RPATH_USE_LINK_PATH - TRUE - INSTALL_RPATH - "${EXECUTABLE_OUTPUT_PATH};$ENV{CONDA_PREFIX}/lib") + set_target_properties( + ${TEST_NAME} + PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE + INSTALL_RPATH_USE_LINK_PATH TRUE + INSTALL_RPATH "${EXECUTABLE_OUTPUT_PATH};$ENV{CONDA_PREFIX}/lib") endif() if(ARG_STATIC_LINK_LIBS) @@ -736,7 +702,9 @@ function(ADD_TEST_CASE REL_TEST_NAME) if(ARROW_TEST_MEMCHECK AND NOT ARG_NO_VALGRIND) add_test( - ${TEST_NAME} bash -c + ${TEST_NAME} + bash + -c "cd '${CMAKE_SOURCE_DIR}'; \ valgrind --suppressions=valgrind.supp --tool=memcheck --gen-suppressions=all \ --num-callers=500 --leak-check=full --leak-check-heuristics=stdstring \ @@ -744,10 +712,7 @@ function(ADD_TEST_CASE REL_TEST_NAME) elseif(WIN32) add_test(${TEST_NAME} ${TEST_PATH}) else() - add_test(${TEST_NAME} - ${BUILD_SUPPORT_DIR}/run-test.sh - ${CMAKE_BINARY_DIR} - test + add_test(${TEST_NAME} ${BUILD_SUPPORT_DIR}/run-test.sh ${CMAKE_BINARY_DIR} test ${TEST_PATH}) endif() @@ -772,18 +737,19 @@ function(ADD_TEST_CASE REL_TEST_NAME) # ensure there is a cmake target which exercises tests with this LABEL set(LABEL_TEST_NAME "test-${LABEL}") if(NOT TARGET ${LABEL_TEST_NAME}) - add_custom_target(${LABEL_TEST_NAME} - ctest - -L - "${LABEL}" - --output-on-failure - USES_TERMINAL) + add_custom_target( + ${LABEL_TEST_NAME} + ctest -L "${LABEL}" --output-on-failure + USES_TERMINAL) endif() # ensure the test is (re)built before the LABEL test runs add_dependencies(${LABEL_TEST_NAME} ${TEST_NAME}) endforeach() - set_property(TEST ${TEST_NAME} APPEND PROPERTY LABELS ${LABELS}) + set_property( + TEST ${TEST_NAME} + APPEND + PROPERTY LABELS ${LABELS}) endfunction() # @@ -810,10 +776,7 @@ function(ADD_ARROW_EXAMPLE REL_EXAMPLE_NAME) set(options) set(one_value_args) set(multi_value_args EXTRA_LINK_LIBS DEPENDENCIES PREFIX) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") @@ -863,10 +826,7 @@ function(ADD_FUZZ_TARGET REL_FUZZING_NAME) set(options) set(one_value_args PREFIX) set(multi_value_args LINK_LIBS) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") @@ -896,18 +856,15 @@ function(ADD_FUZZ_TARGET REL_FUZZING_NAME) add_executable(${FUZZING_NAME} "${REL_FUZZING_NAME}.cc") target_link_libraries(${FUZZING_NAME} ${LINK_LIBS}) target_compile_options(${FUZZING_NAME} PRIVATE ${FUZZ_LDFLAGS}) - set_target_properties(${FUZZING_NAME} - PROPERTIES LINK_FLAGS ${FUZZ_LDFLAGS} LABELS "fuzzing") + set_target_properties(${FUZZING_NAME} PROPERTIES LINK_FLAGS ${FUZZ_LDFLAGS} LABELS + "fuzzing") endfunction() function(ARROW_INSTALL_ALL_HEADERS PATH) set(options) set(one_value_args) set(multi_value_args PATTERN) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(NOT ARG_PATTERN) # The .hpp extension is used by some vendored libraries diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake index e4df40d61b6e0..3d4a149a4034b 100644 --- a/cpp/cmake_modules/DefineOptions.cmake +++ b/cpp/cmake_modules/DefineOptions.cmake @@ -24,7 +24,9 @@ function(check_description_length name description) foreach(description_line ${description}) string(LENGTH ${description_line} line_length) if(${line_length} GREATER 80) - message(FATAL_ERROR "description for ${name} contained a\n\ + message( + FATAL_ERROR + "description for ${name} contained a\n\ line ${line_length} characters long!\n\ (max is 80). Split it into more lines with semicolons") endif() @@ -33,7 +35,9 @@ endfunction() function(list_join lst glue out) if("${${lst}}" STREQUAL "") - set(${out} "" PARENT_SCOPE) + set(${out} + "" + PARENT_SCOPE) return() endif() @@ -42,7 +46,9 @@ function(list_join lst glue out) foreach(item ${${lst}}) set(joined "${joined}${glue}${item}") endforeach() - set(${out} ${joined} PARENT_SCOPE) + set(${out} + ${joined} + PARENT_SCOPE) endfunction() macro(define_option name description default) @@ -61,7 +67,9 @@ macro(define_option_string name description default) check_description_length(${name} ${description}) list_join(description "\n" multiline_description) - set(${name} ${default} CACHE STRING "${multiline_description}") + set(${name} + ${default} + CACHE STRING "${multiline_description}") list(APPEND "ARROW_${ARROW_OPTION_CATEGORY}_OPTION_NAMES" ${name}) set("${name}_OPTION_DESCRIPTION" ${description}) @@ -86,8 +94,8 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") define_option(ARROW_BUILD_SHARED "Build shared libraries" ON) - define_option_string(ARROW_PACKAGE_KIND - "Arbitrary string that identifies the kind of package;\ + define_option_string( + ARROW_PACKAGE_KIND "Arbitrary string that identifies the kind of package;\ (for informational purposes)" "") define_option_string(ARROW_GIT_ID "The Arrow git commit id (if any)" "") @@ -104,33 +112,32 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") define_option(ARROW_USE_PRECOMPILED_HEADERS "Use precompiled headers when compiling" OFF) - define_option_string(ARROW_SIMD_LEVEL - "Compile-time SIMD optimization level" - "SSE4_2" # default to SSE4.2 - "NONE" - "SSE4_2" - "AVX2" - "AVX512") - - define_option_string(ARROW_RUNTIME_SIMD_LEVEL - "Max runtime SIMD optimization level" - "MAX" # default to max supported by compiler - "NONE" - "SSE4_2" - "AVX2" - "AVX512" - "MAX") + define_option_string( + ARROW_SIMD_LEVEL + "Compile-time SIMD optimization level" + "SSE4_2" # default to SSE4.2 + "NONE" + "SSE4_2" + "AVX2" + "AVX512") + + define_option_string( + ARROW_RUNTIME_SIMD_LEVEL + "Max runtime SIMD optimization level" + "MAX" # default to max supported by compiler + "NONE" + "SSE4_2" + "AVX2" + "AVX512" + "MAX") # Arm64 architectures and extensions can lead to exploding combinations. # So set it directly through cmake command line. # # If you change this, you need to change the definition in # python/CMakeLists.txt too. - define_option_string(ARROW_ARMV8_ARCH - "Arm64 arch and extensions" - "armv8-a" # Default - "armv8-a" - "armv8-a+crc+crypto") + define_option_string(ARROW_ARMV8_ARCH "Arm64 arch and extensions" "armv8-a" # Default + "armv8-a" "armv8-a+crc+crypto") define_option(ARROW_ALTIVEC "Build with Altivec if compiler has support" ON) @@ -166,11 +173,9 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") set(ARROW_TEST_LINKAGE_DEFAULT "static") endif() - define_option_string(ARROW_TEST_LINKAGE - "Linkage of Arrow libraries with unit tests executables." - "${ARROW_TEST_LINKAGE_DEFAULT}" - "shared" - "static") + define_option_string( + ARROW_TEST_LINKAGE "Linkage of Arrow libraries with unit tests executables." + "${ARROW_TEST_LINKAGE_DEFAULT}" "shared" "static") define_option(ARROW_FUZZING "Build Arrow Fuzzing executables" OFF) @@ -181,8 +186,8 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") define_option(ARROW_ONLY_LINT "Only define the lint and check-format targets" OFF) - define_option(ARROW_VERBOSE_LINT "If off, 'quiet' flags will be passed to linting tools" - OFF) + define_option(ARROW_VERBOSE_LINT + "If off, 'quiet' flags will be passed to linting tools" OFF) define_option(ARROW_GENERATE_COVERAGE "Build with C++ code coverage enabled" OFF) @@ -286,14 +291,15 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") else() set(ARROW_DEPENDENCY_SOURCE_DEFAULT "AUTO") endif() - define_option_string(ARROW_DEPENDENCY_SOURCE - "Method to use for acquiring arrow's build dependencies" - "${ARROW_DEPENDENCY_SOURCE_DEFAULT}" - "AUTO" - "BUNDLED" - "SYSTEM" - "CONDA" - "BREW") + define_option_string( + ARROW_DEPENDENCY_SOURCE + "Method to use for acquiring arrow's build dependencies" + "${ARROW_DEPENDENCY_SOURCE_DEFAULT}" + "AUTO" + "BUNDLED" + "SYSTEM" + "CONDA" + "BREW") define_option(ARROW_VERBOSE_THIRDPARTY_BUILD "Show output from ExternalProjects rather than just logging to files" OFF) @@ -318,12 +324,13 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") define_option(ARROW_LZ4_USE_SHARED "Rely on lz4 shared libraries where relevant" ${ARROW_DEPENDENCY_USE_SHARED}) - define_option(ARROW_OPENSSL_USE_SHARED "Rely on OpenSSL shared libraries where relevant" - ${ARROW_DEPENDENCY_USE_SHARED}) + define_option( + ARROW_OPENSSL_USE_SHARED "Rely on OpenSSL shared libraries where relevant" + ${ARROW_DEPENDENCY_USE_SHARED}) - define_option(ARROW_PROTOBUF_USE_SHARED - "Rely on Protocol Buffers shared libraries where relevant" - ${ARROW_DEPENDENCY_USE_SHARED}) + define_option( + ARROW_PROTOBUF_USE_SHARED "Rely on Protocol Buffers shared libraries where relevant" + ${ARROW_DEPENDENCY_USE_SHARED}) if(WIN32) # It seems that Thrift doesn't support DLL well yet. @@ -335,16 +342,16 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") define_option(ARROW_THRIFT_USE_SHARED "Rely on thrift shared libraries where relevant" ${ARROW_THRIFT_USE_SHARED_DEFAULT}) - define_option(ARROW_UTF8PROC_USE_SHARED - "Rely on utf8proc shared libraries where relevant" - ${ARROW_DEPENDENCY_USE_SHARED}) + define_option( + ARROW_UTF8PROC_USE_SHARED "Rely on utf8proc shared libraries where relevant" + ${ARROW_DEPENDENCY_USE_SHARED}) define_option(ARROW_SNAPPY_USE_SHARED "Rely on snappy shared libraries where relevant" ${ARROW_DEPENDENCY_USE_SHARED}) - define_option(ARROW_UTF8PROC_USE_SHARED - "Rely on utf8proc shared libraries where relevant" - ${ARROW_DEPENDENCY_USE_SHARED}) + define_option( + ARROW_UTF8PROC_USE_SHARED "Rely on utf8proc shared libraries where relevant" + ${ARROW_DEPENDENCY_USE_SHARED}) define_option(ARROW_ZSTD_USE_SHARED "Rely on zstd shared libraries where relevant" ${ARROW_DEPENDENCY_USE_SHARED}) @@ -374,9 +381,9 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") if(MSVC_TOOLCHAIN) set_option_category("MSVC") - define_option(MSVC_LINK_VERBOSE - "Pass verbose linking options when linking libraries and executables" - OFF) + define_option( + MSVC_LINK_VERBOSE + "Pass verbose linking options when linking libraries and executables" OFF) define_option_string(BROTLI_MSVC_STATIC_LIB_SUFFIX "Brotli static lib suffix used on Windows with MSVC" "-static") @@ -394,9 +401,9 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") else() set(SNAPPY_MSVC_STATIC_LIB_SUFFIX_DEFAULT "") endif() - define_option_string(SNAPPY_MSVC_STATIC_LIB_SUFFIX - "Snappy static lib suffix used on Windows with MSVC" - "${SNAPPY_MSVC_STATIC_LIB_SUFFIX_DEFAULT}") + define_option_string( + SNAPPY_MSVC_STATIC_LIB_SUFFIX "Snappy static lib suffix used on Windows with MSVC" + "${SNAPPY_MSVC_STATIC_LIB_SUFFIX_DEFAULT}") define_option_string(LZ4_MSVC_STATIC_LIB_SUFFIX "Lz4 static lib suffix used on Windows with MSVC" "_static") @@ -410,8 +417,8 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") #---------------------------------------------------------------------- set_option_category("Parquet") - define_option(PARQUET_MINIMAL_DEPENDENCY - "Depend only on Thirdparty headers to build libparquet.;\ + define_option( + PARQUET_MINIMAL_DEPENDENCY "Depend only on Thirdparty headers to build libparquet.;\ Always OFF if building binaries" OFF) define_option( @@ -435,9 +442,9 @@ Always OFF if building binaries" OFF) "Include -static-libstdc++ -static-libgcc when linking with;Gandiva static libraries" OFF) - define_option_string(ARROW_GANDIVA_PC_CXX_FLAGS - "Compiler flags to append when pre-compiling Gandiva operations" - "") + define_option_string( + ARROW_GANDIVA_PC_CXX_FLAGS + "Compiler flags to append when pre-compiling Gandiva operations" "") #---------------------------------------------------------------------- set_option_category("Advanced developer") @@ -445,10 +452,12 @@ Always OFF if building binaries" OFF) define_option(ARROW_EXTRA_ERROR_CONTEXT "Compile with extra error context (line numbers, code)" OFF) - define_option(ARROW_OPTIONAL_INSTALL - "If enabled install ONLY targets that have already been built. Please be;\ + define_option( + ARROW_OPTIONAL_INSTALL + "If enabled install ONLY targets that have already been built. Please be;\ advised that if this is enabled 'install' will fail silently on components;\ -that have not been built" OFF) +that have not been built" + OFF) option(ARROW_BUILD_CONFIG_SUMMARY_JSON "Summarize build configuration in a JSON file" ON) @@ -563,15 +572,17 @@ endmacro() # Compute default values for omitted variables if(NOT ARROW_GIT_ID) - execute_process(COMMAND "git" "log" "-n1" "--format=%H" - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE ARROW_GIT_ID - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND "git" "log" "-n1" "--format=%H" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE ARROW_GIT_ID + OUTPUT_STRIP_TRAILING_WHITESPACE) endif() if(NOT ARROW_GIT_DESCRIPTION) - execute_process(COMMAND "git" "describe" "--tags" "--dirty" - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - ERROR_QUIET - OUTPUT_VARIABLE ARROW_GIT_DESCRIPTION - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND "git" "describe" "--tags" "--dirty" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ERROR_QUIET + OUTPUT_VARIABLE ARROW_GIT_DESCRIPTION + OUTPUT_STRIP_TRAILING_WHITESPACE) endif() diff --git a/cpp/cmake_modules/FindArrow.cmake b/cpp/cmake_modules/FindArrow.cmake index 9c987665896d8..cafac16188768 100644 --- a/cpp/cmake_modules/FindArrow.cmake +++ b/cpp/cmake_modules/FindArrow.cmake @@ -50,17 +50,8 @@ 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" - "") +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}") @@ -120,10 +111,9 @@ endfunction() # # -> 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) + set(${output_variable} + "${CMAKE_STATIC_LIBRARY_PREFIX}${base_name}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + PARENT_SCOPE) endfunction() # Internal function. @@ -138,21 +128,26 @@ endfunction() 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) + 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) + 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) + set(${prefix}_INCLUDE_DIR + "${include_dir}" + PARENT_SCOPE) if(MSVC_TOOLCHAIN) set(CMAKE_SHARED_LIBRARY_SUFFIXES_ORIGINAL ${CMAKE_FIND_LIBRARY_SUFFIXES}) @@ -160,48 +155,57 @@ macro(arrow_find_package_home) # 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) + 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) + 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}") + 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) + 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) + 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) + 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) + 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}") + set_target_properties(${target_static} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${include_dir}") endif() endif() endmacro() @@ -212,7 +216,9 @@ endmacro() 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) + 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}) @@ -221,10 +227,11 @@ macro(arrow_find_package_cmake_package_configuration) # 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) + 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() @@ -233,7 +240,9 @@ macro(arrow_find_package_cmake_package_configuration) 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) + set(${prefix}_STATIC_LIB + "${static_lib}" + PARENT_SCOPE) break() endif() endforeach() @@ -247,7 +256,9 @@ endmacro() 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(${prefix}_USE_PKG_CONFIG + TRUE + PARENT_SCOPE) set(include_dir "${${prefix}_PC_INCLUDEDIR}") set(lib_dir "${${prefix}_PC_LIBDIR}") @@ -263,49 +274,53 @@ macro(arrow_find_package_pkg_config) 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) + 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) + 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}") + 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) + 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) + 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}") + 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) +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}) @@ -315,7 +330,9 @@ function(arrow_find_package if(home) arrow_find_package_home() - set(${prefix}_FIND_APPROACH "HOME: ${home}" PARENT_SCOPE) + set(${prefix}_FIND_APPROACH + "HOME: ${home}" + PARENT_SCOPE) else() arrow_find_package_cmake_package_configuration() if(${cmake_package_name}_FOUND) @@ -324,7 +341,9 @@ function(arrow_find_package PARENT_SCOPE) else() arrow_find_package_pkg_config() - set(${prefix}_FIND_APPROACH "pkg-config: ${pkg_config_name}" PARENT_SCOPE) + set(${prefix}_FIND_APPROACH + "pkg-config: ${pkg_config_name}" + PARENT_SCOPE) endif() endif() @@ -336,7 +355,9 @@ function(arrow_find_package endif() endif() if(include_dir) - set(${prefix}_INCLUDE_DIR "${include_dir}" PARENT_SCOPE) + set(${prefix}_INCLUDE_DIR + "${include_dir}" + PARENT_SCOPE) endif() if(shared_lib) @@ -346,20 +367,19 @@ function(arrow_find_package else() set(lib_dir NOTFOUND) endif() - set(${prefix}_LIB_DIR "${lib_dir}" PARENT_SCOPE) + set(${prefix}_LIB_DIR + "${lib_dir}" + PARENT_SCOPE) # For backward compatibility - set(${prefix}_LIBS "${lib_dir}" PARENT_SCOPE) + 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) +arrow_find_package(ARROW "${ARROW_HOME}" arrow arrow/api.h Arrow arrow) if(ARROW_HOME) if(ARROW_INCLUDE_DIR) @@ -384,9 +404,8 @@ if(ARROW_HOME) 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}") + string(REGEX REPLACE "^\"(.+)\"$" "\\1" ARROW_FULL_SO_VERSION + "${ARROW_FULL_SO_VERSION_QUOTED}") endif() else() if(ARROW_USE_CMAKE_PACKAGE_CONFIG) @@ -399,33 +418,32 @@ 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) +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) +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) diff --git a/cpp/cmake_modules/FindArrowCUDA.cmake b/cpp/cmake_modules/FindArrowCUDA.cmake index 7bc2f5b745bba..b7e13c1f29139 100644 --- a/cpp/cmake_modules/FindArrowCUDA.cmake +++ b/cpp/cmake_modules/FindArrowCUDA.cmake @@ -47,11 +47,7 @@ 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_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}") @@ -64,23 +60,21 @@ 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) +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) +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) diff --git a/cpp/cmake_modules/FindArrowDataset.cmake b/cpp/cmake_modules/FindArrowDataset.cmake index d45fae6799b48..bc9710864f0f1 100644 --- a/cpp/cmake_modules/FindArrowDataset.cmake +++ b/cpp/cmake_modules/FindArrowDataset.cmake @@ -47,12 +47,8 @@ find_package(Arrow ${find_package_arguments}) find_package(Parquet ${find_package_arguments}) if(ARROW_FOUND AND PARQUET_FOUND) - arrow_find_package(ARROW_DATASET - "${ARROW_HOME}" - arrow_dataset - arrow/dataset/api.h - ArrowDataset - arrow-dataset) + 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() @@ -64,23 +60,22 @@ 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) +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) +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) diff --git a/cpp/cmake_modules/FindArrowFlight.cmake b/cpp/cmake_modules/FindArrowFlight.cmake index 344c408995c4a..dc44518de11f6 100644 --- a/cpp/cmake_modules/FindArrowFlight.cmake +++ b/cpp/cmake_modules/FindArrowFlight.cmake @@ -48,12 +48,8 @@ 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) + 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() @@ -65,23 +61,21 @@ 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) +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) +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) diff --git a/cpp/cmake_modules/FindArrowFlightTesting.cmake b/cpp/cmake_modules/FindArrowFlightTesting.cmake index feb2790dfc6d7..6ef6051f9c474 100644 --- a/cpp/cmake_modules/FindArrowFlightTesting.cmake +++ b/cpp/cmake_modules/FindArrowFlightTesting.cmake @@ -52,12 +52,8 @@ 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) + 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() @@ -69,23 +65,22 @@ 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) +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) +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) diff --git a/cpp/cmake_modules/FindArrowPython.cmake b/cpp/cmake_modules/FindArrowPython.cmake index 3d1280dff72df..7c90528000feb 100644 --- a/cpp/cmake_modules/FindArrowPython.cmake +++ b/cpp/cmake_modules/FindArrowPython.cmake @@ -46,12 +46,8 @@ endif() find_package(Arrow ${find_package_arguments}) if(ARROW_FOUND) - arrow_find_package(ARROW_PYTHON - "${ARROW_HOME}" - arrow_python - arrow/python/api.h - ArrowPython - arrow-python) + arrow_find_package(ARROW_PYTHON "${ARROW_HOME}" arrow_python arrow/python/api.h + ArrowPython arrow-python) if(NOT ARROW_PYTHON_VERSION) set(ARROW_PYTHON_VERSION "${ARROW_VERSION}") endif() @@ -63,23 +59,21 @@ 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) +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) +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) diff --git a/cpp/cmake_modules/FindArrowPythonFlight.cmake b/cpp/cmake_modules/FindArrowPythonFlight.cmake index acb22c6423192..ea9fbd9182dfe 100644 --- a/cpp/cmake_modules/FindArrowPythonFlight.cmake +++ b/cpp/cmake_modules/FindArrowPythonFlight.cmake @@ -49,12 +49,8 @@ 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 - "${ARROW_HOME}" - arrow_python_flight - arrow/python/flight.h - ArrowPythonFlight - arrow-python-flight) + arrow_find_package(ARROW_PYTHON_FLIGHT "${ARROW_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() @@ -66,23 +62,22 @@ 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) +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) +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) diff --git a/cpp/cmake_modules/FindArrowTesting.cmake b/cpp/cmake_modules/FindArrowTesting.cmake index ed5a28cd3e4d2..4168980abb24e 100644 --- a/cpp/cmake_modules/FindArrowTesting.cmake +++ b/cpp/cmake_modules/FindArrowTesting.cmake @@ -47,12 +47,8 @@ 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) + 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() @@ -64,23 +60,22 @@ 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) +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) +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) diff --git a/cpp/cmake_modules/FindBoostAlt.cmake b/cpp/cmake_modules/FindBoostAlt.cmake index 300080d4fb1b0..f35278bf4bac0 100644 --- a/cpp/cmake_modules/FindBoostAlt.cmake +++ b/cpp/cmake_modules/FindBoostAlt.cmake @@ -38,16 +38,14 @@ if(ARROW_BOOST_USE_SHARED) set(BUILD_SHARED_LIBS_KEEP ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS ON) - find_package(Boost ${BoostAlt_FIND_VERSION_OPTIONS} - COMPONENTS regex system filesystem) + find_package(Boost ${BoostAlt_FIND_VERSION_OPTIONS} COMPONENTS regex system filesystem) set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_KEEP}) unset(BUILD_SHARED_LIBS_KEEP) else() # Find static boost headers and libs # TODO Differentiate here between release and debug builds set(Boost_USE_STATIC_LIBS ON) - find_package(Boost ${BoostAlt_FIND_VERSION_OPTIONS} - COMPONENTS regex system filesystem) + find_package(Boost ${BoostAlt_FIND_VERSION_OPTIONS} COMPONENTS regex system filesystem) endif() if(Boost_FOUND) diff --git a/cpp/cmake_modules/FindBrotli.cmake b/cpp/cmake_modules/FindBrotli.cmake index b46a0f1a0cf4e..4db384be2c93c 100644 --- a/cpp/cmake_modules/FindBrotli.cmake +++ b/cpp/cmake_modules/FindBrotli.cmake @@ -48,26 +48,30 @@ else() endif() if(BROTLI_ROOT) - find_library(BROTLI_COMMON_LIBRARY - NAMES ${BROTLI_COMMON_LIB_NAMES} - PATHS ${BROTLI_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(BROTLI_ENC_LIBRARY - NAMES ${BROTLI_ENC_LIB_NAMES} - PATHS ${BROTLI_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(BROTLI_DEC_LIBRARY - NAMES ${BROTLI_DEC_LIB_NAMES} - PATHS ${BROTLI_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_path(BROTLI_INCLUDE_DIR - NAMES brotli/decode.h - PATHS ${BROTLI_ROOT} - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES} - NO_DEFAULT_PATH) + find_library( + BROTLI_COMMON_LIBRARY + NAMES ${BROTLI_COMMON_LIB_NAMES} + PATHS ${BROTLI_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + BROTLI_ENC_LIBRARY + NAMES ${BROTLI_ENC_LIB_NAMES} + PATHS ${BROTLI_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + BROTLI_DEC_LIBRARY + NAMES ${BROTLI_DEC_LIB_NAMES} + PATHS ${BROTLI_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_path( + BROTLI_INCLUDE_DIR + NAMES brotli/decode.h + PATHS ${BROTLI_ROOT} + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES} + NO_DEFAULT_PATH) else() find_package(PkgConfig QUIET) pkg_check_modules(BROTLI_PC libbrotlicommon libbrotlienc libbrotlidec) @@ -79,55 +83,59 @@ else() list(APPEND BROTLI_PC_LIBRARY_DIRS "${BROTLI_PC_libbrotlienc_LIBDIR}") list(APPEND BROTLI_PC_LIBRARY_DIRS "${BROTLI_PC_libbrotlidec_LIBDIR}") - find_library(BROTLI_COMMON_LIBRARY - NAMES ${BROTLI_COMMON_LIB_NAMES} - PATHS ${BROTLI_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(BROTLI_ENC_LIBRARY - NAMES ${BROTLI_ENC_LIB_NAMES} - PATHS ${BROTLI_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(BROTLI_DEC_LIBRARY - NAMES ${BROTLI_DEC_LIB_NAMES} - PATHS ${BROTLI_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) + find_library( + BROTLI_COMMON_LIBRARY + NAMES ${BROTLI_COMMON_LIB_NAMES} + PATHS ${BROTLI_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + BROTLI_ENC_LIBRARY + NAMES ${BROTLI_ENC_LIB_NAMES} + PATHS ${BROTLI_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + BROTLI_DEC_LIBRARY + NAMES ${BROTLI_DEC_LIB_NAMES} + PATHS ${BROTLI_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) else() - find_library(BROTLI_COMMON_LIBRARY - NAMES ${BROTLI_COMMON_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_library(BROTLI_ENC_LIBRARY - NAMES ${BROTLI_ENC_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_library(BROTLI_DEC_LIBRARY - NAMES ${BROTLI_DEC_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_path(BROTLI_INCLUDE_DIR - NAMES brotli/decode.h - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + BROTLI_COMMON_LIBRARY + NAMES ${BROTLI_COMMON_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_library( + BROTLI_ENC_LIBRARY + NAMES ${BROTLI_ENC_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_library( + BROTLI_DEC_LIBRARY + NAMES ${BROTLI_DEC_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_path( + BROTLI_INCLUDE_DIR + NAMES brotli/decode.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() endif() -find_package_handle_standard_args(Brotli - REQUIRED_VARS - BROTLI_COMMON_LIBRARY - BROTLI_ENC_LIBRARY - BROTLI_DEC_LIBRARY - BROTLI_INCLUDE_DIR) +find_package_handle_standard_args( + Brotli REQUIRED_VARS BROTLI_COMMON_LIBRARY BROTLI_ENC_LIBRARY BROTLI_DEC_LIBRARY + BROTLI_INCLUDE_DIR) if(Brotli_FOUND OR BROTLI_FOUND) set(Brotli_FOUND TRUE) add_library(Brotli::brotlicommon UNKNOWN IMPORTED) - set_target_properties(Brotli::brotlicommon - PROPERTIES IMPORTED_LOCATION "${BROTLI_COMMON_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") + set_target_properties( + Brotli::brotlicommon PROPERTIES IMPORTED_LOCATION "${BROTLI_COMMON_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") add_library(Brotli::brotlienc UNKNOWN IMPORTED) - set_target_properties(Brotli::brotlienc - PROPERTIES IMPORTED_LOCATION "${BROTLI_ENC_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") + set_target_properties( + Brotli::brotlienc PROPERTIES IMPORTED_LOCATION "${BROTLI_ENC_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") add_library(Brotli::brotlidec UNKNOWN IMPORTED) - set_target_properties(Brotli::brotlidec - PROPERTIES IMPORTED_LOCATION "${BROTLI_DEC_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") + set_target_properties( + Brotli::brotlidec PROPERTIES IMPORTED_LOCATION "${BROTLI_DEC_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") endif() diff --git a/cpp/cmake_modules/FindClangTools.cmake b/cpp/cmake_modules/FindClangTools.cmake index 88171abed922b..043ff965159da 100644 --- a/cpp/cmake_modules/FindClangTools.cmake +++ b/cpp/cmake_modules/FindClangTools.cmake @@ -35,10 +35,7 @@ # CLANG_FORMAT_FOUND, Whether clang format was found set(CLANG_TOOLS_SEARCH_PATHS - ${ClangTools_PATH} - $ENV{CLANG_TOOLS_PATH} - /usr/local/bin - /usr/bin + ${ClangTools_PATH} $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin "C:/Program Files/LLVM/bin" # Windows, non-conda "$ENV{CONDA_PREFIX}/Library/bin") # Windows, conda if(CLANG_TOOLS_BREW_PREFIX) @@ -47,37 +44,42 @@ endif() function(FIND_CLANG_TOOL NAME OUTPUT VERSION_CHECK_PATTERN) unset(CLANG_TOOL_BIN CACHE) - find_program(CLANG_TOOL_BIN - NAMES ${NAME}-${ARROW_CLANG_TOOLS_VERSION} - ${NAME}-${ARROW_CLANG_TOOLS_VERSION_MAJOR} - PATHS ${CLANG_TOOLS_SEARCH_PATHS} - NO_DEFAULT_PATH) + find_program( + CLANG_TOOL_BIN + NAMES ${NAME}-${ARROW_CLANG_TOOLS_VERSION} ${NAME}-${ARROW_CLANG_TOOLS_VERSION_MAJOR} + PATHS ${CLANG_TOOLS_SEARCH_PATHS} + NO_DEFAULT_PATH) if(NOT CLANG_TOOL_BIN) # try searching for non-versioned tool and check the version - find_program(CLANG_TOOL_BIN - NAMES ${NAME} - PATHS ${CLANG_TOOLS_SEARCH_PATHS} - NO_DEFAULT_PATH) + find_program( + CLANG_TOOL_BIN + NAMES ${NAME} + PATHS ${CLANG_TOOLS_SEARCH_PATHS} + NO_DEFAULT_PATH) if(CLANG_TOOL_BIN) unset(CLANG_TOOL_VERSION_MESSAGE) - execute_process(COMMAND ${CLANG_TOOL_BIN} "-version" - OUTPUT_VARIABLE CLANG_TOOL_VERSION_MESSAGE - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process( + COMMAND ${CLANG_TOOL_BIN} "-version" + OUTPUT_VARIABLE CLANG_TOOL_VERSION_MESSAGE + OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT (${CLANG_TOOL_VERSION_MESSAGE} MATCHES ${VERSION_CHECK_PATTERN})) set(CLANG_TOOL_BIN "CLANG_TOOL_BIN-NOTFOUND") endif() endif() endif() if(CLANG_TOOL_BIN) - set(${OUTPUT} ${CLANG_TOOL_BIN} PARENT_SCOPE) + set(${OUTPUT} + ${CLANG_TOOL_BIN} + PARENT_SCOPE) else() - set(${OUTPUT} "${OUTPUT}-NOTFOUND" PARENT_SCOPE) + set(${OUTPUT} + "${OUTPUT}-NOTFOUND" + PARENT_SCOPE) endif() endfunction() -string(REGEX - REPLACE "\\." "\\\\." ARROW_CLANG_TOOLS_VERSION_ESCAPED - "${ARROW_CLANG_TOOLS_VERSION}") +string(REGEX REPLACE "\\." "\\\\." ARROW_CLANG_TOOLS_VERSION_ESCAPED + "${ARROW_CLANG_TOOLS_VERSION}") find_clang_tool(clang-tidy CLANG_TIDY_BIN "LLVM version ${ARROW_CLANG_TOOLS_VERSION_ESCAPED}") @@ -100,4 +102,4 @@ else() endif() find_package_handle_standard_args(ClangTools REQUIRED_VARS CLANG_FORMAT_BIN - CLANG_TIDY_BIN) + CLANG_TIDY_BIN) diff --git a/cpp/cmake_modules/FindGLOG.cmake b/cpp/cmake_modules/FindGLOG.cmake index 81c3f2ec57e2d..65aa7c4fb57b5 100644 --- a/cpp/cmake_modules/FindGLOG.cmake +++ b/cpp/cmake_modules/FindGLOG.cmake @@ -22,33 +22,40 @@ pkg_check_modules(GLOG_PC libglog) if(GLOG_PC_FOUND) set(GLOG_INCLUDE_DIR "${GLOG_PC_INCLUDEDIR}") list(APPEND GLOG_PC_LIBRARY_DIRS "${GLOG_PC_LIBDIR}") - find_library(GLOG_LIB glog - PATHS ${GLOG_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) + find_library( + GLOG_LIB glog + PATHS ${GLOG_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) elseif(GLOG_ROOT) - find_library(GLOG_LIB - NAMES glog - PATHS ${GLOG_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_path(GLOG_INCLUDE_DIR - NAMES glog/logging.h - PATHS ${GLOG_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + GLOG_LIB + NAMES glog + PATHS ${GLOG_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_path( + GLOG_INCLUDE_DIR + NAMES glog/logging.h + PATHS ${GLOG_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) else() - find_library(GLOG_LIB NAMES glog PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_path(GLOG_INCLUDE_DIR - NAMES glog/logging.h - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + GLOG_LIB + NAMES glog + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_path( + GLOG_INCLUDE_DIR + NAMES glog/logging.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() find_package_handle_standard_args(GLOG REQUIRED_VARS GLOG_INCLUDE_DIR GLOG_LIB) if(GLOG_FOUND) add_library(glog::glog UNKNOWN IMPORTED) - set_target_properties(glog::glog - PROPERTIES IMPORTED_LOCATION "${GLOG_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIR}") + set_target_properties( + glog::glog PROPERTIES IMPORTED_LOCATION "${GLOG_LIB}" INTERFACE_INCLUDE_DIRECTORIES + "${GLOG_INCLUDE_DIR}") endif() diff --git a/cpp/cmake_modules/FindGandiva.cmake b/cpp/cmake_modules/FindGandiva.cmake index 15279fd841afc..d0c9d625c8566 100644 --- a/cpp/cmake_modules/FindGandiva.cmake +++ b/cpp/cmake_modules/FindGandiva.cmake @@ -48,12 +48,7 @@ endif() find_package(Arrow ${find_package_arguments}) if(ARROW_FOUND) - arrow_find_package(GANDIVA - "${ARROW_HOME}" - gandiva - gandiva/arrow.h - Gandiva - gandiva) + arrow_find_package(GANDIVA "${ARROW_HOME}" gandiva gandiva/arrow.h Gandiva gandiva) if(NOT GANDIVA_VERSION) set(GANDIVA_VERSION "${ARROW_VERSION}") endif() @@ -67,26 +62,24 @@ 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) +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) +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) diff --git a/cpp/cmake_modules/FindInferTools.cmake b/cpp/cmake_modules/FindInferTools.cmake index c4b65653ae9ad..23f9976645a29 100644 --- a/cpp/cmake_modules/FindInferTools.cmake +++ b/cpp/cmake_modules/FindInferTools.cmake @@ -28,15 +28,12 @@ # INFER_BIN, The path to the infer binary # INFER_FOUND, Whether infer was found -find_program(INFER_BIN - NAMES infer - PATHS ${InferTools_PATH} - $ENV{INFER_TOOLS_PATH} - /usr/local/bin - /usr/bin - /usr/local/homebrew/bin - /opt/local/bin - NO_DEFAULT_PATH) +find_program( + INFER_BIN + NAMES infer + PATHS ${InferTools_PATH} $ENV{INFER_TOOLS_PATH} /usr/local/bin /usr/bin + /usr/local/homebrew/bin /opt/local/bin + NO_DEFAULT_PATH) if("${INFER_BIN}" STREQUAL "INFER_BIN-NOTFOUND") set(INFER_FOUND 0) diff --git a/cpp/cmake_modules/FindLLVMAlt.cmake b/cpp/cmake_modules/FindLLVMAlt.cmake index 7695c09ae8ce1..d4655cae42530 100644 --- a/cpp/cmake_modules/FindLLVMAlt.cmake +++ b/cpp/cmake_modules/FindLLVMAlt.cmake @@ -24,11 +24,7 @@ if(LLVM_BREW_PREFIX) list(APPEND LLVM_HINTS ${LLVM_BREW_PREFIX}) endif() foreach(ARROW_LLVM_VERSION ${ARROW_LLVM_VERSIONS}) - find_package(LLVM - ${ARROW_LLVM_VERSION} - CONFIG - HINTS - ${LLVM_HINTS}) + find_package(LLVM ${ARROW_LLVM_VERSION} CONFIG HINTS ${LLVM_HINTS}) if(LLVM_FOUND) break() endif() @@ -36,44 +32,41 @@ endforeach() if(LLVM_FOUND) # Find the libraries that correspond to the LLVM components - llvm_map_components_to_libnames(LLVM_LIBS - core - mcjit - native - ipo - bitreader - target - linker - analysis - debuginfodwarf) + llvm_map_components_to_libnames( + LLVM_LIBS + core + mcjit + native + ipo + bitreader + target + linker + analysis + debuginfodwarf) find_program(LLVM_LINK_EXECUTABLE llvm-link HINTS ${LLVM_TOOLS_BINARY_DIR}) - find_program(CLANG_EXECUTABLE - NAMES clang-${LLVM_PACKAGE_VERSION} - clang-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR} - clang-${LLVM_VERSION_MAJOR} clang - HINTS ${LLVM_TOOLS_BINARY_DIR}) + find_program( + CLANG_EXECUTABLE + NAMES clang-${LLVM_PACKAGE_VERSION} clang-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR} + clang-${LLVM_VERSION_MAJOR} clang + HINTS ${LLVM_TOOLS_BINARY_DIR}) add_library(LLVM::LLVM_INTERFACE INTERFACE IMPORTED) - set_target_properties(LLVM::LLVM_INTERFACE - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${LLVM_INCLUDE_DIRS}" - INTERFACE_COMPILE_FLAGS - "${LLVM_DEFINITIONS}" - INTERFACE_LINK_LIBRARIES - "${LLVM_LIBS}") + set_target_properties( + LLVM::LLVM_INTERFACE + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LLVM_INCLUDE_DIRS}" + INTERFACE_COMPILE_FLAGS "${LLVM_DEFINITIONS}" + INTERFACE_LINK_LIBRARIES "${LLVM_LIBS}") endif() mark_as_advanced(CLANG_EXECUTABLE LLVM_LINK_EXECUTABLE) -find_package_handle_standard_args(LLVMAlt - REQUIRED_VARS # The first variable is used for display. - LLVM_PACKAGE_VERSION - CLANG_EXECUTABLE - LLVM_FOUND - LLVM_LINK_EXECUTABLE) +find_package_handle_standard_args( + LLVMAlt + REQUIRED_VARS # The first variable is used for display. + LLVM_PACKAGE_VERSION CLANG_EXECUTABLE LLVM_FOUND LLVM_LINK_EXECUTABLE) if(LLVMAlt_FOUND) message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") message(STATUS "Found llvm-link ${LLVM_LINK_EXECUTABLE}") diff --git a/cpp/cmake_modules/FindLz4.cmake b/cpp/cmake_modules/FindLz4.cmake index 14b6d93b983ec..e68bdd385f5a8 100644 --- a/cpp/cmake_modules/FindLz4.cmake +++ b/cpp/cmake_modules/FindLz4.cmake @@ -24,15 +24,11 @@ if(ARROW_LZ4_USE_SHARED) set(LZ4_LIB_NAMES) if(CMAKE_IMPORT_LIBRARY_SUFFIX) list( - APPEND - LZ4_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}${LZ4_LIB_NAME_BASE}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - ) + APPEND LZ4_LIB_NAMES + "${CMAKE_IMPORT_LIBRARY_PREFIX}${LZ4_LIB_NAME_BASE}${CMAKE_IMPORT_LIBRARY_SUFFIX}") endif() - list( - APPEND - LZ4_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}${LZ4_LIB_NAME_BASE}${CMAKE_SHARED_LIBRARY_SUFFIX}") + list(APPEND LZ4_LIB_NAMES + "${CMAKE_SHARED_LIBRARY_PREFIX}${LZ4_LIB_NAME_BASE}${CMAKE_SHARED_LIBRARY_SUFFIX}") else() if(MSVC AND NOT DEFINED LZ4_MSVC_STATIC_LIB_SUFFIX) set(LZ4_MSVC_STATIC_LIB_SUFFIX "_static") @@ -43,16 +39,18 @@ else() endif() if(LZ4_ROOT) - find_library(LZ4_LIB - NAMES ${LZ4_LIB_NAMES} - PATHS ${LZ4_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_path(LZ4_INCLUDE_DIR - NAMES lz4.h - PATHS ${LZ4_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + LZ4_LIB + NAMES ${LZ4_LIB_NAMES} + PATHS ${LZ4_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_path( + LZ4_INCLUDE_DIR + NAMES lz4.h + PATHS ${LZ4_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) else() find_package(PkgConfig QUIET) @@ -61,16 +59,21 @@ else() set(LZ4_INCLUDE_DIR "${LZ4_PC_INCLUDEDIR}") list(APPEND LZ4_PC_LIBRARY_DIRS "${LZ4_PC_LIBDIR}") - find_library(LZ4_LIB - NAMES ${LZ4_LIB_NAMES} - PATHS ${LZ4_PC_LIBRARY_DIRS} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_library( + LZ4_LIB + NAMES ${LZ4_LIB_NAMES} + PATHS ${LZ4_PC_LIBRARY_DIRS} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) else() - find_library(LZ4_LIB - NAMES ${LZ4_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_path(LZ4_INCLUDE_DIR NAMES lz4.h PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + LZ4_LIB + NAMES ${LZ4_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_path( + LZ4_INCLUDE_DIR + NAMES lz4.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() endif() @@ -79,7 +82,7 @@ find_package_handle_standard_args(Lz4 REQUIRED_VARS LZ4_LIB LZ4_INCLUDE_DIR) if(Lz4_FOUND) set(Lz4_FOUND TRUE) add_library(LZ4::lz4 UNKNOWN IMPORTED) - set_target_properties(LZ4::lz4 - PROPERTIES IMPORTED_LOCATION "${LZ4_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}") + set_target_properties( + LZ4::lz4 PROPERTIES IMPORTED_LOCATION "${LZ4_LIB}" INTERFACE_INCLUDE_DIRECTORIES + "${LZ4_INCLUDE_DIR}") endif() diff --git a/cpp/cmake_modules/FindNumPy.cmake b/cpp/cmake_modules/FindNumPy.cmake index c3daba149fd04..64c77a20093cc 100644 --- a/cpp/cmake_modules/FindNumPy.cmake +++ b/cpp/cmake_modules/FindNumPy.cmake @@ -42,24 +42,24 @@ # FindPython3Alt.cmake. if(NOT PYTHONINTERP_FOUND) - set(NUMPY_FOUND FALSE) - return() + set(NUMPY_FOUND FALSE) + return() endif() -execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" - "import numpy as n; print(n.__version__); print(n.get_include());" - RESULT_VARIABLE _NUMPY_SEARCH_SUCCESS - OUTPUT_VARIABLE _NUMPY_VALUES_OUTPUT - ERROR_VARIABLE _NUMPY_ERROR_VALUE - OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process( + COMMAND "${PYTHON_EXECUTABLE}" "-c" + "import numpy as n; print(n.__version__); print(n.get_include());" + RESULT_VARIABLE _NUMPY_SEARCH_SUCCESS + OUTPUT_VARIABLE _NUMPY_VALUES_OUTPUT + ERROR_VARIABLE _NUMPY_ERROR_VALUE + OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT _NUMPY_SEARCH_SUCCESS MATCHES 0) - if(NumPy_FIND_REQUIRED) - message(FATAL_ERROR - "NumPy import failure:\n${_NUMPY_ERROR_VALUE}") - endif() - set(NUMPY_FOUND FALSE) - return() + if(NumPy_FIND_REQUIRED) + message(FATAL_ERROR "NumPy import failure:\n${_NUMPY_ERROR_VALUE}") + endif() + set(NUMPY_FOUND FALSE) + return() endif() # Convert the process output into a list @@ -70,11 +70,13 @@ list(GET _NUMPY_VALUES 1 NUMPY_INCLUDE_DIRS) string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" _VER_CHECK "${NUMPY_VERSION}") if("${_VER_CHECK}" STREQUAL "") - # The output from Python was unexpected. Raise an error always - # here, because we found NumPy, but it appears to be corrupted somehow. - message(FATAL_ERROR - "Requested version and include path from NumPy, got instead:\n${_NUMPY_VALUES_OUTPUT}\n") - return() + # The output from Python was unexpected. Raise an error always + # here, because we found NumPy, but it appears to be corrupted somehow. + message( + FATAL_ERROR + "Requested version and include path from NumPy, got instead:\n${_NUMPY_VALUES_OUTPUT}\n" + ) + return() endif() # Make sure all directory separators are '/' @@ -86,11 +88,14 @@ list(GET _NUMPY_VERSION_LIST 0 NUMPY_VERSION_MAJOR) list(GET _NUMPY_VERSION_LIST 1 NUMPY_VERSION_MINOR) list(GET _NUMPY_VERSION_LIST 2 NUMPY_VERSION_PATCH) string(REGEX MATCH "[0-9]*" NUMPY_VERSION_PATCH ${NUMPY_VERSION_PATCH}) -math(EXPR NUMPY_VERSION_DECIMAL - "(${NUMPY_VERSION_MAJOR} * 10000) + (${NUMPY_VERSION_MINOR} * 100) + ${NUMPY_VERSION_PATCH}") +math( + EXPR + NUMPY_VERSION_DECIMAL + "(${NUMPY_VERSION_MAJOR} * 10000) + (${NUMPY_VERSION_MINOR} * 100) + ${NUMPY_VERSION_PATCH}" +) -find_package_message(NUMPY - "Found NumPy: version \"${NUMPY_VERSION}\" ${NUMPY_INCLUDE_DIRS}" - "${NUMPY_INCLUDE_DIRS}${NUMPY_VERSION}") +find_package_message( + NUMPY "Found NumPy: version \"${NUMPY_VERSION}\" ${NUMPY_INCLUDE_DIRS}" + "${NUMPY_INCLUDE_DIRS}${NUMPY_VERSION}") set(NUMPY_FOUND TRUE) diff --git a/cpp/cmake_modules/FindORC.cmake b/cpp/cmake_modules/FindORC.cmake index 1be149c93b2a4..fc4c29c6d1b5f 100644 --- a/cpp/cmake_modules/FindORC.cmake +++ b/cpp/cmake_modules/FindORC.cmake @@ -22,32 +22,37 @@ # ORC_FOUND, whether orc has been found if(ORC_ROOT) - find_library(ORC_STATIC_LIB - NAMES orc - PATHS ${ORC_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_path(ORC_INCLUDE_DIR - NAMES orc/orc-config.hh - PATHS ${ORC_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + ORC_STATIC_LIB + NAMES orc + PATHS ${ORC_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_path( + ORC_INCLUDE_DIR + NAMES orc/orc-config.hh + PATHS ${ORC_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) else() - find_library(ORC_STATIC_LIB NAMES orc PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_path(ORC_INCLUDE_DIR - NAMES orc/orc-config.hh - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + ORC_STATIC_LIB + NAMES orc + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_path( + ORC_INCLUDE_DIR + NAMES orc/orc-config.hh + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() if(ORC_STATIC_LIB AND ORC_INCLUDE_DIR) set(ORC_FOUND TRUE) add_library(orc::liborc STATIC IMPORTED) - set_target_properties(orc::liborc - PROPERTIES IMPORTED_LOCATION "${ORC_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES - "${ORC_INCLUDE_DIR}") + set_target_properties( + orc::liborc PROPERTIES IMPORTED_LOCATION "${ORC_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${ORC_INCLUDE_DIR}") else() - if (ORC_FIND_REQUIRED) + if(ORC_FIND_REQUIRED) message(FATAL_ERROR "ORC library was required in toolchain and unable to locate") endif() set(ORC_FOUND FALSE) diff --git a/cpp/cmake_modules/FindParquet.cmake b/cpp/cmake_modules/FindParquet.cmake index 99124b2c037d9..c21a61d707eeb 100644 --- a/cpp/cmake_modules/FindParquet.cmake +++ b/cpp/cmake_modules/FindParquet.cmake @@ -56,11 +56,7 @@ if((NOT PARQUET_HOME) AND ARROW_HOME) endif() if(ARROW_FOUND) - arrow_find_package(PARQUET - "${PARQUET_HOME}" - parquet - parquet/api/reader.h - Parquet + arrow_find_package(PARQUET "${PARQUET_HOME}" parquet parquet/api/reader.h Parquet parquet) if(PARQUET_HOME) if(PARQUET_INCLUDE_DIR) @@ -83,13 +79,12 @@ if(ARROW_FOUND) 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}") + 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}") + string(REGEX REPLACE "^\"(.+)\"$" "\\1" PARQUET_FULL_SO_VERSION + "${PARQUET_FULL_SO_VERSION_QUOTED}") endif() else() if(PARQUET_USE_CMAKE_PACKAGE_CONFIG) @@ -102,24 +97,22 @@ if(ARROW_FOUND) 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) +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) +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) diff --git a/cpp/cmake_modules/FindPlasma.cmake b/cpp/cmake_modules/FindPlasma.cmake index d56b714132083..61ba1393996c4 100644 --- a/cpp/cmake_modules/FindPlasma.cmake +++ b/cpp/cmake_modules/FindPlasma.cmake @@ -50,12 +50,7 @@ endif() find_package(Arrow ${find_package_arguments}) if(ARROW_FOUND) - arrow_find_package(PLASMA - "${ARROW_HOME}" - plasma - plasma/client.h - Plasma - plasma) + 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}) @@ -74,27 +69,24 @@ if(ARROW_FOUND) 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) +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) +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) diff --git a/cpp/cmake_modules/FindPython3Alt.cmake b/cpp/cmake_modules/FindPython3Alt.cmake index 131a0d395fc86..89b9fffc63956 100644 --- a/cpp/cmake_modules/FindPython3Alt.cmake +++ b/cpp/cmake_modules/FindPython3Alt.cmake @@ -33,11 +33,8 @@ if(${CMAKE_VERSION} VERSION_LESS "3.15.0") find_package(PythonLibsNew) find_package(NumPy) endif() - find_package_handle_standard_args(Python3Alt - REQUIRED_VARS - PYTHON_EXECUTABLE - PYTHON_INCLUDE_DIRS - NUMPY_INCLUDE_DIRS) + find_package_handle_standard_args( + Python3Alt REQUIRED_VARS PYTHON_EXECUTABLE PYTHON_INCLUDE_DIRS NUMPY_INCLUDE_DIRS) return() endif() @@ -46,13 +43,19 @@ if(${CMAKE_VERSION} VERSION_LESS "3.18.0" OR ARROW_BUILD_TESTS) # the full "Development" component. Also ask for it on CMake < 3.18, # where "Development.Module" is not available. if(Python3Alt_FIND_REQUIRED) - find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED) + find_package( + Python3 + COMPONENTS Interpreter Development NumPy + REQUIRED) else() find_package(Python3 COMPONENTS Interpreter Development NumPy) endif() else() if(Python3Alt_FIND_REQUIRED) - find_package(Python3 COMPONENTS Interpreter Development.Module NumPy REQUIRED) + find_package( + Python3 + COMPONENTS Interpreter Development.Module NumPy + REQUIRED) else() find_package(Python3 COMPONENTS Interpreter Development.Module NumPy) endif() @@ -92,8 +95,5 @@ function(PYTHON_ADD_MODULE name) set_target_properties(${name} PROPERTIES SUFFIX ${_EXT_SUFFIX}) endfunction() -find_package_handle_standard_args(Python3Alt - REQUIRED_VARS - PYTHON_EXECUTABLE - PYTHON_INCLUDE_DIRS - NUMPY_INCLUDE_DIRS) +find_package_handle_standard_args( + Python3Alt REQUIRED_VARS PYTHON_EXECUTABLE PYTHON_INCLUDE_DIRS NUMPY_INCLUDE_DIRS) diff --git a/cpp/cmake_modules/FindPythonLibsNew.cmake b/cpp/cmake_modules/FindPythonLibsNew.cmake index 581bba9d4caaa..2f440fa00e55e 100644 --- a/cpp/cmake_modules/FindPythonLibsNew.cmake +++ b/cpp/cmake_modules/FindPythonLibsNew.cmake @@ -62,14 +62,14 @@ # Use the Python interpreter to find the libs. if(PythonLibsNew_FIND_REQUIRED) - find_package(PythonInterp REQUIRED) + find_package(PythonInterp REQUIRED) else() - find_package(PythonInterp) + find_package(PythonInterp) endif() if(NOT PYTHONINTERP_FOUND) - set(PYTHONLIBS_FOUND FALSE) - return() + set(PYTHONLIBS_FOUND FALSE) + return() endif() # According to http://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter @@ -81,7 +81,9 @@ endif() # # The config var LIBPL is for Linux, and helps on Debian Jessie where the # addition of multi-arch support shuffled things around. -execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" +execute_process( + COMMAND + "${PYTHON_EXECUTABLE}" "-c" "from distutils import sysconfig as s;import sys;import struct; print('.'.join(str(v) for v in sys.version_info)); print(sys.prefix); @@ -94,17 +96,16 @@ print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION')); print(s.get_config_var('LIBPL')); print(s.get_config_var('LIBS') or ''); " - RESULT_VARIABLE _PYTHON_SUCCESS - OUTPUT_VARIABLE _PYTHON_VALUES - ERROR_VARIABLE _PYTHON_ERROR_VALUE) + RESULT_VARIABLE _PYTHON_SUCCESS + OUTPUT_VARIABLE _PYTHON_VALUES + ERROR_VARIABLE _PYTHON_ERROR_VALUE) if(NOT _PYTHON_SUCCESS MATCHES 0) - if(PythonLibsNew_FIND_REQUIRED) - message(FATAL_ERROR - "Python config failure:\n${_PYTHON_ERROR_VALUE}") - endif() - set(PYTHONLIBS_FOUND FALSE) - return() + if(PythonLibsNew_FIND_REQUIRED) + message(FATAL_ERROR "Python config failure:\n${_PYTHON_ERROR_VALUE}") + endif() + set(PYTHONLIBS_FOUND FALSE) + return() endif() # Convert the process output into a list @@ -124,15 +125,14 @@ list(GET _PYTHON_VALUES 9 PYTHON_OTHER_LIBS) # Make sure the Python has the same pointer-size as the chosen compiler # Skip the check on OS X, it doesn't consistently have CMAKE_SIZEOF_VOID_P defined if((NOT APPLE) AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}")) - if(PythonLibsNew_FIND_REQUIRED) - math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8") - math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8") - message(FATAL_ERROR - "Python config failure: Python is ${_PYTHON_BITS}-bit, " - "chosen compiler is ${_CMAKE_BITS}-bit") - endif() - set(PYTHONLIBS_FOUND FALSE) - return() + if(PythonLibsNew_FIND_REQUIRED) + math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8") + math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8") + message(FATAL_ERROR "Python config failure: Python is ${_PYTHON_BITS}-bit, " + "chosen compiler is ${_CMAKE_BITS}-bit") + endif() + set(PYTHONLIBS_FOUND FALSE) + return() endif() # The built-in FindPython didn't always give the version numbers @@ -149,119 +149,114 @@ string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES}) if(CMAKE_HOST_WIN32) # Appease CMP0054 if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(PYTHON_LIBRARY - "${PYTHON_PREFIX}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") + set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") else() - find_library(PYTHON_LIBRARY - NAMES "python${PYTHON_LIBRARY_SUFFIX}" - PATHS "${PYTHON_PREFIX}" NO_DEFAULT_PATH - PATH_SUFFIXES "lib" "libs") + find_library( + PYTHON_LIBRARY + NAMES "python${PYTHON_LIBRARY_SUFFIX}" + PATHS "${PYTHON_PREFIX}" + NO_DEFAULT_PATH + PATH_SUFFIXES "lib" "libs") endif() elseif(APPLE) set(PYTHON_LIBRARY "${PYTHON_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib") - if (NOT EXISTS ${PYTHON_LIBRARY}) + if(NOT EXISTS ${PYTHON_LIBRARY}) # In some cases libpythonX.X.dylib is not part of the PYTHON_PREFIX and we # need to call `python-config --prefix` to determine the correct location. - find_program(PYTHON_CONFIG python-config - NO_CMAKE_SYSTEM_PATH) - if (PYTHON_CONFIG) + find_program(PYTHON_CONFIG python-config NO_CMAKE_SYSTEM_PATH) + if(PYTHON_CONFIG) execute_process( - COMMAND "${PYTHON_CONFIG}" "--prefix" - OUTPUT_VARIABLE PYTHON_CONFIG_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE) - set(PYTHON_LIBRARY "${PYTHON_CONFIG_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib") + COMMAND "${PYTHON_CONFIG}" "--prefix" + OUTPUT_VARIABLE PYTHON_CONFIG_PREFIX + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(PYTHON_LIBRARY + "${PYTHON_CONFIG_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib") endif() endif() else() - if(${PYTHON_SIZEOF_VOID_P} MATCHES 8) - set(_PYTHON_LIBS_SEARCH "${PYTHON_PREFIX}/lib64" "${PYTHON_PREFIX}/lib" "${PYTHON_LIBRARY_PATH}") - else() - set(_PYTHON_LIBS_SEARCH "${PYTHON_PREFIX}/lib" "${PYTHON_LIBRARY_PATH}") - endif() - message(STATUS "Searching for Python libs in ${_PYTHON_LIBS_SEARCH}") - message(STATUS "Looking for python${PYTHON_LIBRARY_SUFFIX}") - # Probably this needs to be more involved. It would be nice if the config - # information the python interpreter itself gave us were more complete. - find_library(PYTHON_LIBRARY - NAMES "python${PYTHON_LIBRARY_SUFFIX}" - PATHS ${_PYTHON_LIBS_SEARCH} - NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_SYSTEM_PATH) - message(STATUS "Found Python lib ${PYTHON_LIBRARY}") + if(${PYTHON_SIZEOF_VOID_P} MATCHES 8) + set(_PYTHON_LIBS_SEARCH "${PYTHON_PREFIX}/lib64" "${PYTHON_PREFIX}/lib" + "${PYTHON_LIBRARY_PATH}") + else() + set(_PYTHON_LIBS_SEARCH "${PYTHON_PREFIX}/lib" "${PYTHON_LIBRARY_PATH}") + endif() + message(STATUS "Searching for Python libs in ${_PYTHON_LIBS_SEARCH}") + message(STATUS "Looking for python${PYTHON_LIBRARY_SUFFIX}") + # Probably this needs to be more involved. It would be nice if the config + # information the python interpreter itself gave us were more complete. + find_library( + PYTHON_LIBRARY + NAMES "python${PYTHON_LIBRARY_SUFFIX}" + PATHS ${_PYTHON_LIBS_SEARCH} + NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + message(STATUS "Found Python lib ${PYTHON_LIBRARY}") endif() # For backward compatibility, set PYTHON_INCLUDE_PATH, but make it internal. -SET(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}" CACHE INTERNAL - "Path to where Python.h is found (deprecated)") +set(PYTHON_INCLUDE_PATH + "${PYTHON_INCLUDE_DIR}" + CACHE INTERNAL "Path to where Python.h is found (deprecated)") -MARK_AS_ADVANCED( - PYTHON_LIBRARY - PYTHON_INCLUDE_DIR -) +mark_as_advanced(PYTHON_LIBRARY PYTHON_INCLUDE_DIR) # We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the # cache entries because they are meant to specify the location of a single # library. We now set the variables listed by the documentation for this # module. -SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") -SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") -SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") - +set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") +set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") +set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") # Don't know how to get to this directory, just doing something simple :P #INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) #FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs DEFAULT_MSG PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) -find_package_message(PYTHON - "Found PythonLibs: ${PYTHON_LIBRARY}" - "${PYTHON_EXECUTABLE}${PYTHON_VERSION}") - +find_package_message(PYTHON "Found PythonLibs: ${PYTHON_LIBRARY}" + "${PYTHON_EXECUTABLE}${PYTHON_VERSION}") # PYTHON_ADD_MODULE( src1 src2 ... srcN) is used to build modules for python. -FUNCTION(PYTHON_ADD_MODULE _NAME ) - GET_PROPERTY(_TARGET_SUPPORTS_SHARED_LIBS - GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) - OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE) - OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED - "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS}) +function(PYTHON_ADD_MODULE _NAME) + get_property(_TARGET_SUPPORTS_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) + option(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE) + option(PYTHON_MODULE_${_NAME}_BUILD_SHARED "Add module ${_NAME} shared" + ${_TARGET_SUPPORTS_SHARED_LIBS}) # Mark these options as advanced - MARK_AS_ADVANCED(PYTHON_ENABLE_MODULE_${_NAME} - PYTHON_MODULE_${_NAME}_BUILD_SHARED) + mark_as_advanced(PYTHON_ENABLE_MODULE_${_NAME} PYTHON_MODULE_${_NAME}_BUILD_SHARED) - IF(PYTHON_ENABLE_MODULE_${_NAME}) - IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) - SET(PY_MODULE_TYPE MODULE) - ELSE(PYTHON_MODULE_${_NAME}_BUILD_SHARED) - SET(PY_MODULE_TYPE STATIC) - SET_PROPERTY(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME}) - ENDIF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + if(PYTHON_ENABLE_MODULE_${_NAME}) + if(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + set(PY_MODULE_TYPE MODULE) + else(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + set(PY_MODULE_TYPE STATIC) + set_property(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME}) + endif(PYTHON_MODULE_${_NAME}_BUILD_SHARED) - SET_PROPERTY(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME}) - ADD_LIBRARY(${_NAME} ${PY_MODULE_TYPE} ${ARGN}) - IF(APPLE) + set_property(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME}) + add_library(${_NAME} ${PY_MODULE_TYPE} ${ARGN}) + if(APPLE) # On OS X, linking against the Python libraries causes # segfaults, so do this dynamic lookup instead. - SET_TARGET_PROPERTIES(${_NAME} PROPERTIES LINK_FLAGS - "-undefined dynamic_lookup") - ELSEIF(MSVC) + set_target_properties(${_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + elseif(MSVC) target_link_libraries(${_NAME} ${PYTHON_LIBRARIES}) - ELSE() + else() # In general, we should not link against libpython as we do not embed the # Python interpreter. The python binary itself can then define where the # symbols should loaded from. For being manylinux1 compliant, one is not # allowed to link to libpython. Partly because not all systems ship it, # also because the interpreter ABI/API was not stable between patch # releases for Python < 3.5. - SET_TARGET_PROPERTIES(${_NAME} PROPERTIES LINK_FLAGS - "-Wl,-undefined,dynamic_lookup") - ENDIF() - IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) - SET_TARGET_PROPERTIES(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}") - SET_TARGET_PROPERTIES(${_NAME} PROPERTIES SUFFIX "${PYTHON_MODULE_EXTENSION}") - ELSE() - ENDIF() + set_target_properties(${_NAME} PROPERTIES LINK_FLAGS + "-Wl,-undefined,dynamic_lookup") + endif() + if(PYTHON_MODULE_${_NAME}_BUILD_SHARED) + set_target_properties(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}") + set_target_properties(${_NAME} PROPERTIES SUFFIX "${PYTHON_MODULE_EXTENSION}") + else() + + endif() - ENDIF(PYTHON_ENABLE_MODULE_${_NAME}) -ENDFUNCTION(PYTHON_ADD_MODULE) + endif(PYTHON_ENABLE_MODULE_${_NAME}) +endfunction(PYTHON_ADD_MODULE) diff --git a/cpp/cmake_modules/FindRapidJSONAlt.cmake b/cpp/cmake_modules/FindRapidJSONAlt.cmake index a967ef61a66d4..4d51967c4ebd6 100644 --- a/cpp/cmake_modules/FindRapidJSONAlt.cmake +++ b/cpp/cmake_modules/FindRapidJSONAlt.cmake @@ -30,45 +30,45 @@ if(RapidJSON_FOUND) endif() if(RapidJSON_ROOT) - find_path(RAPIDJSON_INCLUDE_DIR - NAMES rapidjson/rapidjson.h - PATHS ${RapidJSON_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES "include") + find_path( + RAPIDJSON_INCLUDE_DIR + NAMES rapidjson/rapidjson.h + PATHS ${RapidJSON_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES "include") else() - find_path(RAPIDJSON_INCLUDE_DIR NAMES rapidjson/rapidjson.h PATH_SUFFIXES "include") + find_path( + RAPIDJSON_INCLUDE_DIR + NAMES rapidjson/rapidjson.h + PATH_SUFFIXES "include") endif() if(RAPIDJSON_INCLUDE_DIR) file(READ "${RAPIDJSON_INCLUDE_DIR}/rapidjson/rapidjson.h" RAPIDJSON_H_CONTENT) string(REGEX MATCH "#define RAPIDJSON_MAJOR_VERSION ([0-9]+)" RAPIDJSON_MAJOR_VERSION_DEFINITION "${RAPIDJSON_H_CONTENT}") - string(REGEX - REPLACE "^.+ ([0-9]+)$" "\\1" RAPIDJSON_MAJOR_VERSION - "${RAPIDJSON_MAJOR_VERSION_DEFINITION}") + string(REGEX REPLACE "^.+ ([0-9]+)$" "\\1" RAPIDJSON_MAJOR_VERSION + "${RAPIDJSON_MAJOR_VERSION_DEFINITION}") string(REGEX MATCH "#define RAPIDJSON_MINOR_VERSION ([0-9]+)" RAPIDJSON_MINOR_VERSION_DEFINITION "${RAPIDJSON_H_CONTENT}") - string(REGEX - REPLACE "^.+ ([0-9]+)$" "\\1" RAPIDJSON_MINOR_VERSION - "${RAPIDJSON_MINOR_VERSION_DEFINITION}") + string(REGEX REPLACE "^.+ ([0-9]+)$" "\\1" RAPIDJSON_MINOR_VERSION + "${RAPIDJSON_MINOR_VERSION_DEFINITION}") string(REGEX MATCH "#define RAPIDJSON_PATCH_VERSION ([0-9]+)" RAPIDJSON_PATCH_VERSION_DEFINITION "${RAPIDJSON_H_CONTENT}") - string(REGEX - REPLACE "^.+ ([0-9]+)$" "\\1" RAPIDJSON_PATCH_VERSION - "${RAPIDJSON_PATCH_VERSION_DEFINITION}") + string(REGEX REPLACE "^.+ ([0-9]+)$" "\\1" RAPIDJSON_PATCH_VERSION + "${RAPIDJSON_PATCH_VERSION_DEFINITION}") if("${RAPIDJSON_MAJOR_VERSION}" STREQUAL "" OR "${RAPIDJSON_MINOR_VERSION}" STREQUAL "" OR "${RAPIDJSON_PATCH_VERSION}" STREQUAL "") set(RAPIDJSON_VERSION "0.0.0") else() - set( - RAPIDJSON_VERSION - "${RAPIDJSON_MAJOR_VERSION}.${RAPIDJSON_MINOR_VERSION}.${RAPIDJSON_PATCH_VERSION}") + set(RAPIDJSON_VERSION + "${RAPIDJSON_MAJOR_VERSION}.${RAPIDJSON_MINOR_VERSION}.${RAPIDJSON_PATCH_VERSION}" + ) endif() endif() -find_package_handle_standard_args(RapidJSONAlt - REQUIRED_VARS - RAPIDJSON_INCLUDE_DIR - VERSION_VAR - RAPIDJSON_VERSION) +find_package_handle_standard_args( + RapidJSONAlt + REQUIRED_VARS RAPIDJSON_INCLUDE_DIR + VERSION_VAR RAPIDJSON_VERSION) diff --git a/cpp/cmake_modules/FindSnappy.cmake b/cpp/cmake_modules/FindSnappy.cmake index 5784cf592200b..e7661e1ef8218 100644 --- a/cpp/cmake_modules/FindSnappy.cmake +++ b/cpp/cmake_modules/FindSnappy.cmake @@ -19,39 +19,47 @@ if(ARROW_SNAPPY_USE_SHARED) set(SNAPPY_LIB_NAMES) if(CMAKE_IMPORT_LIBRARY_SUFFIX) list(APPEND SNAPPY_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}snappy${CMAKE_IMPORT_LIBRARY_SUFFIX}") + "${CMAKE_IMPORT_LIBRARY_PREFIX}snappy${CMAKE_IMPORT_LIBRARY_SUFFIX}") endif() list(APPEND SNAPPY_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}snappy${CMAKE_SHARED_LIBRARY_SUFFIX}") + "${CMAKE_SHARED_LIBRARY_PREFIX}snappy${CMAKE_SHARED_LIBRARY_SUFFIX}") else() set(SNAPPY_STATIC_LIB_NAME_BASE "snappy") if(MSVC) - set(SNAPPY_STATIC_LIB_NAME_BASE "${SNAPPY_STATIC_LIB_NAME_BASE}${SNAPPY_MSVC_STATIC_LIB_SUFFIX}") + set(SNAPPY_STATIC_LIB_NAME_BASE + "${SNAPPY_STATIC_LIB_NAME_BASE}${SNAPPY_MSVC_STATIC_LIB_SUFFIX}") endif() - set(SNAPPY_LIB_NAMES "${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_STATIC_LIB_NAME_BASE}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(SNAPPY_LIB_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_STATIC_LIB_NAME_BASE}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) endif() if(Snappy_ROOT) - find_library(Snappy_LIB - NAMES ${SNAPPY_LIB_NAMES} - PATHS ${Snappy_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_path(Snappy_INCLUDE_DIR - NAMES snappy.h - PATHS ${Snappy_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + Snappy_LIB + NAMES ${SNAPPY_LIB_NAMES} + PATHS ${Snappy_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_path( + Snappy_INCLUDE_DIR + NAMES snappy.h + PATHS ${Snappy_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) else() find_library(Snappy_LIB NAMES ${SNAPPY_LIB_NAMES}) - find_path(Snappy_INCLUDE_DIR NAMES snappy.h PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_path( + Snappy_INCLUDE_DIR + NAMES snappy.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() find_package_handle_standard_args(Snappy REQUIRED_VARS Snappy_LIB Snappy_INCLUDE_DIR) if(Snappy_FOUND) add_library(Snappy::snappy UNKNOWN IMPORTED) - set_target_properties(Snappy::snappy - PROPERTIES IMPORTED_LOCATION "${Snappy_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${Snappy_INCLUDE_DIR}") + set_target_properties( + Snappy::snappy PROPERTIES IMPORTED_LOCATION "${Snappy_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${Snappy_INCLUDE_DIR}") endif() diff --git a/cpp/cmake_modules/FindThrift.cmake b/cpp/cmake_modules/FindThrift.cmake index 273d907ed07a5..dd1020ade369c 100644 --- a/cpp/cmake_modules/FindThrift.cmake +++ b/cpp/cmake_modules/FindThrift.cmake @@ -33,9 +33,13 @@ function(EXTRACT_THRIFT_VERSION) string(REGEX MATCH "#define PACKAGE_VERSION \"[0-9.]+\"" THRIFT_VERSION_DEFINITION "${THRIFT_CONFIG_H_CONTENT}") string(REGEX MATCH "[0-9.]+" THRIFT_VERSION "${THRIFT_VERSION_DEFINITION}") - set(THRIFT_VERSION "${THRIFT_VERSION}" PARENT_SCOPE) + set(THRIFT_VERSION + "${THRIFT_VERSION}" + PARENT_SCOPE) else() - set(THRIFT_VERSION "" PARENT_SCOPE) + set(THRIFT_VERSION + "" + PARENT_SCOPE) endif() endfunction(EXTRACT_THRIFT_VERSION) @@ -55,30 +59,33 @@ if(ARROW_THRIFT_USE_SHARED) if(CMAKE_IMPORT_LIBRARY_SUFFIX) list( APPEND - THRIFT_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}${THRIFT_LIB_NAME_BASE}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - ) - endif() - list( - APPEND THRIFT_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}${THRIFT_LIB_NAME_BASE}${CMAKE_SHARED_LIBRARY_SUFFIX}" + "${CMAKE_IMPORT_LIBRARY_PREFIX}${THRIFT_LIB_NAME_BASE}${CMAKE_IMPORT_LIBRARY_SUFFIX}" ) + endif() + list( + APPEND THRIFT_LIB_NAMES + "${CMAKE_SHARED_LIBRARY_PREFIX}${THRIFT_LIB_NAME_BASE}${CMAKE_SHARED_LIBRARY_SUFFIX}") else() - set( - THRIFT_LIB_NAMES - "${CMAKE_STATIC_LIBRARY_PREFIX}${THRIFT_LIB_NAME_BASE}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(THRIFT_LIB_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}${THRIFT_LIB_NAME_BASE}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) endif() if(Thrift_ROOT) - find_library(THRIFT_LIB - NAMES ${THRIFT_LIB_NAMES} - PATHS ${Thrift_ROOT} - PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib") - find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h - PATHS ${Thrift_ROOT} - PATH_SUFFIXES "include") - find_program(THRIFT_COMPILER thrift PATHS ${Thrift_ROOT} PATH_SUFFIXES "bin") + find_library( + THRIFT_LIB + NAMES ${THRIFT_LIB_NAMES} + PATHS ${Thrift_ROOT} + PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib") + find_path( + THRIFT_INCLUDE_DIR thrift/Thrift.h + PATHS ${Thrift_ROOT} + PATH_SUFFIXES "include") + find_program( + THRIFT_COMPILER thrift + PATHS ${Thrift_ROOT} + PATH_SUFFIXES "bin") extract_thrift_version() else() # THRIFT-4760: The pkgconfig files are currently only installed when using autotools. @@ -90,19 +97,22 @@ else() list(APPEND THRIFT_PC_LIBRARY_DIRS "${THRIFT_PC_LIBDIR}") - find_library(THRIFT_LIB - NAMES ${THRIFT_LIB_NAMES} - PATHS ${THRIFT_PC_LIBRARY_DIRS} - NO_DEFAULT_PATH) - find_program(THRIFT_COMPILER thrift - HINTS ${THRIFT_PC_PREFIX} - NO_DEFAULT_PATH - PATH_SUFFIXES "bin") + find_library( + THRIFT_LIB + NAMES ${THRIFT_LIB_NAMES} + PATHS ${THRIFT_PC_LIBRARY_DIRS} + NO_DEFAULT_PATH) + find_program( + THRIFT_COMPILER thrift + HINTS ${THRIFT_PC_PREFIX} + NO_DEFAULT_PATH + PATH_SUFFIXES "bin") set(THRIFT_VERSION ${THRIFT_PC_VERSION}) else() - find_library(THRIFT_LIB - NAMES ${THRIFT_LIB_NAMES} - PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib") + find_library( + THRIFT_LIB + NAMES ${THRIFT_LIB_NAMES} + PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib") find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h PATH_SUFFIXES "include") find_program(THRIFT_COMPILER thrift PATH_SUFFIXES "bin") extract_thrift_version() @@ -115,13 +125,11 @@ else() set(Thrift_COMPILER_FOUND FALSE) endif() -find_package_handle_standard_args(Thrift - REQUIRED_VARS - THRIFT_LIB - THRIFT_INCLUDE_DIR - VERSION_VAR - THRIFT_VERSION - HANDLE_COMPONENTS) +find_package_handle_standard_args( + Thrift + REQUIRED_VARS THRIFT_LIB THRIFT_INCLUDE_DIR + VERSION_VAR THRIFT_VERSION + HANDLE_COMPONENTS) if(Thrift_FOUND OR THRIFT_FOUND) set(Thrift_FOUND TRUE) @@ -130,9 +138,9 @@ if(Thrift_FOUND OR THRIFT_FOUND) else() add_library(thrift::thrift STATIC IMPORTED) endif() - set_target_properties(thrift::thrift - PROPERTIES IMPORTED_LOCATION "${THRIFT_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${THRIFT_INCLUDE_DIR}") + set_target_properties( + thrift::thrift PROPERTIES IMPORTED_LOCATION "${THRIFT_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${THRIFT_INCLUDE_DIR}") if(WIN32 AND NOT MSVC_TOOLCHAIN) # We don't need this for Visual C++ because Thrift uses # "#pragma comment(lib, "Ws2_32.lib")" in diff --git a/cpp/cmake_modules/FindgRPCAlt.cmake b/cpp/cmake_modules/FindgRPCAlt.cmake index 79fe01744d318..2995d956be308 100644 --- a/cpp/cmake_modules/FindgRPCAlt.cmake +++ b/cpp/cmake_modules/FindgRPCAlt.cmake @@ -34,29 +34,26 @@ if(ARROW_GRPC_USE_SHARED) set(GRPC_UPB_LIB_NAMES) if(CMAKE_IMPORT_LIBRARY_SUFFIX) list(APPEND GRPC_GPR_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}gpr${CMAKE_IMPORT_LIBRARY_SUFFIX}") + "${CMAKE_IMPORT_LIBRARY_PREFIX}gpr${CMAKE_IMPORT_LIBRARY_SUFFIX}") list(APPEND GRPC_GRPC_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}grpc${CMAKE_IMPORT_LIBRARY_SUFFIX}") + "${CMAKE_IMPORT_LIBRARY_PREFIX}grpc${CMAKE_IMPORT_LIBRARY_SUFFIX}") list(APPEND GRPC_GRPCPP_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}grpc++${CMAKE_IMPORT_LIBRARY_SUFFIX}") - list( - APPEND GRPC_ADDRESS_SORTING_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}address_sorting${CMAKE_IMPORT_LIBRARY_SUFFIX}" - ) + "${CMAKE_IMPORT_LIBRARY_PREFIX}grpc++${CMAKE_IMPORT_LIBRARY_SUFFIX}") + list(APPEND GRPC_ADDRESS_SORTING_LIB_NAMES + "${CMAKE_IMPORT_LIBRARY_PREFIX}address_sorting${CMAKE_IMPORT_LIBRARY_SUFFIX}") list(APPEND GRPC_UPB_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}upb${CMAKE_IMPORT_LIBRARY_SUFFIX}") + "${CMAKE_IMPORT_LIBRARY_PREFIX}upb${CMAKE_IMPORT_LIBRARY_SUFFIX}") endif() list(APPEND GRPC_GPR_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}gpr${CMAKE_SHARED_LIBRARY_SUFFIX}") + "${CMAKE_SHARED_LIBRARY_PREFIX}gpr${CMAKE_SHARED_LIBRARY_SUFFIX}") list(APPEND GRPC_GRPC_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}grpc${CMAKE_SHARED_LIBRARY_SUFFIX}") + "${CMAKE_SHARED_LIBRARY_PREFIX}grpc${CMAKE_SHARED_LIBRARY_SUFFIX}") list(APPEND GRPC_GRPCPP_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}grpc++${CMAKE_SHARED_LIBRARY_SUFFIX}") - list( - APPEND GRPC_ADDRESS_SORTING_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}address_sorting${CMAKE_SHARED_LIBRARY_SUFFIX}") + "${CMAKE_SHARED_LIBRARY_PREFIX}grpc++${CMAKE_SHARED_LIBRARY_SUFFIX}") + list(APPEND GRPC_ADDRESS_SORTING_LIB_NAMES + "${CMAKE_SHARED_LIBRARY_PREFIX}address_sorting${CMAKE_SHARED_LIBRARY_SUFFIX}") list(APPEND GRPC_UPB_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}upb${CMAKE_SHARED_LIBRARY_SUFFIX}") + "${CMAKE_SHARED_LIBRARY_PREFIX}upb${CMAKE_SHARED_LIBRARY_SUFFIX}") else() set(GRPC_GPR_LIB_NAMES "${CMAKE_STATIC_LIBRARY_PREFIX}gpr${CMAKE_STATIC_LIBRARY_SUFFIX}") @@ -71,39 +68,46 @@ else() endif() if(gRPC_ROOT) - find_library(GRPC_GPR_LIB - NAMES ${GRPC_GPR_LIB_NAMES} - PATHS ${gRPC_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(GRPC_GRPC_LIB - NAMES ${GRPC_GRPC_LIB_NAMES} - PATHS ${gRPC_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(GRPC_GRPCPP_LIB - NAMES ${GRPC_GRPCPP_LIB_NAMES} - PATHS ${gRPC_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(GRPC_ADDRESS_SORTING_LIB - NAMES ${GRPC_ADDRESS_SORTING_LIB_NAMES} - PATHS ${gRPC_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(GRPC_UPB_LIB - NAMES ${GRPC_UPB_LIB_NAMES} - PATHS ${gRPC_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin NO_DEFAULT_PATH - PATHS ${gRPC_ROOT} - PATH_SUFFIXES "bin") - find_path(GRPC_INCLUDE_DIR - NAMES grpc/grpc.h - PATHS ${gRPC_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + GRPC_GPR_LIB + NAMES ${GRPC_GPR_LIB_NAMES} + PATHS ${gRPC_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + GRPC_GRPC_LIB + NAMES ${GRPC_GRPC_LIB_NAMES} + PATHS ${gRPC_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + GRPC_GRPCPP_LIB + NAMES ${GRPC_GRPCPP_LIB_NAMES} + PATHS ${gRPC_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + GRPC_ADDRESS_SORTING_LIB + NAMES ${GRPC_ADDRESS_SORTING_LIB_NAMES} + PATHS ${gRPC_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + GRPC_UPB_LIB + NAMES ${GRPC_UPB_LIB_NAMES} + PATHS ${gRPC_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_program( + GRPC_CPP_PLUGIN grpc_cpp_plugin NO_DEFAULT_PATH + PATHS ${gRPC_ROOT} + PATH_SUFFIXES "bin") + find_path( + GRPC_INCLUDE_DIR + NAMES grpc/grpc.h + PATHS ${gRPC_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) else() find_package(PkgConfig QUIET) pkg_check_modules(GRPC_PC grpc++) @@ -113,55 +117,67 @@ else() list(APPEND GRPC_PC_LIBRARY_DIRS "${GRPC_PC_LIBDIR}") message(STATUS "${GRPC_PC_LIBRARY_DIRS}") - find_library(GRPC_GPR_LIB - NAMES ${GRPC_GPR_LIB_NAMES} - PATHS ${GRPC_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(GRPC_GRPC_LIB - NAMES ${GRPC_GRPC_LIB_NAMES} - PATHS ${GRPC_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(GRPC_GRPCPP_LIB - NAMES ${GRPC_GRPCPP_LIB_NAMES} - PATHS ${GRPC_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(GRPC_ADDRESS_SORTING_LIB - NAMES ${GRPC_ADDRESS_SORTING_LIB_NAMES} - PATHS ${GRPC_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_library(GRPC_UPB_LIB - NAMES ${GRPC_UPB_LIB_NAMES} - PATHS ${GRPC_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin - HINTS ${GRPC_PC_PREFIX} - NO_DEFAULT_PATH - PATH_SUFFIXES "bin") + find_library( + GRPC_GPR_LIB + NAMES ${GRPC_GPR_LIB_NAMES} + PATHS ${GRPC_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + GRPC_GRPC_LIB + NAMES ${GRPC_GRPC_LIB_NAMES} + PATHS ${GRPC_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + GRPC_GRPCPP_LIB + NAMES ${GRPC_GRPCPP_LIB_NAMES} + PATHS ${GRPC_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + GRPC_ADDRESS_SORTING_LIB + NAMES ${GRPC_ADDRESS_SORTING_LIB_NAMES} + PATHS ${GRPC_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_library( + GRPC_UPB_LIB + NAMES ${GRPC_UPB_LIB_NAMES} + PATHS ${GRPC_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_program( + GRPC_CPP_PLUGIN grpc_cpp_plugin + HINTS ${GRPC_PC_PREFIX} + NO_DEFAULT_PATH + PATH_SUFFIXES "bin") else() - find_library(GRPC_GPR_LIB - NAMES ${GRPC_GPR_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_library(GRPC_GRPC_LIB - NAMES ${GRPC_GRPC_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_library(GRPC_GRPCPP_LIB - NAMES ${GRPC_GRPCPP_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_library(GRPC_ADDRESS_SORTING_LIB - NAMES ${GRPC_ADDRESS_SORTING_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_library(GRPC_UPB_LIB - NAMES ${GRPC_UPB_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_library( + GRPC_GPR_LIB + NAMES ${GRPC_GPR_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_library( + GRPC_GRPC_LIB + NAMES ${GRPC_GRPC_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_library( + GRPC_GRPCPP_LIB + NAMES ${GRPC_GRPCPP_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_library( + GRPC_ADDRESS_SORTING_LIB + NAMES ${GRPC_ADDRESS_SORTING_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_library( + GRPC_UPB_LIB + NAMES ${GRPC_UPB_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin PATH_SUFFIXES "bin") - find_path(GRPC_INCLUDE_DIR - NAMES grpc/grpc.h - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_path( + GRPC_INCLUDE_DIR + NAMES grpc/grpc.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() endif() @@ -180,17 +196,15 @@ find_package_handle_standard_args(${GRPC_ALT_FIND_PACKAGE_ARGS}) if(gRPCAlt_FOUND) add_library(gRPC::gpr UNKNOWN IMPORTED) - set_target_properties(gRPC::gpr - PROPERTIES IMPORTED_LOCATION "${GRPC_GPR_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") + set_target_properties( + gRPC::gpr PROPERTIES IMPORTED_LOCATION "${GRPC_GPR_LIB}" INTERFACE_INCLUDE_DIRECTORIES + "${GRPC_INCLUDE_DIR}") add_library(gRPC::grpc UNKNOWN IMPORTED) set_target_properties( gRPC::grpc - PROPERTIES IMPORTED_LOCATION - "${GRPC_GRPC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES - "${GRPC_INCLUDE_DIR}" + PROPERTIES IMPORTED_LOCATION "${GRPC_GRPC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "OpenSSL::SSL;OpenSSL::Crypto;ZLIB::ZLIB;c-ares::cares") @@ -199,18 +213,19 @@ if(gRPCAlt_FOUND) if(GRPC_ADDRESS_SORTING_LIB) # Address sorting is optional and not always required. add_library(gRPC::address_sorting UNKNOWN IMPORTED) - set_target_properties(gRPC::address_sorting - PROPERTIES IMPORTED_LOCATION "${GRPC_ADDRESS_SORTING_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") + set_target_properties( + gRPC::address_sorting + PROPERTIES IMPORTED_LOCATION "${GRPC_ADDRESS_SORTING_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") set(_GRPCPP_LINK_LIBRARIES "${_GRPCPP_LINK_LIBRARIES};gRPC::address_sorting") endif() if(GRPC_UPB_LIB) # upb is used by recent gRPC versions add_library(gRPC::upb UNKNOWN IMPORTED) - set_target_properties(gRPC::upb - PROPERTIES IMPORTED_LOCATION "${GRPC_UPB_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") + set_target_properties( + gRPC::upb PROPERTIES IMPORTED_LOCATION "${GRPC_UPB_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") set(_GRPCPP_LINK_LIBRARIES "${_GRPCPP_LINK_LIBRARIES};gRPC::upb") endif() @@ -233,15 +248,13 @@ if(gRPCAlt_FOUND) endif() add_library(gRPC::grpc++ UNKNOWN IMPORTED) - set_target_properties(gRPC::grpc++ - PROPERTIES IMPORTED_LOCATION - "${GRPC_GRPCPP_LIB}" - INTERFACE_LINK_LIBRARIES - "${_GRPCPP_LINK_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES - "${GRPC_INCLUDE_DIR}") + set_target_properties( + gRPC::grpc++ + PROPERTIES IMPORTED_LOCATION "${GRPC_GRPCPP_LIB}" + INTERFACE_LINK_LIBRARIES "${_GRPCPP_LINK_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") add_executable(gRPC::grpc_cpp_plugin IMPORTED) - set_target_properties(gRPC::grpc_cpp_plugin - PROPERTIES IMPORTED_LOCATION ${GRPC_CPP_PLUGIN}) + set_target_properties(gRPC::grpc_cpp_plugin PROPERTIES IMPORTED_LOCATION + ${GRPC_CPP_PLUGIN}) endif() diff --git a/cpp/cmake_modules/FindgflagsAlt.cmake b/cpp/cmake_modules/FindgflagsAlt.cmake index e092ea3e9b970..954dff22e1f47 100644 --- a/cpp/cmake_modules/FindgflagsAlt.cmake +++ b/cpp/cmake_modules/FindgflagsAlt.cmake @@ -31,29 +31,32 @@ endif() # TODO: Support version detection. if(gflags_ROOT) - find_library(gflags_LIB - NAMES gflags - PATHS ${gflags_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_path(GFLAGS_INCLUDE_DIR - NAMES gflags/gflags.h - PATHS ${gflags_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + gflags_LIB + NAMES gflags + PATHS ${gflags_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_path( + GFLAGS_INCLUDE_DIR + NAMES gflags/gflags.h + PATHS ${gflags_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) else() find_library(gflags_LIB NAMES gflags) - find_path(GFLAGS_INCLUDE_DIR - NAMES gflags/gflags.h - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_path( + GFLAGS_INCLUDE_DIR + NAMES gflags/gflags.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() find_package_handle_standard_args(gflagsAlt REQUIRED_VARS gflags_LIB GFLAGS_INCLUDE_DIR) if(gflagsAlt_FOUND) add_library(gflags::gflags UNKNOWN IMPORTED) - set_target_properties(gflags::gflags - PROPERTIES IMPORTED_LOCATION "${gflags_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GFLAGS_INCLUDE_DIR}") + set_target_properties( + gflags::gflags PROPERTIES IMPORTED_LOCATION "${gflags_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${GFLAGS_INCLUDE_DIR}") set(GFLAGS_LIBRARIES gflags::gflags) endif() diff --git a/cpp/cmake_modules/Findjemalloc.cmake b/cpp/cmake_modules/Findjemalloc.cmake index 84bb81fcba25d..3ee020218fe81 100644 --- a/cpp/cmake_modules/Findjemalloc.cmake +++ b/cpp/cmake_modules/Findjemalloc.cmake @@ -41,21 +41,24 @@ set(LIBJEMALLOC_NAMES jemalloc libjemalloc.so.1 libjemalloc.so.2 libjemalloc.dyl # Try the parameterized roots, if they exist if(_jemalloc_roots) - find_path(JEMALLOC_INCLUDE_DIR - NAMES jemalloc/jemalloc.h - PATHS ${_jemalloc_roots} - NO_DEFAULT_PATH - PATH_SUFFIXES "include") - find_library(JEMALLOC_SHARED_LIB - NAMES ${LIBJEMALLOC_NAMES} - PATHS ${_jemalloc_roots} - NO_DEFAULT_PATH - PATH_SUFFIXES "lib") - find_library(JEMALLOC_STATIC_LIB - NAMES jemalloc_pic - PATHS ${_jemalloc_roots} - NO_DEFAULT_PATH - PATH_SUFFIXES "lib") + find_path( + JEMALLOC_INCLUDE_DIR + NAMES jemalloc/jemalloc.h + PATHS ${_jemalloc_roots} + NO_DEFAULT_PATH + PATH_SUFFIXES "include") + find_library( + JEMALLOC_SHARED_LIB + NAMES ${LIBJEMALLOC_NAMES} + PATHS ${_jemalloc_roots} + NO_DEFAULT_PATH + PATH_SUFFIXES "lib") + find_library( + JEMALLOC_STATIC_LIB + NAMES jemalloc_pic + PATHS ${_jemalloc_roots} + NO_DEFAULT_PATH + PATH_SUFFIXES "lib") else() find_path(JEMALLOC_INCLUDE_DIR NAMES jemalloc/jemalloc.h) message(STATUS ${JEMALLOC_INCLUDE_DIR}) diff --git a/cpp/cmake_modules/Findre2Alt.cmake b/cpp/cmake_modules/Findre2Alt.cmake index 93b69ce77cbbb..8acc3838eeb18 100644 --- a/cpp/cmake_modules/Findre2Alt.cmake +++ b/cpp/cmake_modules/Findre2Alt.cmake @@ -34,15 +34,18 @@ if(RE2_PC_FOUND) set(RE2_INCLUDE_DIR "${RE2_PC_INCLUDEDIR}") list(APPEND RE2_PC_LIBRARY_DIRS "${RE2_PC_LIBDIR}") - find_library(RE2_LIB re2 - PATHS ${RE2_PC_LIBRARY_DIRS} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) + find_library( + RE2_LIB re2 + PATHS ${RE2_PC_LIBRARY_DIRS} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) # On Fedora, the reported prefix is wrong. As users likely run into this, # workaround. # https://bugzilla.redhat.com/show_bug.cgi?id=1652589 - if(UNIX AND NOT APPLE AND NOT RE2_LIB) + if(UNIX + AND NOT APPLE + AND NOT RE2_LIB) if(RE2_PC_PREFIX STREQUAL "/usr/local") find_library(RE2_LIB re2) endif() @@ -51,26 +54,32 @@ elseif(RE2_ROOT) find_library( RE2_LIB NAMES - re2_static re2 + re2_static + re2 "${CMAKE_STATIC_LIBRARY_PREFIX}re2${RE2_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" "${CMAKE_SHARED_LIBRARY_PREFIX}re2${CMAKE_SHARED_LIBRARY_SUFFIX}" PATHS ${RE2_ROOT} PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} NO_DEFAULT_PATH) - find_path(RE2_INCLUDE_DIR - NAMES re2/re2.h - PATHS ${RE2_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_path( + RE2_INCLUDE_DIR + NAMES re2/re2.h + PATHS ${RE2_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) else() find_library( RE2_LIB NAMES - re2_static re2 + re2_static + re2 "${CMAKE_STATIC_LIBRARY_PREFIX}re2${RE2_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" "${CMAKE_SHARED_LIBRARY_PREFIX}re2${CMAKE_SHARED_LIBRARY_SUFFIX}" PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_path(RE2_INCLUDE_DIR NAMES re2/re2.h PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_path( + RE2_INCLUDE_DIR + NAMES re2/re2.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() find_package_handle_standard_args(re2Alt REQUIRED_VARS RE2_LIB RE2_INCLUDE_DIR) @@ -78,8 +87,8 @@ find_package_handle_standard_args(re2Alt REQUIRED_VARS RE2_LIB RE2_INCLUDE_DIR) if(re2Alt_FOUND) if(NOT TARGET re2::re2) add_library(re2::re2 UNKNOWN IMPORTED) - set_target_properties(re2::re2 - PROPERTIES IMPORTED_LOCATION "${RE2_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${RE2_INCLUDE_DIR}") + set_target_properties( + re2::re2 PROPERTIES IMPORTED_LOCATION "${RE2_LIB}" INTERFACE_INCLUDE_DIRECTORIES + "${RE2_INCLUDE_DIR}") endif() endif() diff --git a/cpp/cmake_modules/Findutf8proc.cmake b/cpp/cmake_modules/Findutf8proc.cmake index 560321df5db40..95d2977f2e194 100644 --- a/cpp/cmake_modules/Findutf8proc.cmake +++ b/cpp/cmake_modules/Findutf8proc.cmake @@ -19,17 +19,18 @@ if(ARROW_UTF8PROC_USE_SHARED) set(utf8proc_LIB_NAMES) if(CMAKE_IMPORT_LIBRARY_SUFFIX) list(APPEND utf8proc_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}utf8proc${CMAKE_IMPORT_LIBRARY_SUFFIX}") + "${CMAKE_IMPORT_LIBRARY_PREFIX}utf8proc${CMAKE_IMPORT_LIBRARY_SUFFIX}") endif() list(APPEND utf8proc_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}utf8proc${CMAKE_SHARED_LIBRARY_SUFFIX}") + "${CMAKE_SHARED_LIBRARY_PREFIX}utf8proc${CMAKE_SHARED_LIBRARY_SUFFIX}") else() if(MSVC AND NOT DEFINED utf8proc_MSVC_STATIC_LIB_SUFFIX) set(utf8proc_MSVC_STATIC_LIB_SUFFIX "_static") endif() set(utf8proc_STATIC_LIB_SUFFIX "${utf8proc_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - set(utf8proc_LIB_NAMES "${CMAKE_STATIC_LIBRARY_PREFIX}utf8proc${utf8proc_STATIC_LIB_SUFFIX}") + set(utf8proc_LIB_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}utf8proc${utf8proc_STATIC_LIB_SUFFIX}") endif() if(utf8proc_ROOT) @@ -39,29 +40,34 @@ if(utf8proc_ROOT) PATHS ${utf8proc_ROOT} PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} NO_DEFAULT_PATH) - find_path(utf8proc_INCLUDE_DIR - NAMES utf8proc.h - PATHS ${utf8proc_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_path( + utf8proc_INCLUDE_DIR + NAMES utf8proc.h + PATHS ${utf8proc_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) else() find_library( utf8proc_LIB NAMES ${utf8proc_LIB_NAMES} PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_path(utf8proc_INCLUDE_DIR NAMES utf8proc.h PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_path( + utf8proc_INCLUDE_DIR + NAMES utf8proc.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() -find_package_handle_standard_args(utf8proc REQUIRED_VARS utf8proc_LIB utf8proc_INCLUDE_DIR) +find_package_handle_standard_args(utf8proc REQUIRED_VARS utf8proc_LIB + utf8proc_INCLUDE_DIR) if(utf8proc_FOUND) set(utf8proc_FOUND TRUE) add_library(utf8proc::utf8proc UNKNOWN IMPORTED) - set_target_properties(utf8proc::utf8proc - PROPERTIES IMPORTED_LOCATION "${utf8proc_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${utf8proc_INCLUDE_DIR}") + set_target_properties( + utf8proc::utf8proc PROPERTIES IMPORTED_LOCATION "${utf8proc_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${utf8proc_INCLUDE_DIR}") if(NOT ARROW_UTF8PROC_USE_SHARED) - set_target_properties(utf8proc::utf8proc - PROPERTIES INTERFACE_COMPILER_DEFINITIONS "UTF8PROC_STATIC") + set_target_properties(utf8proc::utf8proc PROPERTIES INTERFACE_COMPILER_DEFINITIONS + "UTF8PROC_STATIC") endif() endif() diff --git a/cpp/cmake_modules/Findzstd.cmake b/cpp/cmake_modules/Findzstd.cmake index f32892aecb88f..c110750ef4cf4 100644 --- a/cpp/cmake_modules/Findzstd.cmake +++ b/cpp/cmake_modules/Findzstd.cmake @@ -24,15 +24,12 @@ if(ARROW_ZSTD_USE_SHARED) set(ZSTD_LIB_NAMES) if(CMAKE_IMPORT_LIBRARY_SUFFIX) list( - APPEND - ZSTD_LIB_NAMES - "${CMAKE_IMPORT_LIBRARY_PREFIX}${ZSTD_LIB_NAME_BASE}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - ) + APPEND ZSTD_LIB_NAMES + "${CMAKE_IMPORT_LIBRARY_PREFIX}${ZSTD_LIB_NAME_BASE}${CMAKE_IMPORT_LIBRARY_SUFFIX}") endif() list( - APPEND - ZSTD_LIB_NAMES - "${CMAKE_SHARED_LIBRARY_PREFIX}${ZSTD_LIB_NAME_BASE}${CMAKE_SHARED_LIBRARY_SUFFIX}") + APPEND ZSTD_LIB_NAMES + "${CMAKE_SHARED_LIBRARY_PREFIX}${ZSTD_LIB_NAME_BASE}${CMAKE_SHARED_LIBRARY_SUFFIX}") else() if(MSVC AND NOT DEFINED ZSTD_MSVC_STATIC_LIB_SUFFIX) set(ZSTD_MSVC_STATIC_LIB_SUFFIX "_static") @@ -46,16 +43,18 @@ endif() # First, find via if specified ZTD_ROOT if(ZSTD_ROOT) message(STATUS "Using ZSTD_ROOT: ${ZSTD_ROOT}") - find_library(ZSTD_LIB - NAMES ${ZSTD_LIB_NAMES} - PATHS ${ZSTD_ROOT} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} - NO_DEFAULT_PATH) - find_path(ZSTD_INCLUDE_DIR - NAMES zstd.h - PATHS ${ZSTD_ROOT} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + ZSTD_LIB + NAMES ${ZSTD_LIB_NAMES} + PATHS ${ZSTD_ROOT} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES} + NO_DEFAULT_PATH) + find_path( + ZSTD_INCLUDE_DIR + NAMES zstd.h + PATHS ${ZSTD_ROOT} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) else() # Second, find via pkg_check_modules @@ -65,17 +64,22 @@ else() set(ZSTD_INCLUDE_DIR "${ZSTD_PC_INCLUDEDIR}") list(APPEND ZSTD_PC_LIBRARY_DIRS "${ZSTD_PC_LIBDIR}") - find_library(ZSTD_LIB - NAMES ${ZSTD_LIB_NAMES} - PATHS ${ZSTD_PC_LIBRARY_DIRS} - NO_DEFAULT_PATH - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_library( + ZSTD_LIB + NAMES ${ZSTD_LIB_NAMES} + PATHS ${ZSTD_PC_LIBRARY_DIRS} + NO_DEFAULT_PATH + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) else() # Third, check all other CMake paths - find_library(ZSTD_LIB - NAMES ${ZSTD_LIB_NAMES} - PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_path(ZSTD_INCLUDE_DIR NAMES zstd.h PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_library( + ZSTD_LIB + NAMES ${ZSTD_LIB_NAMES} + PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) + find_path( + ZSTD_INCLUDE_DIR + NAMES zstd.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() endif() @@ -83,7 +87,7 @@ find_package_handle_standard_args(zstd REQUIRED_VARS ZSTD_LIB ZSTD_INCLUDE_DIR) if(zstd_FOUND) add_library(zstd::libzstd UNKNOWN IMPORTED) - set_target_properties(zstd::libzstd - PROPERTIES IMPORTED_LOCATION "${ZSTD_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${ZSTD_INCLUDE_DIR}") + set_target_properties( + zstd::libzstd PROPERTIES IMPORTED_LOCATION "${ZSTD_LIB}" INTERFACE_INCLUDE_DIRECTORIES + "${ZSTD_INCLUDE_DIR}") endif() diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 03d6a4ea34e49..80ca71cb6de3d 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -64,7 +64,8 @@ if(ARROW_CPU_FLAG STREQUAL "x86") # Check for AVX512 support in the compiler. set(OLD_CMAKE_REQURED_FLAGS ${CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${ARROW_AVX512_FLAG}") - check_cxx_source_compiles(" + check_cxx_source_compiles( + " #ifdef _MSC_VER #include #else @@ -76,12 +77,13 @@ if(ARROW_CPU_FLAG STREQUAL "x86") char out[32]; _mm512_storeu_si512(out, mask); return 0; - }" CXX_SUPPORTS_AVX512) + }" + CXX_SUPPORTS_AVX512) set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQURED_FLAGS}) endif() # Runtime SIMD level it can get from compiler and ARROW_RUNTIME_SIMD_LEVEL - if(CXX_SUPPORTS_SSE4_2 - AND ARROW_RUNTIME_SIMD_LEVEL MATCHES "^(SSE4_2|AVX2|AVX512|MAX)$") + if(CXX_SUPPORTS_SSE4_2 AND ARROW_RUNTIME_SIMD_LEVEL MATCHES + "^(SSE4_2|AVX2|AVX512|MAX)$") set(ARROW_HAVE_RUNTIME_SSE4_2 ON) add_definitions(-DARROW_HAVE_RUNTIME_SSE4_2) endif() @@ -177,17 +179,18 @@ if(WIN32) set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd5105") if(ARROW_USE_STATIC_CRT) - foreach(c_flag - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_MINSIZEREL - CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_C_FLAGS - CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_MINSIZEREL - CMAKE_C_FLAGS_RELWITHDEBINFO) + foreach( + c_flag + CMAKE_CXX_FLAGS + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_MINSIZEREL + CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS + CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_MINSIZEREL + CMAKE_C_FLAGS_RELWITHDEBINFO) string(REPLACE "/MD" "-MT" ${c_flag} "${${c_flag}}") endforeach() endif() @@ -252,8 +255,8 @@ if("${BUILD_WARNING_LEVEL}" STREQUAL "CHECKIN") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd4365") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd4267") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd4838") - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL + "Clang") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wall") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wextra") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wdocumentation") @@ -279,8 +282,8 @@ elseif("${BUILD_WARNING_LEVEL}" STREQUAL "EVERYTHING") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /Wall") # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level # /wdnnnn disables a warning where "nnnn" is a warning number - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL + "Clang") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Weverything") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-c++98-compat") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-c++98-compat-pedantic") @@ -302,10 +305,11 @@ else() # /wdnnnn disables a warning where "nnnn" is a warning number string(REPLACE "/W3" "" CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS}") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /W3") - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + elseif( + CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" + OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wall") else() message(FATAL_ERROR "${UNKNOWN_COMPILER_MESSAGE}") @@ -324,8 +328,8 @@ if(MSVC) # (required for protobuf, see https://github.com/protocolbuffers/protobuf/issues/6885) set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd4065") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "7.0" - OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0") + if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "7.0" OR CMAKE_CXX_COMPILER_VERSION + VERSION_GREATER "7.0") # Without this, gcc >= 7 warns related to changes in C++17 set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -Wno-noexcept-type") endif() @@ -352,8 +356,8 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -Wno-subobject-linkage") endif() -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL + "Clang") # Clang options for all builds # Using Clang with ccache causes a bunch of spurious warnings that are @@ -428,8 +432,8 @@ if(ARROW_CPU_FLAG STREQUAL "armv8") add_definitions(-DARROW_HAVE_NEON) - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" - AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.4") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS + "5.4") message(WARNING "Disable Armv8 CRC and Crypto as compiler doesn't support them well.") else() if(ARROW_ARMV8_ARCH_FLAG MATCHES "\\+crypto") @@ -454,9 +458,10 @@ endif() # Any additional arguments are passed verbatim into the C++ compiler invocation. function(GET_GOLD_VERSION) # The gold linker is only for ELF binaries, which macOS doesn't use. - execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-Wl,--version" ${ARGN} - ERROR_QUIET - OUTPUT_VARIABLE LINKER_OUTPUT) + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} "-Wl,--version" ${ARGN} + ERROR_QUIET + OUTPUT_VARIABLE LINKER_OUTPUT) # We're expecting LINKER_OUTPUT to look like one of these: # GNU gold (version 2.24) 1.11 # GNU gold (GNU Binutils for Ubuntu 2.30) 1.15 @@ -466,7 +471,9 @@ function(GET_GOLD_VERSION) message(SEND_ERROR "Could not extract GNU gold version. " "Linker version output: ${LINKER_OUTPUT}") endif() - set(GOLD_VERSION "${CMAKE_MATCH_1}" PARENT_SCOPE) + set(GOLD_VERSION + "${CMAKE_MATCH_1}" + PARENT_SCOPE) endif() endfunction() @@ -482,9 +489,10 @@ if(NOT WIN32 AND NOT APPLE) # We can't use the gold linker if it's inside devtoolset because the compiler # won't find it when invoked directly from make/ninja (which is typically # done outside devtoolset). - execute_process(COMMAND which ld.gold - OUTPUT_VARIABLE GOLD_LOCATION - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + execute_process( + COMMAND which ld.gold + OUTPUT_VARIABLE GOLD_LOCATION + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) if("${GOLD_LOCATION}" MATCHES "^/opt/rh/devtoolset") message("Skipping optional gold linker (version ${GOLD_VERSION}) because " "it's in devtoolset") @@ -565,7 +573,7 @@ set(CXX_FLAGS_PROFILE_BUILD "${CXX_FLAGS_RELEASE} -fprofile-use") # Set compile flags based on the build type. message( "Configured for ${CMAKE_BUILD_TYPE} build (set with cmake -DCMAKE_BUILD_TYPE={release,debug,...})" - ) +) if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_DEBUG}") diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index e361f0417abb6..c84a58ee84ccb 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -193,10 +193,7 @@ endmacro() macro(resolve_dependency DEPENDENCY_NAME) set(options) set(one_value_args HAVE_ALT IS_RUNTIME_DEPENDENCY REQUIRED_VERSION USE_CONFIG) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") @@ -272,7 +269,9 @@ if(ARROW_JSON) set(ARROW_WITH_RAPIDJSON ON) endif() -if(ARROW_ORC OR ARROW_FLIGHT OR ARROW_GANDIVA) +if(ARROW_ORC + OR ARROW_FLIGHT + OR ARROW_GANDIVA) set(ARROW_WITH_PROTOBUF ON) endif() @@ -306,9 +305,8 @@ endmacro() file(STRINGS "${THIRDPARTY_DIR}/versions.txt" TOOLCHAIN_VERSIONS_TXT) foreach(_VERSION_ENTRY ${TOOLCHAIN_VERSIONS_TXT}) # Exclude comments - if(NOT - ((_VERSION_ENTRY MATCHES "^[^#][A-Za-z0-9-_]+_VERSION=") - OR (_VERSION_ENTRY MATCHES "^[^#][A-Za-z0-9-_]+_CHECKSUM="))) + if(NOT ((_VERSION_ENTRY MATCHES "^[^#][A-Za-z0-9-_]+_VERSION=") + OR (_VERSION_ENTRY MATCHES "^[^#][A-Za-z0-9-_]+_CHECKSUM="))) continue() endif() @@ -340,7 +338,7 @@ else() set_urls( AWS_C_COMMON_SOURCE_URL "https://github.com/awslabs/aws-c-common/archive/${ARROW_AWS_C_COMMON_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_AWS_CHECKSUMS_URL}) @@ -349,7 +347,7 @@ else() set_urls( AWS_CHECKSUMS_SOURCE_URL "https://github.com/awslabs/aws-checksums/archive/${ARROW_AWS_CHECKSUMS_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_AWS_C_EVENT_STREAM_URL}) @@ -358,7 +356,7 @@ else() set_urls( AWS_C_EVENT_STREAM_SOURCE_URL "https://github.com/awslabs/aws-c-event-stream/archive/${ARROW_AWS_C_EVENT_STREAM_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_AWSSDK_URL}) @@ -369,7 +367,7 @@ else() "https://github.com/aws/aws-sdk-cpp/archive/${ARROW_AWSSDK_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/aws-sdk-cpp-${ARROW_AWSSDK_BUILD_VERSION}.tar.gz" "https://dl.bintray.com/ursalabs/arrow-awssdk/aws-sdk-cpp-${ARROW_AWSSDK_BUILD_VERSION}.tar.gz/aws-sdk-cpp-${ARROW_AWSSDK_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_BOOST_URL}) @@ -388,7 +386,7 @@ else() # our currently used packages and doesn't fall out of sync with # ${ARROW_BOOST_BUILD_VERSION_UNDERSCORES} "https://github.com/ursa-labs/thirdparty/releases/download/latest/boost_${ARROW_BOOST_BUILD_VERSION_UNDERSCORES}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_BROTLI_URL}) @@ -398,7 +396,7 @@ else() BROTLI_SOURCE_URL "https://github.com/google/brotli/archive/${ARROW_BROTLI_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/brotli-${ARROW_BROTLI_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_CARES_URL}) @@ -408,7 +406,7 @@ else() CARES_SOURCE_URL "https://c-ares.haxx.se/download/c-ares-${ARROW_CARES_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/cares-${ARROW_CARES_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_GBENCHMARK_URL}) @@ -418,7 +416,7 @@ else() GBENCHMARK_SOURCE_URL "https://github.com/google/benchmark/archive/${ARROW_GBENCHMARK_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/gbenchmark-${ARROW_GBENCHMARK_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_GFLAGS_URL}) @@ -428,7 +426,7 @@ else() GFLAGS_SOURCE_URL "https://github.com/gflags/gflags/archive/${ARROW_GFLAGS_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/gflags-${ARROW_GFLAGS_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_GLOG_URL}) @@ -438,7 +436,7 @@ else() GLOG_SOURCE_URL "https://github.com/google/glog/archive/${ARROW_GLOG_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/glog-${ARROW_GLOG_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_GRPC_URL}) @@ -448,7 +446,7 @@ else() GRPC_SOURCE_URL "https://github.com/grpc/grpc/archive/${ARROW_GRPC_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/grpc-${ARROW_GRPC_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_GTEST_URL}) @@ -460,7 +458,7 @@ else() "https://chromium.googlesource.com/external/github.com/google/googletest/+archive/release-${ARROW_GTEST_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/gtest-${ARROW_GTEST_BUILD_VERSION}.tar.gz" "https://dl.bintray.com/ursalabs/arrow-gtest/gtest-${ARROW_GTEST_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_JEMALLOC_URL}) @@ -470,7 +468,7 @@ else() JEMALLOC_SOURCE_URL "https://github.com/jemalloc/jemalloc/releases/download/${ARROW_JEMALLOC_BUILD_VERSION}/jemalloc-${ARROW_JEMALLOC_BUILD_VERSION}.tar.bz2" "https://github.com/ursa-labs/thirdparty/releases/download/latest/jemalloc-${ARROW_JEMALLOC_BUILD_VERSION}.tar.bz2" - ) + ) endif() if(DEFINED ENV{ARROW_MIMALLOC_URL}) @@ -480,16 +478,17 @@ else() MIMALLOC_SOURCE_URL "https://github.com/microsoft/mimalloc/archive/${ARROW_MIMALLOC_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/mimalloc-${ARROW_MIMALLOC_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_LZ4_URL}) set(LZ4_SOURCE_URL "$ENV{ARROW_LZ4_URL}") else() set_urls( - LZ4_SOURCE_URL "https://github.com/lz4/lz4/archive/${ARROW_LZ4_BUILD_VERSION}.tar.gz" + LZ4_SOURCE_URL + "https://github.com/lz4/lz4/archive/${ARROW_LZ4_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/lz4-${ARROW_LZ4_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_ORC_URL}) @@ -499,7 +498,7 @@ else() ORC_SOURCE_URL "https://github.com/apache/orc/archive/rel/release-${ARROW_ORC_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/orc-${ARROW_ORC_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_PROTOBUF_URL}) @@ -512,7 +511,7 @@ else() PROTOBUF_SOURCE_URL "https://github.com/protocolbuffers/protobuf/releases/download/${ARROW_PROTOBUF_BUILD_VERSION}/protobuf-all-${ARROW_PROTOBUF_STRIPPED_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/protobuf-${ARROW_PROTOBUF_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_RE2_URL}) @@ -522,7 +521,7 @@ else() RE2_SOURCE_URL "https://github.com/google/re2/archive/${ARROW_RE2_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/re2-${ARROW_RE2_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_RAPIDJSON_URL}) @@ -532,7 +531,7 @@ else() RAPIDJSON_SOURCE_URL "https://github.com/miloyip/rapidjson/archive/${ARROW_RAPIDJSON_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/rapidjson-${ARROW_RAPIDJSON_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_SNAPPY_URL}) @@ -542,7 +541,7 @@ else() SNAPPY_SOURCE_URL "https://github.com/google/snappy/archive/${ARROW_SNAPPY_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/snappy-${ARROW_SNAPPY_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_THRIFT_URL}) @@ -566,16 +565,17 @@ else() "https://us.mirrors.quenda.co/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" "https://dl.bintray.com/ursalabs/arrow-thrift/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_ZLIB_URL}) set(ZLIB_SOURCE_URL "$ENV{ARROW_ZLIB_URL}") else() set_urls( - ZLIB_SOURCE_URL "https://zlib.net/fossils/zlib-${ARROW_ZLIB_BUILD_VERSION}.tar.gz" + ZLIB_SOURCE_URL + "https://zlib.net/fossils/zlib-${ARROW_ZLIB_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/zlib-${ARROW_ZLIB_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_ZSTD_URL}) @@ -585,7 +585,7 @@ else() ZSTD_SOURCE_URL "https://github.com/facebook/zstd/archive/${ARROW_ZSTD_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/zstd-${ARROW_ZSTD_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_BZIP2_SOURCE_URL}) @@ -595,7 +595,7 @@ else() ARROW_BZIP2_SOURCE_URL "https://sourceware.org/pub/bzip2/bzip2-${ARROW_BZIP2_BUILD_VERSION}.tar.gz" "https://github.com/ursa-labs/thirdparty/releases/download/latest/bzip2-${ARROW_BZIP2_BUILD_VERSION}.tar.gz" - ) + ) endif() if(DEFINED ENV{ARROW_UTF8PROC_SOURCE_URL}) @@ -604,7 +604,7 @@ else() set_urls( ARROW_UTF8PROC_SOURCE_URL "https://github.com/JuliaStrings/utf8proc/archive/${ARROW_UTF8PROC_BUILD_VERSION}.tar.gz" - ) + ) endif() # ---------------------------------------------------------------------- @@ -716,12 +716,12 @@ macro(build_boost) set(BOOST_BUILD_WITH_LIBRARIES "filesystem" "regex" "system") string(REPLACE ";" "," BOOST_CONFIGURE_LIBRARIES "${BOOST_BUILD_WITH_LIBRARIES}") list(APPEND BOOST_CONFIGURE_COMMAND "--prefix=${BOOST_PREFIX}" - "--with-libraries=${BOOST_CONFIGURE_LIBRARIES}") + "--with-libraries=${BOOST_CONFIGURE_LIBRARIES}") set(BOOST_BUILD_COMMAND "./b2" "-j${NPROC}" "link=${BOOST_BUILD_LINK}" "variant=${BOOST_BUILD_VARIANT}") if(MSVC) - string(REGEX - REPLACE "([0-9])$" ".\\1" BOOST_TOOLSET_MSVC_VERSION ${MSVC_TOOLSET_VERSION}) + string(REGEX REPLACE "([0-9])$" ".\\1" BOOST_TOOLSET_MSVC_VERSION + ${MSVC_TOOLSET_VERSION}) list(APPEND BOOST_BUILD_COMMAND "toolset=msvc-${BOOST_TOOLSET_MSVC_VERSION}") set(BOOST_BUILD_WITH_LIBRARIES_MSVC) foreach(_BOOST_LIB ${BOOST_BUILD_WITH_LIBRARIES}) @@ -733,10 +733,11 @@ macro(build_boost) endif() if(MSVC) - string(REGEX - REPLACE "^([0-9]+)\\.([0-9]+)\\.[0-9]+$" "\\1_\\2" - ARROW_BOOST_BUILD_VERSION_NO_MICRO_UNDERSCORE - ${ARROW_BOOST_BUILD_VERSION}) + string( + REGEX + REPLACE "^([0-9]+)\\.([0-9]+)\\.[0-9]+$" "\\1_\\2" + ARROW_BOOST_BUILD_VERSION_NO_MICRO_UNDERSCORE + ${ARROW_BOOST_BUILD_VERSION}) set(BOOST_LIBRARY_SUFFIX "-vc${MSVC_TOOLSET_VERSION}-mt") if(BOOST_BUILD_VARIANT STREQUAL "debug") set(BOOST_LIBRARY_SUFFIX "${BOOST_LIBRARY_SUFFIX}-gd") @@ -746,24 +747,21 @@ macro(build_boost) else() set(BOOST_LIBRARY_SUFFIX "") endif() - set( - BOOST_STATIC_SYSTEM_LIBRARY - "${BOOST_LIB_DIR}/libboost_system${BOOST_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - set( - BOOST_STATIC_FILESYSTEM_LIBRARY - "${BOOST_LIB_DIR}/libboost_filesystem${BOOST_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - set( - BOOST_STATIC_REGEX_LIBRARY - "${BOOST_LIB_DIR}/libboost_regex${BOOST_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(BOOST_STATIC_SYSTEM_LIBRARY + "${BOOST_LIB_DIR}/libboost_system${BOOST_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(BOOST_STATIC_FILESYSTEM_LIBRARY + "${BOOST_LIB_DIR}/libboost_filesystem${BOOST_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(BOOST_STATIC_REGEX_LIBRARY + "${BOOST_LIB_DIR}/libboost_regex${BOOST_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) set(BOOST_SYSTEM_LIBRARY boost_system_static) set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_static) set(BOOST_REGEX_LIBRARY boost_regex_static) - set(BOOST_BUILD_PRODUCTS ${BOOST_STATIC_SYSTEM_LIBRARY} - ${BOOST_STATIC_FILESYSTEM_LIBRARY} - ${BOOST_STATIC_REGEX_LIBRARY}) + set(BOOST_BUILD_PRODUCTS + ${BOOST_STATIC_SYSTEM_LIBRARY} ${BOOST_STATIC_FILESYSTEM_LIBRARY} + ${BOOST_STATIC_REGEX_LIBRARY}) add_thirdparty_lib(boost_system STATIC_LIB "${BOOST_STATIC_SYSTEM_LIBRARY}") @@ -771,22 +769,24 @@ macro(build_boost) add_thirdparty_lib(boost_regex STATIC_LIB "${BOOST_STATIC_REGEX_LIBRARY}") - externalproject_add(boost_ep - URL ${BOOST_SOURCE_URL} - BUILD_BYPRODUCTS ${BOOST_BUILD_PRODUCTS} - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND} - BUILD_COMMAND ${BOOST_BUILD_COMMAND} - INSTALL_COMMAND "" ${EP_LOG_OPTIONS}) + externalproject_add( + boost_ep + URL ${BOOST_SOURCE_URL} + BUILD_BYPRODUCTS ${BOOST_BUILD_PRODUCTS} + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND} + BUILD_COMMAND ${BOOST_BUILD_COMMAND} + INSTALL_COMMAND "" ${EP_LOG_OPTIONS}) list(APPEND ARROW_BUNDLED_STATIC_LIBS boost_system_static boost_filesystem_static - boost_regex_static) + boost_regex_static) else() - externalproject_add(boost_ep - ${EP_LOG_OPTIONS} - BUILD_COMMAND "" - CONFIGURE_COMMAND "" - INSTALL_COMMAND "" - URL ${BOOST_SOURCE_URL}) + externalproject_add( + boost_ep + ${EP_LOG_OPTIONS} + BUILD_COMMAND "" + CONFIGURE_COMMAND "" + INSTALL_COMMAND "" + URL ${BOOST_SOURCE_URL}) endif() set(Boost_INCLUDE_DIR "${BOOST_PREFIX}") set(Boost_INCLUDE_DIRS "${Boost_INCLUDE_DIR}") @@ -882,9 +882,10 @@ if(ARROW_BUILD_INTEGRATION OR (ARROW_PARQUET AND PARQUET_REQUIRES_BOOST)) set(ARROW_BOOST_REQUIRED TRUE) set(ARROW_BOOST_REQUIRE_LIBRARY TRUE) -elseif(ARROW_GANDIVA - OR (ARROW_WITH_THRIFT AND THRIFT_REQUIRES_BOOST) - OR (NOT ARROW_USE_NATIVE_INT128)) +elseif( + ARROW_GANDIVA + OR (ARROW_WITH_THRIFT AND THRIFT_REQUIRES_BOOST) + OR (NOT ARROW_USE_NATIVE_INT128)) set(ARROW_BOOST_REQUIRED TRUE) set(ARROW_BOOST_REQUIRE_LIBRARY FALSE) else() @@ -892,13 +893,14 @@ else() endif() if(ARROW_BOOST_REQUIRED) - resolve_dependency(Boost - HAVE_ALT - TRUE - REQUIRED_VERSION - ${ARROW_BOOST_REQUIRED_VERSION} - IS_RUNTIME_DEPENDENCY - ${ARROW_BOOST_REQUIRE_LIBRARY}) + resolve_dependency( + Boost + HAVE_ALT + TRUE + REQUIRED_VERSION + ${ARROW_BOOST_REQUIRED_VERSION} + IS_RUNTIME_DEPENDENCY + ${ARROW_BOOST_REQUIRE_LIBRARY}) if(TARGET Boost::system) set(BOOST_SYSTEM_LIBRARY Boost::system) @@ -928,30 +930,29 @@ macro(build_snappy) message(STATUS "Building snappy from source") set(SNAPPY_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/snappy_ep/src/snappy_ep-install") set(SNAPPY_STATIC_LIB_NAME snappy) - set( - SNAPPY_STATIC_LIB - "${SNAPPY_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_STATIC_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(SNAPPY_STATIC_LIB + "${SNAPPY_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_STATIC_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) - set(SNAPPY_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_LIBDIR=lib - -DSNAPPY_BUILD_TESTS=OFF - "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}") + set(SNAPPY_CMAKE_ARGS + ${EP_COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_LIBDIR=lib -DSNAPPY_BUILD_TESTS=OFF + "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}") - externalproject_add(snappy_ep - ${EP_LOG_OPTIONS} - BUILD_IN_SOURCE 1 - INSTALL_DIR ${SNAPPY_PREFIX} - URL ${SNAPPY_SOURCE_URL} - CMAKE_ARGS ${SNAPPY_CMAKE_ARGS} - BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}") + externalproject_add( + snappy_ep + ${EP_LOG_OPTIONS} + BUILD_IN_SOURCE 1 + INSTALL_DIR ${SNAPPY_PREFIX} + URL ${SNAPPY_SOURCE_URL} + CMAKE_ARGS ${SNAPPY_CMAKE_ARGS} + BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}") file(MAKE_DIRECTORY "${SNAPPY_PREFIX}/include") add_library(Snappy::snappy STATIC IMPORTED) - set_target_properties(Snappy::snappy - PROPERTIES IMPORTED_LOCATION "${SNAPPY_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES - "${SNAPPY_PREFIX}/include") + set_target_properties( + Snappy::snappy PROPERTIES IMPORTED_LOCATION "${SNAPPY_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${SNAPPY_PREFIX}/include") add_dependencies(toolchain snappy_ep) add_dependencies(Snappy::snappy snappy_ep) @@ -973,54 +974,50 @@ macro(build_brotli) set(BROTLI_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/brotli_ep/src/brotli_ep-install") set(BROTLI_INCLUDE_DIR "${BROTLI_PREFIX}/include") set(BROTLI_LIB_DIR lib) - set( - BROTLI_STATIC_LIBRARY_ENC - "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc-static${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - set( - BROTLI_STATIC_LIBRARY_DEC - "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec-static${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - set( - BROTLI_STATIC_LIBRARY_COMMON - "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon-static${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(BROTLI_STATIC_LIBRARY_ENC + "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc-static${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(BROTLI_STATIC_LIBRARY_DEC + "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec-static${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(BROTLI_STATIC_LIBRARY_COMMON + "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon-static${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) set(BROTLI_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${BROTLI_PREFIX}" -DCMAKE_INSTALL_LIBDIR=${BROTLI_LIB_DIR}) - externalproject_add(brotli_ep - URL ${BROTLI_SOURCE_URL} - BUILD_BYPRODUCTS "${BROTLI_STATIC_LIBRARY_ENC}" - "${BROTLI_STATIC_LIBRARY_DEC}" - "${BROTLI_STATIC_LIBRARY_COMMON}" - ${BROTLI_BUILD_BYPRODUCTS} - ${EP_LOG_OPTIONS} - CMAKE_ARGS ${BROTLI_CMAKE_ARGS} - STEP_TARGETS headers_copy) + externalproject_add( + brotli_ep + URL ${BROTLI_SOURCE_URL} + BUILD_BYPRODUCTS + "${BROTLI_STATIC_LIBRARY_ENC}" "${BROTLI_STATIC_LIBRARY_DEC}" + "${BROTLI_STATIC_LIBRARY_COMMON}" ${BROTLI_BUILD_BYPRODUCTS} ${EP_LOG_OPTIONS} + CMAKE_ARGS ${BROTLI_CMAKE_ARGS} + STEP_TARGETS headers_copy) add_dependencies(toolchain brotli_ep) file(MAKE_DIRECTORY "${BROTLI_INCLUDE_DIR}") add_library(Brotli::brotlicommon STATIC IMPORTED) - set_target_properties(Brotli::brotlicommon - PROPERTIES IMPORTED_LOCATION "${BROTLI_STATIC_LIBRARY_COMMON}" - INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") + set_target_properties( + Brotli::brotlicommon PROPERTIES IMPORTED_LOCATION "${BROTLI_STATIC_LIBRARY_COMMON}" + INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") add_dependencies(Brotli::brotlicommon brotli_ep) add_library(Brotli::brotlienc STATIC IMPORTED) - set_target_properties(Brotli::brotlienc - PROPERTIES IMPORTED_LOCATION "${BROTLI_STATIC_LIBRARY_ENC}" - INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") + set_target_properties( + Brotli::brotlienc PROPERTIES IMPORTED_LOCATION "${BROTLI_STATIC_LIBRARY_ENC}" + INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") add_dependencies(Brotli::brotlienc brotli_ep) add_library(Brotli::brotlidec STATIC IMPORTED) - set_target_properties(Brotli::brotlidec - PROPERTIES IMPORTED_LOCATION "${BROTLI_STATIC_LIBRARY_DEC}" - INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") + set_target_properties( + Brotli::brotlidec PROPERTIES IMPORTED_LOCATION "${BROTLI_STATIC_LIBRARY_DEC}" + INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") add_dependencies(Brotli::brotlidec brotli_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS Brotli::brotlicommon Brotli::brotlienc - Brotli::brotlidec) + Brotli::brotlidec) endmacro() if(ARROW_WITH_BROTLI) @@ -1036,15 +1033,17 @@ if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) 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) + 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) + 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() @@ -1052,7 +1051,9 @@ if(BREW_BIN AND NOT OPENSSL_ROOT_DIR) endif() set(ARROW_USE_OPENSSL OFF) -if(PARQUET_REQUIRE_ENCRYPTION OR ARROW_FLIGHT OR ARROW_S3) +if(PARQUET_REQUIRE_ENCRYPTION + OR ARROW_FLIGHT + OR ARROW_S3) # OpenSSL is required if(ARROW_OPENSSL_USE_SHARED) # Find shared OpenSSL libraries. @@ -1085,7 +1086,7 @@ else() message( STATUS "Building without OpenSSL support. Minimum OpenSSL version ${ARROW_OPENSSL_REQUIRED_VERSION} required." - ) + ) endif() # ---------------------------------------------------------------------- @@ -1100,10 +1101,9 @@ macro(build_glog) else() set(GLOG_LIB_SUFFIX "") endif() - set( - GLOG_STATIC_LIB - "${GLOG_BUILD_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}glog${GLOG_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(GLOG_STATIC_LIB + "${GLOG_BUILD_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}glog${GLOG_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) set(GLOG_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") set(GLOG_CMAKE_C_FLAGS "${EP_C_FLAGS} -fPIC") if(Threads::Threads) @@ -1125,19 +1125,20 @@ macro(build_glog) -DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${GLOG_CMAKE_CXX_FLAGS} -DCMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}=${GLOG_CMAKE_C_FLAGS} -DCMAKE_CXX_FLAGS=${GLOG_CMAKE_CXX_FLAGS}) - externalproject_add(glog_ep - URL ${GLOG_SOURCE_URL} - BUILD_IN_SOURCE 1 - BUILD_BYPRODUCTS "${GLOG_STATIC_LIB}" - CMAKE_ARGS ${GLOG_CMAKE_ARGS} ${EP_LOG_OPTIONS}) + externalproject_add( + glog_ep + URL ${GLOG_SOURCE_URL} + BUILD_IN_SOURCE 1 + BUILD_BYPRODUCTS "${GLOG_STATIC_LIB}" + CMAKE_ARGS ${GLOG_CMAKE_ARGS} ${EP_LOG_OPTIONS}) add_dependencies(toolchain glog_ep) file(MAKE_DIRECTORY "${GLOG_INCLUDE_DIR}") add_library(glog::glog STATIC IMPORTED) - set_target_properties(glog::glog - PROPERTIES IMPORTED_LOCATION "${GLOG_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIR}") + set_target_properties( + glog::glog PROPERTIES IMPORTED_LOCATION "${GLOG_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIR}") add_dependencies(glog::glog glog_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS glog::glog) @@ -1190,22 +1191,23 @@ macro(build_gflags) -DINSTALL_HEADERS=ON) file(MAKE_DIRECTORY "${GFLAGS_INCLUDE_DIR}") - externalproject_add(gflags_ep - URL ${GFLAGS_SOURCE_URL} ${EP_LOG_OPTIONS} - BUILD_IN_SOURCE 1 - BUILD_BYPRODUCTS "${GFLAGS_STATIC_LIB}" - CMAKE_ARGS ${GFLAGS_CMAKE_ARGS}) + externalproject_add( + gflags_ep + URL ${GFLAGS_SOURCE_URL} ${EP_LOG_OPTIONS} + BUILD_IN_SOURCE 1 + BUILD_BYPRODUCTS "${GFLAGS_STATIC_LIB}" + CMAKE_ARGS ${GFLAGS_CMAKE_ARGS}) add_dependencies(toolchain gflags_ep) add_thirdparty_lib(gflags STATIC_LIB ${GFLAGS_STATIC_LIB}) set(GFLAGS_LIBRARY gflags_static) - set_target_properties(${GFLAGS_LIBRARY} - PROPERTIES INTERFACE_COMPILE_DEFINITIONS "GFLAGS_IS_A_DLL=0" - INTERFACE_INCLUDE_DIRECTORIES "${GFLAGS_INCLUDE_DIR}") + set_target_properties( + ${GFLAGS_LIBRARY} PROPERTIES INTERFACE_COMPILE_DEFINITIONS "GFLAGS_IS_A_DLL=0" + INTERFACE_INCLUDE_DIRECTORIES "${GFLAGS_INCLUDE_DIR}") if(MSVC) - set_target_properties(${GFLAGS_LIBRARY} - PROPERTIES INTERFACE_LINK_LIBRARIES "shlwapi.lib") + set_target_properties(${GFLAGS_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES + "shlwapi.lib") endif() set(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY}) @@ -1216,10 +1218,7 @@ endmacro() if(ARROW_NEED_GFLAGS) set(ARROW_GFLAGS_REQUIRED_VERSION "2.1.0") - resolve_dependency(gflags - HAVE_ALT - TRUE - REQUIRED_VERSION + resolve_dependency(gflags HAVE_ALT TRUE REQUIRED_VERSION ${ARROW_GFLAGS_REQUIRED_VERSION}) # TODO: Don't use global includes but rather target_include_directories include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) @@ -1290,19 +1289,20 @@ macro(build_thrift) set(THRIFT_DEPENDENCIES ${THRIFT_DEPENDENCIES} boost_ep) endif() - externalproject_add(thrift_ep - URL ${THRIFT_SOURCE_URL} - URL_HASH "MD5=${ARROW_THRIFT_BUILD_MD5_CHECKSUM}" - BUILD_BYPRODUCTS "${THRIFT_STATIC_LIB}" - CMAKE_ARGS ${THRIFT_CMAKE_ARGS} - DEPENDS ${THRIFT_DEPENDENCIES} ${EP_LOG_OPTIONS}) + externalproject_add( + thrift_ep + URL ${THRIFT_SOURCE_URL} + URL_HASH "MD5=${ARROW_THRIFT_BUILD_MD5_CHECKSUM}" + BUILD_BYPRODUCTS "${THRIFT_STATIC_LIB}" + CMAKE_ARGS ${THRIFT_CMAKE_ARGS} + DEPENDS ${THRIFT_DEPENDENCIES} ${EP_LOG_OPTIONS}) add_library(thrift::thrift STATIC IMPORTED) # The include directory must exist before it is referenced by a target. file(MAKE_DIRECTORY "${THRIFT_INCLUDE_DIR}") - set_target_properties(thrift::thrift - PROPERTIES IMPORTED_LOCATION "${THRIFT_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${THRIFT_INCLUDE_DIR}") + set_target_properties( + thrift::thrift PROPERTIES IMPORTED_LOCATION "${THRIFT_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${THRIFT_INCLUDE_DIR}") add_dependencies(toolchain thrift_ep) add_dependencies(thrift::thrift thrift_ep) set(THRIFT_VERSION ${ARROW_THRIFT_BUILD_VERSION}) @@ -1328,14 +1328,12 @@ macro(build_protobuf) message("Building Protocol Buffers from source") set(PROTOBUF_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/protobuf_ep-install") set(PROTOBUF_INCLUDE_DIR "${PROTOBUF_PREFIX}/include") - set( - PROTOBUF_STATIC_LIB - "${PROTOBUF_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - set( - PROTOC_STATIC_LIB - "${PROTOBUF_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(PROTOBUF_STATIC_LIB + "${PROTOBUF_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(PROTOC_STATIC_LIB + "${PROTOBUF_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) set(Protobuf_PROTOC_LIBRARY "${PROTOC_STATIC_LIB}") set(PROTOBUF_COMPILER "${PROTOBUF_PREFIX}/bin/protoc") @@ -1355,32 +1353,26 @@ macro(build_protobuf) list(APPEND PROTOBUF_BUILD_COMMAND "SDKROOT=${CMAKE_OSX_SYSROOT}") endif() set(PROTOBUF_EXTERNAL_PROJECT_ADD_ARGS - CONFIGURE_COMMAND - "./configure" - ${PROTOBUF_CONFIGURE_ARGS} - BUILD_COMMAND + CONFIGURE_COMMAND "./configure" ${PROTOBUF_CONFIGURE_ARGS} BUILD_COMMAND ${PROTOBUF_BUILD_COMMAND}) else() set(PROTOBUF_CMAKE_ARGS - ${EP_COMMON_CMAKE_ARGS} - -DBUILD_SHARED_LIBS=OFF - -DCMAKE_INSTALL_LIBDIR=lib - "-DCMAKE_INSTALL_PREFIX=${PROTOBUF_PREFIX}" - -Dprotobuf_BUILD_TESTS=OFF + ${EP_COMMON_CMAKE_ARGS} -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_LIBDIR=lib + "-DCMAKE_INSTALL_PREFIX=${PROTOBUF_PREFIX}" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_DEBUG_POSTFIX=) if(ZLIB_ROOT) list(APPEND PROTOBUF_CMAKE_ARGS "-DZLIB_ROOT=${ZLIB_ROOT}") endif() - set(PROTOBUF_EXTERNAL_PROJECT_ADD_ARGS CMAKE_ARGS ${PROTOBUF_CMAKE_ARGS} SOURCE_SUBDIR - "cmake") + set(PROTOBUF_EXTERNAL_PROJECT_ADD_ARGS CMAKE_ARGS ${PROTOBUF_CMAKE_ARGS} + SOURCE_SUBDIR "cmake") endif() - externalproject_add(protobuf_ep - ${PROTOBUF_EXTERNAL_PROJECT_ADD_ARGS} - BUILD_BYPRODUCTS "${PROTOBUF_STATIC_LIB}" "${PROTOBUF_COMPILER}" - ${EP_LOG_OPTIONS} - BUILD_IN_SOURCE 1 - URL ${PROTOBUF_SOURCE_URL}) + externalproject_add( + protobuf_ep + ${PROTOBUF_EXTERNAL_PROJECT_ADD_ARGS} + BUILD_BYPRODUCTS "${PROTOBUF_STATIC_LIB}" "${PROTOBUF_COMPILER}" ${EP_LOG_OPTIONS} + BUILD_IN_SOURCE 1 + URL ${PROTOBUF_SOURCE_URL}) file(MAKE_DIRECTORY "${PROTOBUF_INCLUDE_DIR}") @@ -1388,15 +1380,15 @@ macro(build_protobuf) set_target_properties( arrow::protobuf::libprotobuf PROPERTIES IMPORTED_LOCATION "${PROTOBUF_STATIC_LIB}" INTERFACE_INCLUDE_DIRECTORIES - "${PROTOBUF_INCLUDE_DIR}") + "${PROTOBUF_INCLUDE_DIR}") add_library(arrow::protobuf::libprotoc STATIC IMPORTED) set_target_properties( arrow::protobuf::libprotoc PROPERTIES IMPORTED_LOCATION "${PROTOC_STATIC_LIB}" INTERFACE_INCLUDE_DIRECTORIES - "${PROTOBUF_INCLUDE_DIR}") + "${PROTOBUF_INCLUDE_DIR}") add_executable(arrow::protobuf::protoc IMPORTED) - set_target_properties(arrow::protobuf::protoc - PROPERTIES IMPORTED_LOCATION "${PROTOBUF_COMPILER}") + set_target_properties(arrow::protobuf::protoc PROPERTIES IMPORTED_LOCATION + "${PROTOBUF_COMPILER}") add_dependencies(toolchain protobuf_ep) add_dependencies(arrow::protobuf::libprotobuf protobuf_ep) @@ -1430,10 +1422,10 @@ if(ARROW_WITH_PROTOBUF) # CMake 3.8 or older don't define the targets if(NOT TARGET protobuf::libprotobuf) add_library(protobuf::libprotobuf UNKNOWN IMPORTED) - set_target_properties(protobuf::libprotobuf - PROPERTIES IMPORTED_LOCATION "${PROTOBUF_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES - "${PROTOBUF_INCLUDE_DIR}") + set_target_properties( + protobuf::libprotobuf + PROPERTIES IMPORTED_LOCATION "${PROTOBUF_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES + "${PROTOBUF_INCLUDE_DIR}") endif() set(ARROW_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) endif() @@ -1450,10 +1442,10 @@ if(ARROW_WITH_PROTOBUF) message(FATAL_ERROR "libprotoc was set to ${Protobuf_PROTOC_LIBRARY}") endif() add_library(protobuf::libprotoc UNKNOWN IMPORTED) - set_target_properties(protobuf::libprotoc - PROPERTIES IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES - "${PROTOBUF_INCLUDE_DIR}") + set_target_properties( + protobuf::libprotoc + PROPERTIES IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${PROTOBUF_INCLUDE_DIR}") endif() set(ARROW_PROTOBUF_LIBPROTOC protobuf::libprotoc) endif() @@ -1462,8 +1454,8 @@ if(ARROW_WITH_PROTOBUF) else() if(NOT TARGET protobuf::protoc) add_executable(protobuf::protoc IMPORTED) - set_target_properties(protobuf::protoc - PROPERTIES IMPORTED_LOCATION "${PROTOBUF_PROTOC_EXECUTABLE}") + set_target_properties(protobuf::protoc PROPERTIES IMPORTED_LOCATION + "${PROTOBUF_PROTOC_EXECUTABLE}") endif() set(ARROW_PROTOBUF_PROTOC protobuf::protoc) endif() @@ -1500,16 +1492,20 @@ if(ARROW_JEMALLOC) if(CMAKE_OSX_SYSROOT) list(APPEND JEMALLOC_CONFIGURE_COMMAND "SDKROOT=${CMAKE_OSX_SYSROOT}") endif() - list(APPEND JEMALLOC_CONFIGURE_COMMAND - "--prefix=${JEMALLOC_PREFIX}" - "--with-jemalloc-prefix=je_arrow_" - "--with-private-namespace=je_arrow_private_" - "--without-export" - "--disable-shared" - # Don't override operator new() - "--disable-cxx" "--disable-libdl" - # See https://github.com/jemalloc/jemalloc/issues/1237 - "--disable-initial-exec-tls" ${EP_LOG_OPTIONS}) + list( + APPEND + JEMALLOC_CONFIGURE_COMMAND + "--prefix=${JEMALLOC_PREFIX}" + "--with-jemalloc-prefix=je_arrow_" + "--with-private-namespace=je_arrow_private_" + "--without-export" + "--disable-shared" + # Don't override operator new() + "--disable-cxx" + "--disable-libdl" + # See https://github.com/jemalloc/jemalloc/issues/1237 + "--disable-initial-exec-tls" + ${EP_LOG_OPTIONS}) set(JEMALLOC_BUILD_COMMAND ${MAKE} ${MAKE_BUILD_ARGS}) if(CMAKE_OSX_SYSROOT) list(APPEND JEMALLOC_BUILD_COMMAND "SDKROOT=${CMAKE_OSX_SYSROOT}") @@ -1532,13 +1528,12 @@ if(ARROW_JEMALLOC) # The include directory must exist before it is referenced by a target. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src/") add_library(jemalloc::jemalloc STATIC IMPORTED) - set_target_properties(jemalloc::jemalloc - PROPERTIES INTERFACE_LINK_LIBRARIES - Threads::Threads - IMPORTED_LOCATION - "${JEMALLOC_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES - "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src") + set_target_properties( + jemalloc::jemalloc + PROPERTIES INTERFACE_LINK_LIBRARIES Threads::Threads + IMPORTED_LOCATION "${JEMALLOC_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES + "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src") add_dependencies(jemalloc::jemalloc jemalloc_ep) list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) @@ -1561,10 +1556,9 @@ if(ARROW_MIMALLOC) set(MIMALLOC_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/mimalloc_ep/src/mimalloc_ep") set(MIMALLOC_INCLUDE_DIR "${MIMALLOC_PREFIX}/lib/mimalloc-1.6/include") - set( - MIMALLOC_STATIC_LIB - "${MIMALLOC_PREFIX}/lib/mimalloc-1.6/${CMAKE_STATIC_LIBRARY_PREFIX}${MIMALLOC_LIB_BASE_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(MIMALLOC_STATIC_LIB + "${MIMALLOC_PREFIX}/lib/mimalloc-1.6/${CMAKE_STATIC_LIBRARY_PREFIX}${MIMALLOC_LIB_BASE_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) set(MIMALLOC_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} @@ -1575,22 +1569,21 @@ if(ARROW_MIMALLOC) -DMI_BUILD_SHARED=OFF -DMI_BUILD_TESTS=OFF) - externalproject_add(mimalloc_ep - URL ${MIMALLOC_SOURCE_URL} - CMAKE_ARGS ${MIMALLOC_CMAKE_ARGS} - BUILD_BYPRODUCTS "${MIMALLOC_STATIC_LIB}") + externalproject_add( + mimalloc_ep + URL ${MIMALLOC_SOURCE_URL} + CMAKE_ARGS ${MIMALLOC_CMAKE_ARGS} + BUILD_BYPRODUCTS "${MIMALLOC_STATIC_LIB}") include_directories(SYSTEM ${MIMALLOC_INCLUDE_DIR}) file(MAKE_DIRECTORY ${MIMALLOC_INCLUDE_DIR}) add_library(mimalloc::mimalloc STATIC IMPORTED) - set_target_properties(mimalloc::mimalloc - PROPERTIES INTERFACE_LINK_LIBRARIES - Threads::Threads - IMPORTED_LOCATION - "${MIMALLOC_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES - "${MIMALLOC_INCLUDE_DIR}") + set_target_properties( + mimalloc::mimalloc + PROPERTIES INTERFACE_LINK_LIBRARIES Threads::Threads + IMPORTED_LOCATION "${MIMALLOC_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${MIMALLOC_INCLUDE_DIR}") add_dependencies(mimalloc::mimalloc mimalloc_ep) add_dependencies(toolchain mimalloc_ep) @@ -1640,10 +1633,9 @@ macro(build_gtest) "${_GTEST_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gtest${_GTEST_LIBRARY_SUFFIX}") set(GMOCK_SHARED_LIB "${_GTEST_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gmock${_GTEST_LIBRARY_SUFFIX}") - set( - GTEST_MAIN_SHARED_LIB - "${_GTEST_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gtest_main${_GTEST_LIBRARY_SUFFIX}" - ) + set(GTEST_MAIN_SHARED_LIB + "${_GTEST_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gtest_main${_GTEST_LIBRARY_SUFFIX}" + ) set(GTEST_CMAKE_ARGS ${EP_COMMON_TOOLCHAIN} -DBUILD_SHARED_LIBS=ON @@ -1662,11 +1654,11 @@ macro(build_gtest) set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} -Dgtest_force_shared_crt=ON) endif() - externalproject_add(googletest_ep - URL ${GTEST_SOURCE_URL} - BUILD_BYPRODUCTS ${GTEST_SHARED_LIB} ${GTEST_MAIN_SHARED_LIB} - ${GMOCK_SHARED_LIB} - CMAKE_ARGS ${GTEST_CMAKE_ARGS} ${EP_LOG_OPTIONS}) + externalproject_add( + googletest_ep + URL ${GTEST_SOURCE_URL} + BUILD_BYPRODUCTS ${GTEST_SHARED_LIB} ${GTEST_MAIN_SHARED_LIB} ${GMOCK_SHARED_LIB} + CMAKE_ARGS ${GTEST_CMAKE_ARGS} ${EP_LOG_OPTIONS}) if(WIN32) # Copy the built shared libraries to the same directory as our # test programs because Windows doesn't provided rpath (run-time @@ -1677,16 +1669,15 @@ macro(build_gtest) set(_GTEST_RUNTIME_DIR "${GTEST_PREFIX}/bin") set(_GTEST_RUNTIME_SUFFIX "${CMAKE_GTEST_DEBUG_EXTENSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") - set( - _GTEST_RUNTIME_LIB - "${_GTEST_RUNTIME_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gtest${_GTEST_RUNTIME_SUFFIX}") - set( - _GMOCK_RUNTIME_LIB - "${_GTEST_RUNTIME_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gmock${_GTEST_RUNTIME_SUFFIX}") - set( - _GTEST_MAIN_RUNTIME_LIB - "${_GTEST_RUNTIME_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gtest_main${_GTEST_RUNTIME_SUFFIX}" - ) + set(_GTEST_RUNTIME_LIB + "${_GTEST_RUNTIME_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gtest${_GTEST_RUNTIME_SUFFIX}" + ) + set(_GMOCK_RUNTIME_LIB + "${_GTEST_RUNTIME_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gmock${_GTEST_RUNTIME_SUFFIX}" + ) + set(_GTEST_MAIN_RUNTIME_LIB + "${_GTEST_RUNTIME_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}gtest_main${_GTEST_RUNTIME_SUFFIX}" + ) if(CMAKE_VERSION VERSION_LESS 3.9) message( FATAL_ERROR @@ -1698,44 +1689,33 @@ macro(build_gtest) else() set(_GTEST_RUNTIME_OUTPUT_DIR ${BUILD_OUTPUT_ROOT_DIRECTORY}) endif() - externalproject_add_step(googletest_ep copy - COMMAND ${CMAKE_COMMAND} -E make_directory - ${_GTEST_RUNTIME_OUTPUT_DIR} - COMMAND ${CMAKE_COMMAND} - -E - copy - ${_GTEST_RUNTIME_LIB} - ${_GTEST_RUNTIME_OUTPUT_DIR} - COMMAND ${CMAKE_COMMAND} - -E - copy - ${_GMOCK_RUNTIME_LIB} - ${_GTEST_RUNTIME_OUTPUT_DIR} - COMMAND ${CMAKE_COMMAND} - -E - copy - ${_GTEST_MAIN_RUNTIME_LIB} - ${_GTEST_RUNTIME_OUTPUT_DIR} - DEPENDEES install) + externalproject_add_step( + googletest_ep copy + COMMAND ${CMAKE_COMMAND} -E make_directory ${_GTEST_RUNTIME_OUTPUT_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${_GTEST_RUNTIME_LIB} ${_GTEST_RUNTIME_OUTPUT_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${_GMOCK_RUNTIME_LIB} ${_GTEST_RUNTIME_OUTPUT_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${_GTEST_MAIN_RUNTIME_LIB} + ${_GTEST_RUNTIME_OUTPUT_DIR} + DEPENDEES install) endif() # The include directory must exist before it is referenced by a target. file(MAKE_DIRECTORY "${GTEST_INCLUDE_DIR}") add_library(GTest::gtest SHARED IMPORTED) - set_target_properties(GTest::gtest - PROPERTIES ${_GTEST_IMPORTED_TYPE} "${GTEST_SHARED_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIR}") + set_target_properties( + GTest::gtest PROPERTIES ${_GTEST_IMPORTED_TYPE} "${GTEST_SHARED_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIR}") add_library(GTest::gtest_main SHARED IMPORTED) - set_target_properties(GTest::gtest_main - PROPERTIES ${_GTEST_IMPORTED_TYPE} "${GTEST_MAIN_SHARED_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIR}") + set_target_properties( + GTest::gtest_main PROPERTIES ${_GTEST_IMPORTED_TYPE} "${GTEST_MAIN_SHARED_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIR}") add_library(GTest::gmock SHARED IMPORTED) - set_target_properties(GTest::gmock - PROPERTIES ${_GTEST_IMPORTED_TYPE} "${GMOCK_SHARED_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIR}") + set_target_properties( + GTest::gmock PROPERTIES ${_GTEST_IMPORTED_TYPE} "${GMOCK_SHARED_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIR}") add_dependencies(toolchain-tests googletest_ep) add_dependencies(GTest::gtest googletest_ep) add_dependencies(GTest::gtest_main googletest_ep) @@ -1743,11 +1723,7 @@ macro(build_gtest) endmacro() if(ARROW_TESTING) - resolve_dependency(GTest - REQUIRED_VERSION - 1.10.0 - USE_CONFIG - TRUE) + resolve_dependency(GTest REQUIRED_VERSION 1.10.0 USE_CONFIG TRUE) if(NOT GTEST_VENDORED) # TODO(wesm): This logic does not work correctly with the MSVC static libraries @@ -1793,55 +1769,48 @@ macro(build_benchmark) set(GBENCHMARK_CMAKE_CXX_FLAGS "${EP_CXX_FLAGS} -std=c++11") endif() - if(APPLE - AND (CMAKE_CXX_COMPILER_ID - STREQUAL - "AppleClang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) + if(APPLE AND (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID + STREQUAL "Clang")) set(GBENCHMARK_CMAKE_CXX_FLAGS "${GBENCHMARK_CMAKE_CXX_FLAGS} -stdlib=libc++") endif() set(GBENCHMARK_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gbenchmark_ep/src/gbenchmark_ep-install") set(GBENCHMARK_INCLUDE_DIR "${GBENCHMARK_PREFIX}/include") - set( - GBENCHMARK_STATIC_LIB - "${GBENCHMARK_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - set( - GBENCHMARK_MAIN_STATIC_LIB - "${GBENCHMARK_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}benchmark_main${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(GBENCHMARK_STATIC_LIB + "${GBENCHMARK_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(GBENCHMARK_MAIN_STATIC_LIB + "${GBENCHMARK_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}benchmark_main${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) set(GBENCHMARK_CMAKE_ARGS - ${EP_COMMON_CMAKE_ARGS} - "-DCMAKE_INSTALL_PREFIX=${GBENCHMARK_PREFIX}" - -DCMAKE_INSTALL_LIBDIR=lib - -DBENCHMARK_ENABLE_TESTING=OFF + ${EP_COMMON_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${GBENCHMARK_PREFIX}" + -DCMAKE_INSTALL_LIBDIR=lib -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_CXX_FLAGS=${GBENCHMARK_CMAKE_CXX_FLAGS}) if(APPLE) set(GBENCHMARK_CMAKE_ARGS ${GBENCHMARK_CMAKE_ARGS} "-DBENCHMARK_USE_LIBCXX=ON") endif() - externalproject_add(gbenchmark_ep - URL ${GBENCHMARK_SOURCE_URL} - BUILD_BYPRODUCTS "${GBENCHMARK_STATIC_LIB}" - "${GBENCHMARK_MAIN_STATIC_LIB}" - CMAKE_ARGS ${GBENCHMARK_CMAKE_ARGS} ${EP_LOG_OPTIONS}) + externalproject_add( + gbenchmark_ep + URL ${GBENCHMARK_SOURCE_URL} + BUILD_BYPRODUCTS "${GBENCHMARK_STATIC_LIB}" "${GBENCHMARK_MAIN_STATIC_LIB}" + CMAKE_ARGS ${GBENCHMARK_CMAKE_ARGS} ${EP_LOG_OPTIONS}) # The include directory must exist before it is referenced by a target. file(MAKE_DIRECTORY "${GBENCHMARK_INCLUDE_DIR}") add_library(benchmark::benchmark STATIC IMPORTED) - set_target_properties(benchmark::benchmark - PROPERTIES IMPORTED_LOCATION "${GBENCHMARK_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES - "${GBENCHMARK_INCLUDE_DIR}") + set_target_properties( + benchmark::benchmark + PROPERTIES IMPORTED_LOCATION "${GBENCHMARK_STATIC_LIB}" INTERFACE_INCLUDE_DIRECTORIES + "${GBENCHMARK_INCLUDE_DIR}") add_library(benchmark::benchmark_main STATIC IMPORTED) - set_target_properties(benchmark::benchmark_main - PROPERTIES IMPORTED_LOCATION "${GBENCHMARK_MAIN_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES - "${GBENCHMARK_INCLUDE_DIR}") + set_target_properties( + benchmark::benchmark_main + PROPERTIES IMPORTED_LOCATION "${GBENCHMARK_MAIN_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${GBENCHMARK_INCLUDE_DIR}") add_dependencies(toolchain-benchmarks gbenchmark_ep) add_dependencies(benchmark::benchmark gbenchmark_ep) @@ -1851,8 +1820,8 @@ endmacro() if(ARROW_BUILD_BENCHMARKS) # ArgsProduct() is available since 1.5.2 set(BENCHMARK_REQUIRED_VERSION 1.5.2) - if("${ARROW_DEPENDENCY_SOURCE}" STREQUAL "CONDA" - AND "${benchmark_SOURCE}" STREQUAL "SYSTEM") + if("${ARROW_DEPENDENCY_SOURCE}" STREQUAL "CONDA" AND "${benchmark_SOURCE}" STREQUAL + "SYSTEM") # TODO: Remove this workaround once # https://github.com/google/benchmark/issues/1046 is resolved. # @@ -1875,17 +1844,15 @@ macro(build_rapidjson) set(RAPIDJSON_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/rapidjson_ep/src/rapidjson_ep-install") set(RAPIDJSON_CMAKE_ARGS - ${EP_COMMON_CMAKE_ARGS} - -DRAPIDJSON_BUILD_DOC=OFF - -DRAPIDJSON_BUILD_EXAMPLES=OFF - -DRAPIDJSON_BUILD_TESTS=OFF - "-DCMAKE_INSTALL_PREFIX=${RAPIDJSON_PREFIX}") + ${EP_COMMON_CMAKE_ARGS} -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF + -DRAPIDJSON_BUILD_TESTS=OFF "-DCMAKE_INSTALL_PREFIX=${RAPIDJSON_PREFIX}") - externalproject_add(rapidjson_ep - ${EP_LOG_OPTIONS} - PREFIX "${CMAKE_BINARY_DIR}" - URL ${RAPIDJSON_SOURCE_URL} - CMAKE_ARGS ${RAPIDJSON_CMAKE_ARGS}) + externalproject_add( + rapidjson_ep + ${EP_LOG_OPTIONS} + PREFIX "${CMAKE_BINARY_DIR}" + URL ${RAPIDJSON_SOURCE_URL} + CMAKE_ARGS ${RAPIDJSON_CMAKE_ARGS}) set(RAPIDJSON_INCLUDE_DIR "${RAPIDJSON_PREFIX}/include") @@ -1898,10 +1865,7 @@ endmacro() if(ARROW_WITH_RAPIDJSON) set(ARROW_RAPIDJSON_REQUIRED_VERSION "1.1.0") - resolve_dependency(RapidJSON - HAVE_ALT - TRUE - REQUIRED_VERSION + resolve_dependency(RapidJSON HAVE_ALT TRUE REQUIRED_VERSION ${ARROW_RAPIDJSON_REQUIRED_VERSION}) if(RapidJSON_INCLUDE_DIR) @@ -1928,19 +1892,20 @@ macro(build_zlib) set(ZLIB_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${ZLIB_PREFIX}" -DBUILD_SHARED_LIBS=OFF) - externalproject_add(zlib_ep - URL ${ZLIB_SOURCE_URL} ${EP_LOG_OPTIONS} - BUILD_BYPRODUCTS "${ZLIB_STATIC_LIB}" - CMAKE_ARGS ${ZLIB_CMAKE_ARGS}) + externalproject_add( + zlib_ep + URL ${ZLIB_SOURCE_URL} ${EP_LOG_OPTIONS} + BUILD_BYPRODUCTS "${ZLIB_STATIC_LIB}" + CMAKE_ARGS ${ZLIB_CMAKE_ARGS}) file(MAKE_DIRECTORY "${ZLIB_PREFIX}/include") add_library(ZLIB::ZLIB STATIC IMPORTED) set(ZLIB_LIBRARIES ${ZLIB_STATIC_LIB}) set(ZLIB_INCLUDE_DIRS "${ZLIB_PREFIX}/include") - set_target_properties(ZLIB::ZLIB - PROPERTIES IMPORTED_LOCATION ${ZLIB_LIBRARIES} - INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRS}) + set_target_properties( + ZLIB::ZLIB PROPERTIES IMPORTED_LOCATION ${ZLIB_LIBRARIES} + INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRS}) add_dependencies(toolchain zlib_ep) add_dependencies(ZLIB::ZLIB zlib_ep) @@ -1972,40 +1937,32 @@ macro(build_lz4) set(LZ4_STATIC_LIB "${LZ4_BUILD_DIR}/visual/VS2010/bin/x64_${CMAKE_BUILD_TYPE}/liblz4_static.lib") set(LZ4_BUILD_COMMAND - BUILD_COMMAND - msbuild.exe - /m - /p:Configuration=${CMAKE_BUILD_TYPE} - /p:Platform=x64 - /p:PlatformToolset=v140 - ${LZ4_RUNTIME_LIBRARY_LINKAGE} - /t:Build + BUILD_COMMAND msbuild.exe /m /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=x64 + /p:PlatformToolset=v140 ${LZ4_RUNTIME_LIBRARY_LINKAGE} /t:Build ${LZ4_BUILD_DIR}/visual/VS2010/lz4.sln) else() set(LZ4_STATIC_LIB "${LZ4_BUILD_DIR}/lib/liblz4.a") - set(LZ4_BUILD_COMMAND BUILD_COMMAND ${CMAKE_SOURCE_DIR}/build-support/build-lz4-lib.sh - "AR=${CMAKE_AR}" "OS=${CMAKE_SYSTEM_NAME}") + set(LZ4_BUILD_COMMAND + BUILD_COMMAND ${CMAKE_SOURCE_DIR}/build-support/build-lz4-lib.sh "AR=${CMAKE_AR}" + "OS=${CMAKE_SYSTEM_NAME}") endif() # We need to copy the header in lib to directory outside of the build - externalproject_add(lz4_ep - URL ${LZ4_SOURCE_URL} ${EP_LOG_OPTIONS} - UPDATE_COMMAND ${CMAKE_COMMAND} - -E - copy_directory - "${LZ4_BUILD_DIR}/lib" - "${LZ4_PREFIX}/include" - ${LZ4_PATCH_COMMAND} - CONFIGURE_COMMAND "" - INSTALL_COMMAND "" - BINARY_DIR ${LZ4_BUILD_DIR} - BUILD_BYPRODUCTS ${LZ4_STATIC_LIB} ${LZ4_BUILD_COMMAND}) + externalproject_add( + lz4_ep + URL ${LZ4_SOURCE_URL} ${EP_LOG_OPTIONS} + UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_directory "${LZ4_BUILD_DIR}/lib" + "${LZ4_PREFIX}/include" ${LZ4_PATCH_COMMAND} + CONFIGURE_COMMAND "" + INSTALL_COMMAND "" + BINARY_DIR ${LZ4_BUILD_DIR} + BUILD_BYPRODUCTS ${LZ4_STATIC_LIB} ${LZ4_BUILD_COMMAND}) file(MAKE_DIRECTORY "${LZ4_PREFIX}/include") add_library(LZ4::lz4 STATIC IMPORTED) - set_target_properties(LZ4::lz4 - PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") + set_target_properties( + LZ4::lz4 PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") add_dependencies(toolchain lz4_ep) add_dependencies(LZ4::lz4 lz4_ep) @@ -2044,10 +2001,8 @@ macro(build_zstd) # Only pass our C flags on Unix as on MSVC it leads to a # "incompatible command-line options" error set(ZSTD_CMAKE_ARGS - ${ZSTD_CMAKE_ARGS} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_FLAGS=${EP_C_FLAGS} + ${ZSTD_CMAKE_ARGS} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_FLAGS=${EP_C_FLAGS} -DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}) endif() @@ -2055,20 +2010,21 @@ macro(build_zstd) message(FATAL_ERROR "Building zstd using ExternalProject requires at least CMake 3.7") endif() - externalproject_add(zstd_ep - ${EP_LOG_OPTIONS} - CMAKE_ARGS ${ZSTD_CMAKE_ARGS} - SOURCE_SUBDIR "build/cmake" - INSTALL_DIR ${ZSTD_PREFIX} - URL ${ZSTD_SOURCE_URL} - BUILD_BYPRODUCTS "${ZSTD_STATIC_LIB}") + externalproject_add( + zstd_ep + ${EP_LOG_OPTIONS} + CMAKE_ARGS ${ZSTD_CMAKE_ARGS} + SOURCE_SUBDIR "build/cmake" + INSTALL_DIR ${ZSTD_PREFIX} + URL ${ZSTD_SOURCE_URL} + BUILD_BYPRODUCTS "${ZSTD_STATIC_LIB}") file(MAKE_DIRECTORY "${ZSTD_PREFIX}/include") add_library(zstd::libzstd STATIC IMPORTED) - set_target_properties(zstd::libzstd - PROPERTIES IMPORTED_LOCATION "${ZSTD_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${ZSTD_PREFIX}/include") + set_target_properties( + zstd::libzstd PROPERTIES IMPORTED_LOCATION "${ZSTD_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${ZSTD_PREFIX}/include") add_dependencies(toolchain zstd_ep) add_dependencies(zstd::libzstd zstd_ep) @@ -2112,18 +2068,19 @@ macro(build_re2) set(RE2_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${RE2_PREFIX}") - externalproject_add(re2_ep - ${EP_LOG_OPTIONS} - INSTALL_DIR ${RE2_PREFIX} - URL ${RE2_SOURCE_URL} - CMAKE_ARGS ${RE2_CMAKE_ARGS} - BUILD_BYPRODUCTS "${RE2_STATIC_LIB}") + externalproject_add( + re2_ep + ${EP_LOG_OPTIONS} + INSTALL_DIR ${RE2_PREFIX} + URL ${RE2_SOURCE_URL} + CMAKE_ARGS ${RE2_CMAKE_ARGS} + BUILD_BYPRODUCTS "${RE2_STATIC_LIB}") file(MAKE_DIRECTORY "${RE2_PREFIX}/include") add_library(re2::re2 STATIC IMPORTED) - set_target_properties(re2::re2 - PROPERTIES IMPORTED_LOCATION "${RE2_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${RE2_PREFIX}/include") + set_target_properties( + re2::re2 PROPERTIES IMPORTED_LOCATION "${RE2_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${RE2_PREFIX}/include") add_dependencies(toolchain re2_ep) add_dependencies(re2::re2 re2_ep) @@ -2143,30 +2100,28 @@ endif() macro(build_bzip2) message(STATUS "Building BZip2 from source") set(BZIP2_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/bzip2_ep-install") - set( - BZIP2_STATIC_LIB - "${BZIP2_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}bz2${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(BZIP2_STATIC_LIB + "${BZIP2_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}bz2${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) set(BZIP2_EXTRA_ARGS "CC=${CMAKE_C_COMPILER}" "CFLAGS=${EP_C_FLAGS}") - externalproject_add(bzip2_ep - ${EP_LOG_OPTIONS} - CONFIGURE_COMMAND "" - BUILD_IN_SOURCE 1 - BUILD_COMMAND ${MAKE} libbz2.a ${MAKE_BUILD_ARGS} - ${BZIP2_EXTRA_ARGS} - INSTALL_COMMAND ${MAKE} install PREFIX=${BZIP2_PREFIX} - ${BZIP2_EXTRA_ARGS} - INSTALL_DIR ${BZIP2_PREFIX} - URL ${ARROW_BZIP2_SOURCE_URL} - BUILD_BYPRODUCTS "${BZIP2_STATIC_LIB}") + externalproject_add( + bzip2_ep + ${EP_LOG_OPTIONS} + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND ${MAKE} libbz2.a ${MAKE_BUILD_ARGS} ${BZIP2_EXTRA_ARGS} + INSTALL_COMMAND ${MAKE} install PREFIX=${BZIP2_PREFIX} ${BZIP2_EXTRA_ARGS} + INSTALL_DIR ${BZIP2_PREFIX} + URL ${ARROW_BZIP2_SOURCE_URL} + BUILD_BYPRODUCTS "${BZIP2_STATIC_LIB}") file(MAKE_DIRECTORY "${BZIP2_PREFIX}/include") add_library(BZip2::BZip2 STATIC IMPORTED) set_target_properties( - BZip2::BZip2 - PROPERTIES IMPORTED_LOCATION "${BZIP2_STATIC_LIB}" INTERFACE_INCLUDE_DIRECTORIES - "${BZIP2_PREFIX}/include") + BZip2::BZip2 PROPERTIES IMPORTED_LOCATION "${BZIP2_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_PREFIX}/include") set(BZIP2_INCLUDE_DIR "${BZIP2_PREFIX}/include") add_dependencies(toolchain bzip2_ep) @@ -2180,9 +2135,9 @@ if(ARROW_WITH_BZ2) if(NOT TARGET BZip2::BZip2) add_library(BZip2::BZip2 UNKNOWN IMPORTED) - set_target_properties(BZip2::BZip2 - PROPERTIES IMPORTED_LOCATION "${BZIP2_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") + set_target_properties( + BZip2::BZip2 PROPERTIES IMPORTED_LOCATION "${BZIP2_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") endif() include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}") endif() @@ -2193,35 +2148,31 @@ macro(build_utf8proc) if(MSVC) set(UTF8PROC_STATIC_LIB "${UTF8PROC_PREFIX}/lib/utf8proc_static.lib") else() - set( - UTF8PROC_STATIC_LIB - "${UTF8PROC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}utf8proc${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(UTF8PROC_STATIC_LIB + "${UTF8PROC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}utf8proc${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) endif() set(UTF8PROC_CMAKE_ARGS - ${EP_COMMON_TOOLCHAIN} - "-DCMAKE_INSTALL_PREFIX=${UTF8PROC_PREFIX}" - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_LIBDIR=lib + ${EP_COMMON_TOOLCHAIN} "-DCMAKE_INSTALL_PREFIX=${UTF8PROC_PREFIX}" + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_LIBDIR=lib -DBUILD_SHARED_LIBS=OFF) - externalproject_add(utf8proc_ep - ${EP_LOG_OPTIONS} - CMAKE_ARGS ${UTF8PROC_CMAKE_ARGS} - INSTALL_DIR ${UTF8PROC_PREFIX} - URL ${ARROW_UTF8PROC_SOURCE_URL} - BUILD_BYPRODUCTS "${UTF8PROC_STATIC_LIB}") + externalproject_add( + utf8proc_ep + ${EP_LOG_OPTIONS} + CMAKE_ARGS ${UTF8PROC_CMAKE_ARGS} + INSTALL_DIR ${UTF8PROC_PREFIX} + URL ${ARROW_UTF8PROC_SOURCE_URL} + BUILD_BYPRODUCTS "${UTF8PROC_STATIC_LIB}") file(MAKE_DIRECTORY "${UTF8PROC_PREFIX}/include") add_library(utf8proc::utf8proc STATIC IMPORTED) - set_target_properties(utf8proc::utf8proc - PROPERTIES IMPORTED_LOCATION - "${UTF8PROC_STATIC_LIB}" - INTERFACE_COMPILER_DEFINITIONS - "UTF8PROC_STATIC" - INTERFACE_INCLUDE_DIRECTORIES - "${UTF8PROC_PREFIX}/include") + set_target_properties( + utf8proc::utf8proc + PROPERTIES IMPORTED_LOCATION "${UTF8PROC_STATIC_LIB}" + INTERFACE_COMPILER_DEFINITIONS "UTF8PROC_STATIC" + INTERFACE_INCLUDE_DIRECTORIES "${UTF8PROC_PREFIX}/include") add_dependencies(toolchain utf8proc_ep) add_dependencies(utf8proc::utf8proc utf8proc_ep) @@ -2256,38 +2207,35 @@ macro(build_cares) # If you set -DCARES_SHARED=ON then the build system names the library # libcares_static.a - set( - CARES_STATIC_LIB - "${CARES_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}cares${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(CARES_STATIC_LIB + "${CARES_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}cares${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) set(CARES_CMAKE_ARGS - "${EP_COMMON_CMAKE_ARGS}" - -DCARES_STATIC=ON - -DCARES_SHARED=OFF - -DCMAKE_INSTALL_LIBDIR=lib - "-DCMAKE_INSTALL_PREFIX=${CARES_PREFIX}") + "${EP_COMMON_CMAKE_ARGS}" -DCARES_STATIC=ON -DCARES_SHARED=OFF + -DCMAKE_INSTALL_LIBDIR=lib "-DCMAKE_INSTALL_PREFIX=${CARES_PREFIX}") - externalproject_add(cares_ep - ${EP_LOG_OPTIONS} - URL ${CARES_SOURCE_URL} - CMAKE_ARGS ${CARES_CMAKE_ARGS} - BUILD_BYPRODUCTS "${CARES_STATIC_LIB}") + externalproject_add( + cares_ep + ${EP_LOG_OPTIONS} + URL ${CARES_SOURCE_URL} + CMAKE_ARGS ${CARES_CMAKE_ARGS} + BUILD_BYPRODUCTS "${CARES_STATIC_LIB}") file(MAKE_DIRECTORY ${CARES_INCLUDE_DIR}) add_dependencies(toolchain cares_ep) add_library(c-ares::cares STATIC IMPORTED) - set_target_properties(c-ares::cares - PROPERTIES IMPORTED_LOCATION "${CARES_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${CARES_INCLUDE_DIR}") + set_target_properties( + c-ares::cares PROPERTIES IMPORTED_LOCATION "${CARES_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${CARES_INCLUDE_DIR}") add_dependencies(c-ares::cares cares_ep) if(APPLE) # libresolv must be linked from c-ares version 1.16.1 find_library(LIBRESOLV_LIBRARY NAMES resolv libresolv REQUIRED) - set_target_properties(c-ares::cares - PROPERTIES INTERFACE_LINK_LIBRARIES "${LIBRESOLV_LIBRARY}") + set_target_properties(c-ares::cares PROPERTIES INTERFACE_LINK_LIBRARIES + "${LIBRESOLV_LIBRARY}") endif() set(CARES_VENDORED TRUE) @@ -2323,11 +2271,8 @@ macro(build_grpc) # First need to build Abseil set(ABSL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/absl_ep-install") set(ABSL_CMAKE_ARGS - "${EP_COMMON_CMAKE_ARGS}" - -DABSL_RUN_TESTS=OFF - -DCMAKE_CXX_STANDARD=11 - -DCMAKE_INSTALL_LIBDIR=lib - "-DCMAKE_INSTALL_PREFIX=${ABSL_PREFIX}") + "${EP_COMMON_CMAKE_ARGS}" -DABSL_RUN_TESTS=OFF -DCMAKE_CXX_STANDARD=11 + -DCMAKE_INSTALL_LIBDIR=lib "-DCMAKE_INSTALL_PREFIX=${ABSL_PREFIX}") set(ABSL_BUILD_BYPRODUCTS) set(ABSL_LIBRARIES) @@ -2343,45 +2288,43 @@ macro(build_grpc) time_zone) foreach(_ABSL_LIB ${_ABSL_LIBS}) - set( - _ABSL_STATIC_LIBRARY - "${ABSL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}absl_${_ABSL_LIB}${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(_ABSL_STATIC_LIBRARY + "${ABSL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}absl_${_ABSL_LIB}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) add_library(absl::${_ABSL_LIB} STATIC IMPORTED) - set_target_properties(absl::${_ABSL_LIB} - PROPERTIES IMPORTED_LOCATION ${_ABSL_STATIC_LIBRARY}) + set_target_properties(absl::${_ABSL_LIB} PROPERTIES IMPORTED_LOCATION + ${_ABSL_STATIC_LIBRARY}) list(APPEND ABSL_BUILD_BYPRODUCTS ${_ABSL_STATIC_LIBRARY}) list(APPEND ABSL_LIBRARIES absl::${_ABSL_LIB}) endforeach() - externalproject_add(absl_ep - ${EP_LOG_OPTIONS} - URL ${ABSL_SOURCE_URL} - CMAKE_ARGS ${ABSL_CMAKE_ARGS} - BUILD_BYPRODUCTS ${ABSL_BUILD_BYPRODUCTS}) + externalproject_add( + absl_ep + ${EP_LOG_OPTIONS} + URL ${ABSL_SOURCE_URL} + CMAKE_ARGS ${ABSL_CMAKE_ARGS} + BUILD_BYPRODUCTS ${ABSL_BUILD_BYPRODUCTS}) set(GRPC_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/grpc_ep-prefix/src/grpc_ep-build") set(GRPC_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/grpc_ep-install") set(GRPC_HOME "${GRPC_PREFIX}") set(GRPC_INCLUDE_DIR "${GRPC_PREFIX}/include") - set( - GRPC_STATIC_LIBRARY_GPR - "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gpr${CMAKE_STATIC_LIBRARY_SUFFIX}") - set( - GRPC_STATIC_LIBRARY_GRPC - "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}grpc${CMAKE_STATIC_LIBRARY_SUFFIX}") - set( - GRPC_STATIC_LIBRARY_GRPCPP - "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}grpc++${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - set( - GRPC_STATIC_LIBRARY_ADDRESS_SORTING - "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}address_sorting${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - set( - GRPC_STATIC_LIBRARY_UPB - "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}upb${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(GRPC_STATIC_LIBRARY_GPR + "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gpr${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(GRPC_STATIC_LIBRARY_GRPC + "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}grpc${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(GRPC_STATIC_LIBRARY_GRPCPP + "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}grpc++${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(GRPC_STATIC_LIBRARY_ADDRESS_SORTING + "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}address_sorting${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + set(GRPC_STATIC_LIBRARY_UPB + "${GRPC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}upb${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) set(GRPC_CPP_PLUGIN "${GRPC_PREFIX}/bin/grpc_cpp_plugin") set(GRPC_CMAKE_PREFIX) @@ -2456,55 +2399,51 @@ macro(build_grpc) # XXX the gRPC git checkout is huge and takes a long time # Ideally, we should be able to use the tarballs, but they don't contain # vendored dependencies such as c-ares... - externalproject_add(grpc_ep - URL ${GRPC_SOURCE_URL} - LIST_SEPARATOR | - BUILD_BYPRODUCTS ${GRPC_STATIC_LIBRARY_GPR} - ${GRPC_STATIC_LIBRARY_GRPC} - ${GRPC_STATIC_LIBRARY_GRPCPP} - ${GRPC_STATIC_LIBRARY_ADDRESS_SORTING} - ${GRPC_STATIC_LIBRARY_UPB} - ${GRPC_CPP_PLUGIN} - CMAKE_ARGS ${GRPC_CMAKE_ARGS} ${EP_LOG_OPTIONS} - DEPENDS ${grpc_dependencies}) + externalproject_add( + grpc_ep + URL ${GRPC_SOURCE_URL} + LIST_SEPARATOR | + BUILD_BYPRODUCTS + ${GRPC_STATIC_LIBRARY_GPR} ${GRPC_STATIC_LIBRARY_GRPC} ${GRPC_STATIC_LIBRARY_GRPCPP} + ${GRPC_STATIC_LIBRARY_ADDRESS_SORTING} ${GRPC_STATIC_LIBRARY_UPB} ${GRPC_CPP_PLUGIN} + CMAKE_ARGS ${GRPC_CMAKE_ARGS} ${EP_LOG_OPTIONS} + DEPENDS ${grpc_dependencies}) # Work around https://gitlab.kitware.com/cmake/cmake/issues/15052 file(MAKE_DIRECTORY ${GRPC_INCLUDE_DIR}) add_library(gRPC::upb STATIC IMPORTED) - set_target_properties(gRPC::upb - PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_UPB}" - INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") + set_target_properties( + gRPC::upb PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_UPB}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") add_library(gRPC::gpr STATIC IMPORTED) - set_target_properties(gRPC::gpr - PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_GPR}" - INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") + set_target_properties( + gRPC::gpr PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_GPR}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") add_library(gRPC::grpc STATIC IMPORTED) - set_target_properties(gRPC::grpc - PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_GRPC}" - INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") + set_target_properties( + gRPC::grpc PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_GRPC}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") add_library(gRPC::address_sorting STATIC IMPORTED) - set_target_properties(gRPC::address_sorting - PROPERTIES IMPORTED_LOCATION - "${GRPC_STATIC_LIBRARY_ADDRESS_SORTING}" - INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") + set_target_properties( + gRPC::address_sorting + PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_ADDRESS_SORTING}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") add_library(gRPC::grpc++ STATIC IMPORTED) set_target_properties( gRPC::grpc++ - PROPERTIES IMPORTED_LOCATION - "${GRPC_STATIC_LIBRARY_GRPCPP}" + PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_GRPCPP}" INTERFACE_LINK_LIBRARIES "gRPC::grpc;gRPC::gpr;gRPC::upb;gRPC::address_sorting;${ABSL_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES - "${GRPC_INCLUDE_DIR}") + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}") add_executable(gRPC::grpc_cpp_plugin IMPORTED) - set_target_properties(gRPC::grpc_cpp_plugin - PROPERTIES IMPORTED_LOCATION ${GRPC_CPP_PLUGIN}) + set_target_properties(gRPC::grpc_cpp_plugin PROPERTIES IMPORTED_LOCATION + ${GRPC_CPP_PLUGIN}) add_dependencies(grpc_ep grpc_dependencies) add_dependencies(toolchain grpc_ep) @@ -2516,43 +2455,38 @@ macro(build_grpc) # continuation character in these scripts, so we have to create a copy of the # static lib that we will bundle later - set( - GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR - "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}grpcpp${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - add_custom_command(OUTPUT ${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR} - COMMAND ${CMAKE_COMMAND} - -E - copy - $ - ${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR} - DEPENDS grpc_ep) + set(GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR + "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}grpcpp${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + add_custom_command( + OUTPUT ${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR} + COMMAND ${CMAKE_COMMAND} -E copy $ + ${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR} + DEPENDS grpc_ep) add_library(gRPC::grpcpp_for_bundling STATIC IMPORTED) - set_target_properties(gRPC::grpcpp_for_bundling - PROPERTIES IMPORTED_LOCATION - "${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR}") + set_target_properties( + gRPC::grpcpp_for_bundling PROPERTIES IMPORTED_LOCATION + "${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR}") set_source_files_properties("${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR}" PROPERTIES GENERATED - TRUE) + TRUE) add_custom_target(grpc_copy_grpc++ ALL DEPENDS "${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR}") add_dependencies(gRPC::grpcpp_for_bundling grpc_copy_grpc++) - list(APPEND ARROW_BUNDLED_STATIC_LIBS - ${ABSL_LIBRARIES} - gRPC::upb - gRPC::gpr - gRPC::grpc - gRPC::address_sorting - gRPC::grpcpp_for_bundling) + list( + APPEND + ARROW_BUNDLED_STATIC_LIBS + ${ABSL_LIBRARIES} + gRPC::upb + gRPC::gpr + gRPC::grpc + gRPC::address_sorting + gRPC::grpcpp_for_bundling) endmacro() if(ARROW_WITH_GRPC) set(ARROW_GRPC_REQUIRED_VERSION "1.17.0") - resolve_dependency(gRPC - HAVE_ALT - TRUE - REQUIRED_VERSION - ${ARROW_GRPC_REQUIRED_VERSION}) + resolve_dependency(gRPC HAVE_ALT TRUE REQUIRED_VERSION ${ARROW_GRPC_REQUIRED_VERSION}) if(TARGET gRPC::address_sorting) set(GRPC_HAS_ADDRESS_SORTING TRUE) @@ -2650,10 +2584,11 @@ macro(build_orc) # Work around CMake bug file(MAKE_DIRECTORY ${ORC_INCLUDE_DIR}) - externalproject_add(orc_ep - URL ${ORC_SOURCE_URL} - BUILD_BYPRODUCTS ${ORC_STATIC_LIB} - CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS}) + externalproject_add( + orc_ep + URL ${ORC_SOURCE_URL} + BUILD_BYPRODUCTS ${ORC_STATIC_LIB} + CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS}) add_dependencies(toolchain orc_ep) @@ -2664,9 +2599,9 @@ macro(build_orc) add_dependencies(orc_ep ${ARROW_PROTOBUF_LIBPROTOBUF}) add_library(orc::liborc STATIC IMPORTED) - set_target_properties(orc::liborc - PROPERTIES IMPORTED_LOCATION "${ORC_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${ORC_INCLUDE_DIR}") + set_target_properties( + orc::liborc PROPERTIES IMPORTED_LOCATION "${ORC_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${ORC_INCLUDE_DIR}") add_dependencies(toolchain orc_ep) add_dependencies(orc::liborc orc_ep) @@ -2686,8 +2621,8 @@ endif() macro(build_awssdk) message("Building AWS C++ SDK from source") - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" - AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS + "4.9") message(FATAL_ERROR "AWS C++ SDK requires gcc >= 4.9") endif() set(AWSSDK_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/awssdk_ep-install") @@ -2714,14 +2649,14 @@ macro(build_awssdk) "-DCMAKE_INSTALL_PREFIX=${AWSSDK_PREFIX}" "-DCMAKE_PREFIX_PATH=${AWSSDK_PREFIX}") - set( - AWSSDK_CMAKE_ARGS - ${AWSSDK_COMMON_CMAKE_ARGS} -DBUILD_DEPS=OFF - -DBUILD_ONLY=config\\$s3\\$transfer\\$identity-management\\$sts - -DMINIMIZE_SIZE=ON) + set(AWSSDK_CMAKE_ARGS + ${AWSSDK_COMMON_CMAKE_ARGS} + -DBUILD_DEPS=OFF + -DBUILD_ONLY=config\\$s3\\$transfer\\$identity-management\\$sts + -DMINIMIZE_SIZE=ON) if(UNIX AND TARGET zlib_ep) list(APPEND AWSSDK_CMAKE_ARGS -DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS} - -DZLIB_LIBRARY=${ZLIB_LIBRARIES}) + -DZLIB_LIBRARY=${ZLIB_LIBRARIES}) endif() file(MAKE_DIRECTORY ${AWSSDK_INCLUDE_DIR}) @@ -2742,10 +2677,9 @@ macro(build_awssdk) string(TOUPPER ${_AWSSDK_LIB} _AWSSDK_LIB_UPPER) # AWS-C-COMMON -> AWS_C_COMMON string(REPLACE "-" "_" _AWSSDK_LIB_NAME_PREFIX ${_AWSSDK_LIB_UPPER}) - set( - _AWSSDK_STATIC_LIBRARY - "${AWSSDK_PREFIX}/${AWSSDK_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${_AWSSDK_LIB}${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + set(_AWSSDK_STATIC_LIBRARY + "${AWSSDK_PREFIX}/${AWSSDK_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${_AWSSDK_LIB}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) if(${_AWSSDK_LIB} MATCHES "^aws-cpp-sdk-") set(_AWSSDK_TARGET_NAME ${_AWSSDK_LIB}) else() @@ -2755,43 +2689,46 @@ macro(build_awssdk) set_target_properties( ${_AWSSDK_TARGET_NAME} PROPERTIES IMPORTED_LOCATION ${_AWSSDK_STATIC_LIBRARY} INTERFACE_INCLUDE_DIRECTORIES - "${AWSSDK_INCLUDE_DIR}") + "${AWSSDK_INCLUDE_DIR}") set("${_AWSSDK_LIB_NAME_PREFIX}_STATIC_LIBRARY" ${_AWSSDK_STATIC_LIBRARY}) list(APPEND AWSSDK_LIBRARIES ${_AWSSDK_TARGET_NAME}) endforeach() - externalproject_add(aws_c_common_ep - ${EP_LOG_OPTIONS} - URL ${AWS_C_COMMON_SOURCE_URL} - CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS} - BUILD_BYPRODUCTS ${AWS_C_COMMON_STATIC_LIBRARY}) + externalproject_add( + aws_c_common_ep + ${EP_LOG_OPTIONS} + URL ${AWS_C_COMMON_SOURCE_URL} + CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS} + BUILD_BYPRODUCTS ${AWS_C_COMMON_STATIC_LIBRARY}) add_dependencies(AWS::aws-c-common aws_c_common_ep) - externalproject_add(aws_checksums_ep - ${EP_LOG_OPTIONS} - URL ${AWS_CHECKSUMS_SOURCE_URL} - CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS} - BUILD_BYPRODUCTS ${AWS_CHECKSUMS_STATIC_LIBRARY}) + externalproject_add( + aws_checksums_ep + ${EP_LOG_OPTIONS} + URL ${AWS_CHECKSUMS_SOURCE_URL} + CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS} + BUILD_BYPRODUCTS ${AWS_CHECKSUMS_STATIC_LIBRARY}) add_dependencies(AWS::aws-checksums aws_checksums_ep) - externalproject_add(aws_c_event_stream_ep - ${EP_LOG_OPTIONS} - URL ${AWS_C_EVENT_STREAM_SOURCE_URL} - CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS} - BUILD_BYPRODUCTS ${AWS_C_EVENT_STREAM_STATIC_LIBRARY} - DEPENDS aws_c_common_ep aws_checksums_ep) + externalproject_add( + aws_c_event_stream_ep + ${EP_LOG_OPTIONS} + URL ${AWS_C_EVENT_STREAM_SOURCE_URL} + CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS} + BUILD_BYPRODUCTS ${AWS_C_EVENT_STREAM_STATIC_LIBRARY} + DEPENDS aws_c_common_ep aws_checksums_ep) add_dependencies(AWS::aws-c-event-stream aws_c_event_stream_ep) - externalproject_add(awssdk_ep - ${EP_LOG_OPTIONS} - URL ${AWSSDK_SOURCE_URL} - CMAKE_ARGS ${AWSSDK_CMAKE_ARGS} - BUILD_BYPRODUCTS ${AWS_CPP_SDK_COGNITO_IDENTITY_STATIC_LIBRARY} - ${AWS_CPP_SDK_CORE_STATIC_LIBRARY} - ${AWS_CPP_SDK_IDENTITY_MANAGEMENT_STATIC_LIBRARY} - ${AWS_CPP_SDK_S3_STATIC_LIBRARY} - ${AWS_CPP_SDK_STS_STATIC_LIBRARY} - DEPENDS aws_c_event_stream_ep) + externalproject_add( + awssdk_ep + ${EP_LOG_OPTIONS} + URL ${AWSSDK_SOURCE_URL} + CMAKE_ARGS ${AWSSDK_CMAKE_ARGS} + BUILD_BYPRODUCTS + ${AWS_CPP_SDK_COGNITO_IDENTITY_STATIC_LIBRARY} ${AWS_CPP_SDK_CORE_STATIC_LIBRARY} + ${AWS_CPP_SDK_IDENTITY_MANAGEMENT_STATIC_LIBRARY} ${AWS_CPP_SDK_S3_STATIC_LIBRARY} + ${AWS_CPP_SDK_STS_STATIC_LIBRARY} + DEPENDS aws_c_event_stream_ep) add_dependencies(toolchain awssdk_ep) foreach(_AWSSDK_LIB ${_AWSSDK_LIBS}) if(${_AWSSDK_LIB} MATCHES "^aws-cpp-sdk-") @@ -2808,21 +2745,23 @@ macro(build_awssdk) if(NOT TARGET CURL::libcurl) # For CMake 3.11 or older add_library(CURL::libcurl UNKNOWN IMPORTED) - set_target_properties(CURL::libcurl - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${CURL_INCLUDE_DIRS}" IMPORTED_LOCATION - "${CURL_LIBRARIES}") + set_target_properties( + CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}" + IMPORTED_LOCATION "${CURL_LIBRARIES}") endif() - set_property(TARGET aws-cpp-sdk-core - APPEND - PROPERTY INTERFACE_LINK_LIBRARIES CURL::libcurl) - set_property(TARGET CURL::libcurl - APPEND - PROPERTY INTERFACE_LINK_LIBRARIES OpenSSL::SSL) + set_property( + TARGET aws-cpp-sdk-core + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES CURL::libcurl) + set_property( + TARGET CURL::libcurl + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES OpenSSL::SSL) if(TARGET zlib_ep) - set_property(TARGET aws-cpp-sdk-core - APPEND - PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) + set_property( + TARGET aws-cpp-sdk-core + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) add_dependencies(awssdk_ep zlib_ep) endif() endif() @@ -2846,24 +2785,14 @@ if(ARROW_S3) # Need to customize the find_package() call, so cannot call resolve_dependency() if(AWSSDK_SOURCE STREQUAL "AUTO") - find_package(AWSSDK - COMPONENTS config - s3 - transfer - identity-management - sts) + find_package(AWSSDK COMPONENTS config s3 transfer identity-management sts) if(NOT AWSSDK_FOUND) build_awssdk() endif() elseif(AWSSDK_SOURCE STREQUAL "BUNDLED") build_awssdk() elseif(AWSSDK_SOURCE STREQUAL "SYSTEM") - find_package(AWSSDK REQUIRED - COMPONENTS config - s3 - transfer - identity-management - sts) + find_package(AWSSDK REQUIRED COMPONENTS config s3 transfer identity-management sts) endif() # Restore previous value of BUILD_SHARED_LIBS @@ -2884,9 +2813,9 @@ if(ARROW_S3) # aws-sdk-cpp to use the MacOSX SDK provided by XCode which makes # XCode a hard dependency. Command Line Tools is often used instead # of the full XCode suite, so let the linker to find it. - set_target_properties(AWS::aws-c-common - PROPERTIES INTERFACE_LINK_LIBRARIES - "-pthread;pthread;-framework CoreFoundation") + set_target_properties( + AWS::aws-c-common PROPERTIES INTERFACE_LINK_LIBRARIES + "-pthread;pthread;-framework CoreFoundation") endif() endif() diff --git a/cpp/cmake_modules/UseCython.cmake b/cpp/cmake_modules/UseCython.cmake index 0d4b17d3e5724..ddf4eb5e19db0 100644 --- a/cpp/cmake_modules/UseCython.cmake +++ b/cpp/cmake_modules/UseCython.cmake @@ -58,9 +58,15 @@ #============================================================================= # Configuration options. -set(CYTHON_ANNOTATE OFF CACHE BOOL "Create an annotated .html file when compiling *.pyx.") -set(CYTHON_NO_DOCSTRINGS OFF CACHE BOOL "Strip docstrings from the compiled module.") -set(CYTHON_FLAGS "" CACHE STRING "Extra flags to the cython compiler.") +set(CYTHON_ANNOTATE + OFF + CACHE BOOL "Create an annotated .html file when compiling *.pyx.") +set(CYTHON_NO_DOCSTRINGS + OFF + CACHE BOOL "Strip docstrings from the compiled module.") +set(CYTHON_FLAGS + "" + CACHE STRING "Extra flags to the cython compiler.") mark_as_advanced(CYTHON_ANNOTATE CYTHON_NO_DOCSTRINGS CYTHON_FLAGS) find_package(Python3Alt REQUIRED) @@ -72,11 +78,7 @@ set(CYTHON_C_EXTENSION "c") # Create a *.c or *.cpp file from a *.pyx file. # Input the generated file basename. The generate files will put into the variable # placed in the "generated_files" argument. Finally all the *.py and *.pyx files. -function(compile_pyx - _name - pyx_target_name - generated_files - pyx_file) +function(compile_pyx _name pyx_target_name generated_files pyx_file) # Default to assuming all files are C. set(cxx_arg "") set(extension ${CYTHON_C_EXTENSION}) @@ -107,8 +109,8 @@ function(compile_pyx endif() if(NOT WIN32) - if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" - OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL + "RelWithDebInfo") set(cython_debug_arg "--gdb") endif() endif() @@ -128,28 +130,23 @@ function(compile_pyx if(NOT WIN32) # Cython creates a lot of compiler warning detritus on clang set_source_files_properties(${_generated_files} PROPERTIES COMPILE_FLAGS - -Wno-unused-function) + -Wno-unused-function) endif() - set(${generated_files} ${_generated_files} PARENT_SCOPE) + set(${generated_files} + ${_generated_files} + PARENT_SCOPE) # Add the command to run the compiler. add_custom_target( ${pyx_target_name} - COMMAND ${PYTHON_EXECUTABLE} - -m - cython - ${cxx_arg} - ${annotate_arg} - ${no_docstrings_arg} - ${cython_debug_arg} - ${CYTHON_FLAGS} - # Necessary for Cython code coverage - --working - ${CMAKE_CURRENT_SOURCE_DIR} - --output-file - "${CMAKE_CURRENT_BINARY_DIR}/${output_file}" - "${CMAKE_CURRENT_SOURCE_DIR}/${pyx_file}" + COMMAND + ${PYTHON_EXECUTABLE} -m cython ${cxx_arg} ${annotate_arg} ${no_docstrings_arg} + ${cython_debug_arg} ${CYTHON_FLAGS} + # Necessary for Cython code coverage + --working ${CMAKE_CURRENT_SOURCE_DIR} --output-file + "${CMAKE_CURRENT_BINARY_DIR}/${output_file}" + "${CMAKE_CURRENT_SOURCE_DIR}/${pyx_file}" DEPENDS ${pyx_location} # Do not specify byproducts for now since they don't work with the older # version of cmake available in the apt repositories. @@ -157,9 +154,15 @@ function(compile_pyx COMMENT ${comment}) # Remove their visibility to the user. - set(corresponding_pxd_file "" CACHE INTERNAL "") - set(header_location "" CACHE INTERNAL "") - set(pxd_location "" CACHE INTERNAL "") + set(corresponding_pxd_file + "" + CACHE INTERNAL "") + set(header_location + "" + CACHE INTERNAL "") + set(pxd_location + "" + CACHE INTERNAL "") endfunction() # cython_add_module( src1 src2 ... srcN ) @@ -175,7 +178,9 @@ function(cython_add_module _name pyx_target_name generated_files) endif() endforeach() compile_pyx(${_name} ${pyx_target_name} _generated_files ${pyx_module_source}) - set(${generated_files} ${_generated_files} PARENT_SCOPE) + set(${generated_files} + ${_generated_files} + PARENT_SCOPE) include_directories(${PYTHON_INCLUDE_DIRS}) python_add_module(${_name} ${_generated_files} ${other_module_sources}) add_dependencies(${_name} ${pyx_target_name}) diff --git a/cpp/cmake_modules/san-config.cmake b/cpp/cmake_modules/san-config.cmake index 5eee6278009e3..42d7098ca1120 100644 --- a/cpp/cmake_modules/san-config.cmake +++ b/cpp/cmake_modules/san-config.cmake @@ -20,10 +20,8 @@ endif() if(${ARROW_USE_ASAN}) if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" - OR (CMAKE_CXX_COMPILER_ID - STREQUAL - "GNU" - AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8")) + OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION + VERSION_GREATER "4.8")) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -DADDRESS_SANITIZER") else() message(SEND_ERROR "Cannot use ASAN without clang or gcc >= 4.8") @@ -41,18 +39,16 @@ endif() # (https://bugs.llvm.org/show_bug.cgi?id=17000#c1) # Note: GCC does not support the 'function' flag. if(${ARROW_USE_UBSAN}) - if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set( - CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize=alignment,vptr,function,float-divide-by-zero -fno-sanitize-recover=all" - ) - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" - AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "5.1") - set( - CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize=alignment,vptr -fno-sanitize-recover=all" - ) + if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL + "Clang") + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize=alignment,vptr,function,float-divide-by-zero -fno-sanitize-recover=all" + ) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION + VERSION_GREATER_EQUAL "5.1") + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize=alignment,vptr -fno-sanitize-recover=all" + ) else() message(SEND_ERROR "Cannot use UBSAN without clang or gcc >= 5.1") endif() @@ -61,14 +57,10 @@ endif() # Flag to enable thread sanitizer (clang or gcc 4.8) if(${ARROW_USE_TSAN}) if(NOT - (CMAKE_CXX_COMPILER_ID - STREQUAL - "AppleClang" + (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" - OR (CMAKE_CXX_COMPILER_ID - STREQUAL - "GNU" - AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8"))) + OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION + VERSION_GREATER "4.8"))) message(SEND_ERROR "Cannot use TSAN without clang or gcc >= 4.8") endif() @@ -100,34 +92,34 @@ if(${ARROW_USE_TSAN}) endif() if(${ARROW_USE_COVERAGE}) - if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL + "Clang") add_definitions( "-fsanitize-coverage=pc-table,inline-8bit-counters,edge,no-prune,trace-cmp,trace-div,trace-gep" - ) + ) - set( - CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -fsanitize-coverage=pc-table,inline-8bit-counters,edge,no-prune,trace-cmp,trace-div,trace-gep" - ) + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -fsanitize-coverage=pc-table,inline-8bit-counters,edge,no-prune,trace-cmp,trace-div,trace-gep" + ) else() message(SEND_ERROR "You can only enable coverage with clang") endif() endif() -if("${ARROW_USE_UBSAN}" OR "${ARROW_USE_ASAN}" OR "${ARROW_USE_TSAN}") +if("${ARROW_USE_UBSAN}" + OR "${ARROW_USE_ASAN}" + OR "${ARROW_USE_TSAN}") # GCC 4.8 and 4.9 (latest as of this writing) don't allow you to specify # disallowed entries for the sanitizer. - if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set( - CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -fsanitize-blacklist=${BUILD_SUPPORT_DIR}/sanitizer-disallowed-entries.txt" - ) + if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL + "Clang") + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -fsanitize-blacklist=${BUILD_SUPPORT_DIR}/sanitizer-disallowed-entries.txt" + ) else() message( WARNING "GCC does not support specifying a sanitizer disallowed entries list. Known sanitizer check failures will not be suppressed." - ) + ) endif() endif() diff --git a/cpp/examples/arrow/CMakeLists.txt b/cpp/examples/arrow/CMakeLists.txt index 00eff7ae03b91..b014745b1982c 100644 --- a/cpp/examples/arrow/CMakeLists.txt +++ b/cpp/examples/arrow/CMakeLists.txt @@ -15,17 +15,16 @@ # specific language governing permissions and limitations # under the License. -ADD_ARROW_EXAMPLE(row-wise-conversion-example) +add_arrow_example(row-wise-conversion-example) -if (ARROW_PARQUET AND ARROW_DATASET) - if (ARROW_BUILD_SHARED) +if(ARROW_PARQUET AND ARROW_DATASET) + if(ARROW_BUILD_SHARED) set(DATASET_EXAMPLES_LINK_LIBS arrow_dataset_shared) else() set(DATASET_EXAMPLES_LINK_LIBS arrow_dataset_static) endif() - ADD_ARROW_EXAMPLE(dataset-parquet-scan-example - EXTRA_LINK_LIBS - ${DATASET_EXAMPLES_LINK_LIBS}) + add_arrow_example(dataset-parquet-scan-example EXTRA_LINK_LIBS + ${DATASET_EXAMPLES_LINK_LIBS}) add_dependencies(dataset-parquet-scan-example parquet) endif() diff --git a/cpp/examples/minimal_build/CMakeLists.txt b/cpp/examples/minimal_build/CMakeLists.txt index 9fc20c70fe0d2..d3eea7ba0f08c 100644 --- a/cpp/examples/minimal_build/CMakeLists.txt +++ b/cpp/examples/minimal_build/CMakeLists.txt @@ -31,7 +31,7 @@ message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}") add_executable(arrow_example example.cc) -if (ARROW_LINK_SHARED) +if(ARROW_LINK_SHARED) target_link_libraries(arrow_example PRIVATE arrow_shared) else() set(THREADS_PREFER_PTHREAD_FLAG ON) diff --git a/cpp/examples/parquet/CMakeLists.txt b/cpp/examples/parquet/CMakeLists.txt index cc8f5a98150b5..6539dda454072 100644 --- a/cpp/examples/parquet/CMakeLists.txt +++ b/cpp/examples/parquet/CMakeLists.txt @@ -23,33 +23,34 @@ target_include_directories(parquet-low-level-example PRIVATE low-level-api/) target_include_directories(parquet-low-level-example2 PRIVATE low-level-api/) # The variables in these files are for illustration purposes -set(PARQUET_EXAMPLES_WARNING_SUPPRESSIONS - low-level-api/reader-writer.cc - low-level-api/reader-writer2.cc) +set(PARQUET_EXAMPLES_WARNING_SUPPRESSIONS low-level-api/reader-writer.cc + low-level-api/reader-writer2.cc) -if (PARQUET_REQUIRE_ENCRYPTION) +if(PARQUET_REQUIRE_ENCRYPTION) add_executable(parquet-encryption-example low-level-api/encryption-reader-writer.cc) - add_executable(parquet-encryption-example-all-crypto-options low-level-api/encryption-reader-writer-all-crypto-options.cc) + add_executable(parquet-encryption-example-all-crypto-options + low-level-api/encryption-reader-writer-all-crypto-options.cc) target_include_directories(parquet-encryption-example PRIVATE low-level-api/) - target_include_directories(parquet-encryption-example-all-crypto-options PRIVATE low-level-api/) + target_include_directories(parquet-encryption-example-all-crypto-options + PRIVATE low-level-api/) set(PARQUET_EXAMPLES_WARNING_SUPPRESSIONS - ${PARQUET_EXAMPLES_WARNING_SUPPRESSIONS} - low-level-api/encryption-reader-writer.cc - low-level-api/encryption-reader-writer-all-crypto-options.cc) + ${PARQUET_EXAMPLES_WARNING_SUPPRESSIONS} low-level-api/encryption-reader-writer.cc + low-level-api/encryption-reader-writer-all-crypto-options.cc) endif() if(UNIX) foreach(FILE ${PARQUET_EXAMPLES_WARNING_SUPPRESSIONS}) - set_property(SOURCE ${FILE} + set_property( + SOURCE ${FILE} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-unused-variable") endforeach() endif() # Prefer shared linkage but use static if shared build is deactivated -if (ARROW_BUILD_SHARED) +if(ARROW_BUILD_SHARED) set(PARQUET_EXAMPLE_LINK_LIBS parquet_shared) else() set(PARQUET_EXAMPLE_LINK_LIBS parquet_static) @@ -62,17 +63,14 @@ target_link_libraries(parquet-stream-api-example ${PARQUET_EXAMPLE_LINK_LIBS}) if(PARQUET_REQUIRE_ENCRYPTION) target_link_libraries(parquet-encryption-example ${PARQUET_EXAMPLE_LINK_LIBS}) - target_link_libraries(parquet-encryption-example-all-crypto-options ${PARQUET_EXAMPLE_LINK_LIBS}) + target_link_libraries(parquet-encryption-example-all-crypto-options + ${PARQUET_EXAMPLE_LINK_LIBS}) endif() -add_dependencies(parquet - parquet-low-level-example - parquet-low-level-example2 - parquet-arrow-example - parquet-stream-api-example) +add_dependencies(parquet parquet-low-level-example parquet-low-level-example2 + parquet-arrow-example parquet-stream-api-example) -if (PARQUET_REQUIRE_ENCRYPTION) - add_dependencies(parquet - parquet-encryption-example - parquet-encryption-example-all-crypto-options) +if(PARQUET_REQUIRE_ENCRYPTION) + add_dependencies(parquet parquet-encryption-example + parquet-encryption-example-all-crypto-options) endif() diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index 7f8b53710916c..9c73a0e2b9f96 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -20,21 +20,14 @@ add_custom_target(arrow) add_custom_target(arrow-benchmarks) add_custom_target(arrow-tests) add_custom_target(arrow-integration) -add_dependencies(arrow-all - arrow - arrow-tests - arrow-benchmarks - arrow-integration) +add_dependencies(arrow-all arrow arrow-tests arrow-benchmarks arrow-integration) # Adding unit tests part of the "arrow" portion of the test suite function(ADD_ARROW_TEST REL_TEST_NAME) set(options) set(one_value_args PREFIX) set(multi_value_args LABELS PRECOMPILED_HEADERS) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_PREFIX) @@ -59,23 +52,21 @@ function(ADD_ARROW_TEST REL_TEST_NAME) set(PCH_ARGS PRECOMPILED_HEADER_LIB "arrow-array-test") endif() - add_test_case(${REL_TEST_NAME} - PREFIX - ${PREFIX} - LABELS - ${LABELS} - ${PCH_ARGS} - ${ARG_UNPARSED_ARGUMENTS}) + add_test_case( + ${REL_TEST_NAME} + PREFIX + ${PREFIX} + LABELS + ${LABELS} + ${PCH_ARGS} + ${ARG_UNPARSED_ARGUMENTS}) endfunction() function(ADD_ARROW_FUZZ_TARGET REL_FUZZING_NAME) set(options) set(one_value_args PREFIX) set(multi_value_args) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_PREFIX) @@ -89,11 +80,7 @@ function(ADD_ARROW_FUZZ_TARGET REL_FUZZING_NAME) else() set(LINK_LIBS arrow_shared) endif() - add_fuzz_target(${REL_FUZZING_NAME} - PREFIX - ${PREFIX} - LINK_LIBS - ${LINK_LIBS} + add_fuzz_target(${REL_FUZZING_NAME} PREFIX ${PREFIX} LINK_LIBS ${LINK_LIBS} ${ARG_UNPARSED_ARGUMENTS}) endfunction() @@ -101,21 +88,14 @@ function(ADD_ARROW_BENCHMARK REL_TEST_NAME) set(options) set(one_value_args PREFIX) set(multi_value_args) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_PREFIX) set(PREFIX ${ARG_PREFIX}) else() set(PREFIX "arrow") endif() - add_benchmark(${REL_TEST_NAME} - PREFIX - ${PREFIX} - LABELS - "arrow-benchmarks" + add_benchmark(${REL_TEST_NAME} PREFIX ${PREFIX} LABELS "arrow-benchmarks" ${ARG_UNPARSED_ARGUMENTS}) endfunction() @@ -218,14 +198,14 @@ if(ARROW_HAVE_RUNTIME_AVX2) list(APPEND ARROW_SRCS util/bpacking_avx2.cc) set_source_files_properties(util/bpacking_avx2.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON) set_source_files_properties(util/bpacking_avx2.cc PROPERTIES COMPILE_FLAGS - ${ARROW_AVX2_FLAG}) + ${ARROW_AVX2_FLAG}) endif() if(ARROW_HAVE_RUNTIME_AVX512) list(APPEND ARROW_SRCS util/bpacking_avx512.cc) set_source_files_properties(util/bpacking_avx512.cc PROPERTIES SKIP_PRECOMPILE_HEADERS - ON) + ON) set_source_files_properties(util/bpacking_avx512.cc PROPERTIES COMPILE_FLAGS - ${ARROW_AVX512_FLAG}) + ${ARROW_AVX512_FLAG}) endif() if(APPLE) @@ -250,12 +230,9 @@ set(ARROW_C_SRCS vendored/uriparser/UriResolve.c vendored/uriparser/UriShorten.c) -set_source_files_properties(vendored/datetime/tz.cpp - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - SKIP_UNITY_BUILD_INCLUSION - ON) +set_source_files_properties( + vendored/datetime/tz.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON + SKIP_UNITY_BUILD_INCLUSION ON) # Disable DLL exports in vendored uriparser library add_definitions(-DURI_STATIC_BUILD) @@ -316,24 +293,21 @@ endif() if(_allocator_dependencies) if("${CMAKE_GENERATOR}" STREQUAL "Ninja") set_source_files_properties(memory_pool.cc PROPERTIES OBJECT_DEPENDS - "${_allocator_dependencies}") + "${_allocator_dependencies}") else() add_dependencies(arrow_dependencies ${_allocator_dependencies}) endif() - set_source_files_properties(memory_pool.cc - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - SKIP_UNITY_BUILD_INCLUSION - ON) + set_source_files_properties(memory_pool.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON + SKIP_UNITY_BUILD_INCLUSION ON) endif() unset(_allocator_dependencies) if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set_property(SOURCE util/io_util.cc - APPEND_STRING - PROPERTY COMPILE_FLAGS " -Wno-unused-macros ") + set_property( + SOURCE util/io_util.cc + APPEND_STRING + PROPERTY COMPILE_FLAGS " -Wno-unused-macros ") endif() # @@ -341,65 +315,69 @@ endif() # if(ARROW_CSV) - list(APPEND ARROW_SRCS - csv/converter.cc - csv/chunker.cc - csv/column_builder.cc - csv/column_decoder.cc - csv/options.cc - csv/parser.cc - csv/reader.cc) + list( + APPEND + ARROW_SRCS + csv/converter.cc + csv/chunker.cc + csv/column_builder.cc + csv/column_decoder.cc + csv/options.cc + csv/parser.cc + csv/reader.cc) list(APPEND ARROW_TESTING_SRCS csv/test_common.cc) endif() if(ARROW_COMPUTE) - list(APPEND ARROW_SRCS - compute/api_aggregate.cc - compute/api_scalar.cc - compute/api_vector.cc - compute/cast.cc - compute/exec.cc - compute/function.cc - compute/kernel.cc - compute/registry.cc - compute/kernels/aggregate_basic.cc - compute/kernels/aggregate_mode.cc - compute/kernels/aggregate_var_std.cc - compute/kernels/codegen_internal.cc - compute/kernels/scalar_arithmetic.cc - compute/kernels/scalar_boolean.cc - compute/kernels/scalar_cast_boolean.cc - compute/kernels/scalar_cast_internal.cc - compute/kernels/scalar_cast_nested.cc - compute/kernels/scalar_cast_numeric.cc - compute/kernels/scalar_cast_string.cc - compute/kernels/scalar_cast_temporal.cc - compute/kernels/scalar_compare.cc - compute/kernels/scalar_nested.cc - compute/kernels/scalar_set_lookup.cc - compute/kernels/scalar_string.cc - compute/kernels/scalar_validity.cc - compute/kernels/scalar_fill_null.cc - compute/kernels/util_internal.cc - compute/kernels/vector_hash.cc - compute/kernels/vector_nested.cc - compute/kernels/vector_selection.cc - compute/kernels/vector_sort.cc) + list( + APPEND + ARROW_SRCS + compute/api_aggregate.cc + compute/api_scalar.cc + compute/api_vector.cc + compute/cast.cc + compute/exec.cc + compute/function.cc + compute/kernel.cc + compute/registry.cc + compute/kernels/aggregate_basic.cc + compute/kernels/aggregate_mode.cc + compute/kernels/aggregate_var_std.cc + compute/kernels/codegen_internal.cc + compute/kernels/scalar_arithmetic.cc + compute/kernels/scalar_boolean.cc + compute/kernels/scalar_cast_boolean.cc + compute/kernels/scalar_cast_internal.cc + compute/kernels/scalar_cast_nested.cc + compute/kernels/scalar_cast_numeric.cc + compute/kernels/scalar_cast_string.cc + compute/kernels/scalar_cast_temporal.cc + compute/kernels/scalar_compare.cc + compute/kernels/scalar_nested.cc + compute/kernels/scalar_set_lookup.cc + compute/kernels/scalar_string.cc + compute/kernels/scalar_validity.cc + compute/kernels/scalar_fill_null.cc + compute/kernels/util_internal.cc + compute/kernels/vector_hash.cc + compute/kernels/vector_nested.cc + compute/kernels/vector_selection.cc + compute/kernels/vector_sort.cc) if(ARROW_HAVE_RUNTIME_AVX2) list(APPEND ARROW_SRCS compute/kernels/aggregate_basic_avx2.cc) - set_source_files_properties(compute/kernels/aggregate_basic_avx2.cc PROPERTIES - SKIP_PRECOMPILE_HEADERS ON) - set_source_files_properties(compute/kernels/aggregate_basic_avx2.cc PROPERTIES - COMPILE_FLAGS ${ARROW_AVX2_FLAG}) + set_source_files_properties(compute/kernels/aggregate_basic_avx2.cc + PROPERTIES SKIP_PRECOMPILE_HEADERS ON) + set_source_files_properties(compute/kernels/aggregate_basic_avx2.cc + PROPERTIES COMPILE_FLAGS ${ARROW_AVX2_FLAG}) endif() if(ARROW_HAVE_RUNTIME_AVX512) list(APPEND ARROW_SRCS compute/kernels/aggregate_basic_avx512.cc) - set_source_files_properties(compute/kernels/aggregate_basic_avx512.cc PROPERTIES - SKIP_PRECOMPILE_HEADERS ON) - set_source_files_properties(compute/kernels/aggregate_basic_avx512.cc PROPERTIES - COMPILE_FLAGS ${ARROW_AVX512_FLAG}) + set_source_files_properties(compute/kernels/aggregate_basic_avx512.cc + PROPERTIES SKIP_PRECOMPILE_HEADERS ON) + set_source_files_properties(compute/kernels/aggregate_basic_avx512.cc + PROPERTIES COMPILE_FLAGS ${ARROW_AVX512_FLAG}) endif() endif() @@ -408,39 +386,40 @@ if(ARROW_FILESYSTEM) add_definitions(-DARROW_HDFS) endif() - list(APPEND ARROW_SRCS - filesystem/filesystem.cc - filesystem/localfs.cc - filesystem/mockfs.cc - filesystem/path_forest.cc - filesystem/path_util.cc - filesystem/util_internal.cc) + list( + APPEND + ARROW_SRCS + filesystem/filesystem.cc + filesystem/localfs.cc + filesystem/mockfs.cc + filesystem/path_forest.cc + filesystem/path_util.cc + filesystem/util_internal.cc) if(ARROW_HDFS) list(APPEND ARROW_SRCS filesystem/hdfs.cc) endif() if(ARROW_S3) list(APPEND ARROW_SRCS filesystem/s3fs.cc) - set_source_files_properties(filesystem/s3fs.cc - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - SKIP_UNITY_BUILD_INCLUSION - ON) + set_source_files_properties( + filesystem/s3fs.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON SKIP_UNITY_BUILD_INCLUSION + ON) endif() list(APPEND ARROW_TESTING_SRCS filesystem/test_util.cc) endif() if(ARROW_IPC) - list(APPEND ARROW_SRCS - ipc/dictionary.cc - ipc/feather.cc - ipc/message.cc - ipc/metadata_internal.cc - ipc/options.cc - ipc/reader.cc - ipc/writer.cc) + list( + APPEND + ARROW_SRCS + ipc/dictionary.cc + ipc/feather.cc + ipc/message.cc + ipc/metadata_internal.cc + ipc/options.cc + ipc/reader.cc + ipc/writer.cc) if(ARROW_JSON) list(APPEND ARROW_SRCS ipc/json_simple.cc) @@ -448,13 +427,15 @@ if(ARROW_IPC) endif() if(ARROW_JSON) - list(APPEND ARROW_SRCS - json/options.cc - json/chunked_builder.cc - json/chunker.cc - json/converter.cc - json/parser.cc - json/reader.cc) + list( + APPEND + ARROW_SRCS + json/options.cc + json/chunked_builder.cc + json/chunker.cc + json/converter.cc + json/parser.cc + json/reader.cc) endif() if(ARROW_ORC) @@ -472,31 +453,32 @@ endif() set(ARROW_ALL_SRCS ${ARROW_SRCS} ${ARROW_C_SRCS}) -add_arrow_lib(arrow - CMAKE_PACKAGE_NAME - Arrow - PKG_CONFIG_NAME - arrow - SOURCES - ${ARROW_ALL_SRCS} - OUTPUTS - ARROW_LIBRARIES - PRECOMPILED_HEADERS - "$<$:arrow/pch.h>" - DEPENDENCIES - arrow_dependencies - SHARED_LINK_FLAGS - ${ARROW_SHARED_LINK_FLAGS} - SHARED_LINK_LIBS - ${ARROW_LINK_LIBS} - SHARED_PRIVATE_LINK_LIBS - ${ARROW_SHARED_PRIVATE_LINK_LIBS} - STATIC_LINK_LIBS - ${ARROW_STATIC_LINK_LIBS} - SHARED_INSTALL_INTERFACE_LIBS - ${ARROW_SHARED_INSTALL_INTERFACE_LIBS} - STATIC_INSTALL_INTERFACE_LIBS - ${ARROW_STATIC_INSTALL_INTERFACE_LIBS}) +add_arrow_lib( + arrow + CMAKE_PACKAGE_NAME + Arrow + PKG_CONFIG_NAME + arrow + SOURCES + ${ARROW_ALL_SRCS} + OUTPUTS + ARROW_LIBRARIES + PRECOMPILED_HEADERS + "$<$:arrow/pch.h>" + DEPENDENCIES + arrow_dependencies + SHARED_LINK_FLAGS + ${ARROW_SHARED_LINK_FLAGS} + SHARED_LINK_LIBS + ${ARROW_LINK_LIBS} + SHARED_PRIVATE_LINK_LIBS + ${ARROW_SHARED_PRIVATE_LINK_LIBS} + STATIC_LINK_LIBS + ${ARROW_STATIC_LINK_LIBS} + SHARED_INSTALL_INTERFACE_LIBS + ${ARROW_SHARED_INSTALL_INTERFACE_LIBS} + STATIC_INSTALL_INTERFACE_LIBS + ${ARROW_STATIC_INSTALL_INTERFACE_LIBS}) add_dependencies(arrow ${ARROW_LIBRARIES}) @@ -518,35 +500,37 @@ endif() if(ARROW_BUILD_STATIC AND ARROW_BUNDLED_STATIC_LIBS) 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}) + 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 - CMAKE_PACKAGE_NAME - ArrowTesting - PKG_CONFIG_NAME - arrow-testing - SOURCES - ${ARROW_TESTING_SRCS} - OUTPUTS - ARROW_TESTING_LIBRARIES - PRECOMPILED_HEADERS - "$<$:arrow/pch.h>" - DEPENDENCIES - arrow_test_dependencies - SHARED_LINK_LIBS - arrow_shared - GTest::gtest - STATIC_LINK_LIBS - arrow_static) + add_arrow_lib( + arrow_testing + CMAKE_PACKAGE_NAME + ArrowTesting + PKG_CONFIG_NAME + arrow-testing + SOURCES + ${ARROW_TESTING_SRCS} + OUTPUTS + ARROW_TESTING_LIBRARIES + PRECOMPILED_HEADERS + "$<$:arrow/pch.h>" + DEPENDENCIES + arrow_test_dependencies + SHARED_LINK_LIBS + arrow_shared + GTest::gtest + STATIC_LINK_LIBS + arrow_static) add_custom_target(arrow_testing) add_dependencies(arrow_testing ${ARROW_TESTING_LIBRARIES}) @@ -573,17 +557,18 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/arrow-config.cmake # # Unit tests # -add_arrow_test(array_test - SOURCES - array/array_test.cc - array/array_binary_test.cc - array/array_dict_test.cc - array/array_list_test.cc - array/array_struct_test.cc - array/array_union_test.cc - array/array_view_test.cc - PRECOMPILED_HEADERS - "$<$:arrow/testing/pch.h>") +add_arrow_test( + array_test + SOURCES + array/array_test.cc + array/array_binary_test.cc + array/array_dict_test.cc + array/array_list_test.cc + array/array_struct_test.cc + array/array_union_test.cc + array/array_view_test.cc + PRECOMPILED_HEADERS + "$<$:arrow/testing/pch.h>") add_arrow_test(buffer_test) @@ -592,32 +577,25 @@ if(ARROW_IPC) add_arrow_test(extension_type_test) endif() -add_arrow_test(misc_test - SOURCES - datum_test.cc - memory_pool_test.cc - result_test.cc - pretty_print_test.cc - status_test.cc) +add_arrow_test( + misc_test + SOURCES + datum_test.cc + memory_pool_test.cc + result_test.cc + pretty_print_test.cc + status_test.cc) add_arrow_test(public_api_test) -set_source_files_properties(public_api_test.cc - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - SKIP_UNITY_BUILD_INCLUSION - ON) +set_source_files_properties(public_api_test.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON + SKIP_UNITY_BUILD_INCLUSION ON) add_arrow_test(scalar_test) add_arrow_test(type_test) -add_arrow_test(table_test - SOURCES - chunked_array_test.cc - record_batch_test.cc - table_test.cc - table_builder_test.cc) +add_arrow_test(table_test SOURCES chunked_array_test.cc record_batch_test.cc + table_test.cc table_builder_test.cc) add_arrow_test(tensor_test) add_arrow_test(sparse_tensor_test) diff --git a/cpp/src/arrow/adapters/orc/CMakeLists.txt b/cpp/src/arrow/adapters/orc/CMakeLists.txt index 516196c2eefb4..51cd7e840197a 100644 --- a/cpp/src/arrow/adapters/orc/CMakeLists.txt +++ b/cpp/src/arrow/adapters/orc/CMakeLists.txt @@ -25,12 +25,7 @@ install(FILES adapter.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/adapters/ # pkg-config support arrow_add_pkg_config("arrow-orc") -set(ORC_MIN_TEST_LIBS - GTest::gtest_main - GTest::gtest - Snappy::snappy - LZ4::lz4 - ZLIB::ZLIB) +set(ORC_MIN_TEST_LIBS GTest::gtest_main GTest::gtest Snappy::snappy LZ4::lz4 ZLIB::ZLIB) if(ARROW_BUILD_STATIC) set(ARROW_LIBRARIES_FOR_STATIC_TESTS arrow_testing_static arrow_static) @@ -47,15 +42,8 @@ endif() set(ORC_STATIC_TEST_LINK_LIBS orc::liborc ${ARROW_LIBRARIES_FOR_STATIC_TESTS} ${ORC_MIN_TEST_LIBS}) -add_arrow_test(adapter_test - PREFIX - "arrow-orc" - STATIC_LINK_LIBS +add_arrow_test(adapter_test PREFIX "arrow-orc" STATIC_LINK_LIBS ${ORC_STATIC_TEST_LINK_LIBS}) -set_source_files_properties(adapter_test.cc - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - SKIP_UNITY_BUILD_INCLUSION - ON) +set_source_files_properties(adapter_test.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON + SKIP_UNITY_BUILD_INCLUSION ON) diff --git a/cpp/src/arrow/compute/CMakeLists.txt b/cpp/src/arrow/compute/CMakeLists.txt index e781dff90e2a1..34a57c62e7f08 100644 --- a/cpp/src/arrow/compute/CMakeLists.txt +++ b/cpp/src/arrow/compute/CMakeLists.txt @@ -30,10 +30,7 @@ function(ADD_ARROW_COMPUTE_TEST REL_TEST_NAME) set(options) set(one_value_args PREFIX) set(multi_value_args LABELS) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_PREFIX) @@ -48,22 +45,19 @@ function(ADD_ARROW_COMPUTE_TEST REL_TEST_NAME) set(LABELS "arrow_compute") endif() - add_arrow_test(${REL_TEST_NAME} - EXTRA_LINK_LIBS - ${ARROW_DATASET_TEST_LINK_LIBS} - PREFIX - ${PREFIX} - LABELS - ${LABELS} - ${ARG_UNPARSED_ARGUMENTS}) + add_arrow_test( + ${REL_TEST_NAME} + EXTRA_LINK_LIBS + ${ARROW_DATASET_TEST_LINK_LIBS} + PREFIX + ${PREFIX} + LABELS + ${LABELS} + ${ARG_UNPARSED_ARGUMENTS}) endfunction() -add_arrow_compute_test(internals_test - SOURCES - function_test.cc - exec_test.cc - kernel_test.cc - registry_test.cc) +add_arrow_compute_test(internals_test SOURCES function_test.cc exec_test.cc + kernel_test.cc registry_test.cc) add_arrow_benchmark(function_benchmark PREFIX "arrow-compute") diff --git a/cpp/src/arrow/compute/kernels/CMakeLists.txt b/cpp/src/arrow/compute/kernels/CMakeLists.txt index 577b250da87ed..2ad88b971feaf 100644 --- a/cpp/src/arrow/compute/kernels/CMakeLists.txt +++ b/cpp/src/arrow/compute/kernels/CMakeLists.txt @@ -18,18 +18,19 @@ # ---------------------------------------------------------------------- # Scalar kernels -add_arrow_compute_test(scalar_test - SOURCES - scalar_arithmetic_test.cc - scalar_boolean_test.cc - scalar_cast_test.cc - scalar_compare_test.cc - scalar_nested_test.cc - scalar_set_lookup_test.cc - scalar_string_test.cc - scalar_validity_test.cc - scalar_fill_null_test.cc - test_util.cc) +add_arrow_compute_test( + scalar_test + SOURCES + scalar_arithmetic_test.cc + scalar_boolean_test.cc + scalar_cast_test.cc + scalar_compare_test.cc + scalar_nested_test.cc + scalar_set_lookup_test.cc + scalar_string_test.cc + scalar_validity_test.cc + scalar_fill_null_test.cc + test_util.cc) add_arrow_benchmark(scalar_arithmetic_benchmark PREFIX "arrow-compute") add_arrow_benchmark(scalar_boolean_benchmark PREFIX "arrow-compute") @@ -41,13 +42,14 @@ add_arrow_benchmark(scalar_string_benchmark PREFIX "arrow-compute") # ---------------------------------------------------------------------- # Vector kernels -add_arrow_compute_test(vector_test - SOURCES - vector_hash_test.cc - vector_nested_test.cc - vector_selection_test.cc - vector_sort_test.cc - test_util.cc) +add_arrow_compute_test( + vector_test + SOURCES + vector_hash_test.cc + vector_nested_test.cc + vector_selection_test.cc + vector_sort_test.cc + test_util.cc) add_arrow_benchmark(vector_hash_benchmark PREFIX "arrow-compute") add_arrow_benchmark(vector_sort_benchmark PREFIX "arrow-compute") diff --git a/cpp/src/arrow/csv/CMakeLists.txt b/cpp/src/arrow/csv/CMakeLists.txt index 84b1a103264c8..8154732c0a589 100644 --- a/cpp/src/arrow/csv/CMakeLists.txt +++ b/cpp/src/arrow/csv/CMakeLists.txt @@ -15,13 +15,14 @@ # specific language governing permissions and limitations # under the License. -add_arrow_test(csv-test - SOURCES - chunker_test.cc - column_builder_test.cc - column_decoder_test.cc - converter_test.cc - parser_test.cc) +add_arrow_test( + csv-test + SOURCES + chunker_test.cc + column_builder_test.cc + column_decoder_test.cc + converter_test.cc + parser_test.cc) add_arrow_benchmark(converter_benchmark PREFIX "arrow-csv") add_arrow_benchmark(parser_benchmark PREFIX "arrow-csv") diff --git a/cpp/src/arrow/dataset/CMakeLists.txt b/cpp/src/arrow/dataset/CMakeLists.txt index b693c48049ce1..5bb3a9fa6ee25 100644 --- a/cpp/src/arrow/dataset/CMakeLists.txt +++ b/cpp/src/arrow/dataset/CMakeLists.txt @@ -43,23 +43,24 @@ if(ARROW_PARQUET) set(ARROW_DATASET_PRIVATE_INCLUDES ${PROJECT_SOURCE_DIR}/src/parquet) endif() -add_arrow_lib(arrow_dataset - CMAKE_PACKAGE_NAME - ArrowDataset - PKG_CONFIG_NAME - arrow-dataset - OUTPUTS - ARROW_DATASET_LIBRARIES - SOURCES - ${ARROW_DATASET_SRCS} - PRECOMPILED_HEADERS - "$<$:arrow/dataset/pch.h>" - PRIVATE_INCLUDES - ${ARROW_DATASET_PRIVATE_INCLUDES} - SHARED_LINK_LIBS - ${ARROW_DATASET_LINK_SHARED} - STATIC_LINK_LIBS - ${ARROW_DATASET_LINK_STATIC}) +add_arrow_lib( + arrow_dataset + CMAKE_PACKAGE_NAME + ArrowDataset + PKG_CONFIG_NAME + arrow-dataset + OUTPUTS + ARROW_DATASET_LIBRARIES + SOURCES + ${ARROW_DATASET_SRCS} + PRECOMPILED_HEADERS + "$<$:arrow/dataset/pch.h>" + PRIVATE_INCLUDES + ${ARROW_DATASET_PRIVATE_INCLUDES} + SHARED_LINK_LIBS + ${ARROW_DATASET_LINK_SHARED} + STATIC_LINK_LIBS + ${ARROW_DATASET_LINK_STATIC}) if(ARROW_TEST_LINKAGE STREQUAL "static") set(ARROW_DATASET_TEST_LINK_LIBS arrow_dataset_static ${ARROW_TEST_STATIC_LINK_LIBS}) @@ -76,10 +77,7 @@ function(ADD_ARROW_DATASET_TEST REL_TEST_NAME) set(options) set(one_value_args PREFIX) set(multi_value_args LABELS) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_PREFIX) @@ -94,14 +92,15 @@ function(ADD_ARROW_DATASET_TEST REL_TEST_NAME) set(LABELS "arrow_dataset") endif() - add_arrow_test(${REL_TEST_NAME} - EXTRA_LINK_LIBS - ${ARROW_DATASET_TEST_LINK_LIBS} - PREFIX - ${PREFIX} - LABELS - ${LABELS} - ${ARG_UNPARSED_ARGUMENTS}) + add_arrow_test( + ${REL_TEST_NAME} + EXTRA_LINK_LIBS + ${ARROW_DATASET_TEST_LINK_LIBS} + PREFIX + ${PREFIX} + LABELS + ${LABELS} + ${ARG_UNPARSED_ARGUMENTS}) endfunction() add_arrow_dataset_test(dataset_test) diff --git a/cpp/src/arrow/dbi/hiveserver2/CMakeLists.txt b/cpp/src/arrow/dbi/hiveserver2/CMakeLists.txt index e8bb533b18ed5..997c3a120bd69 100644 --- a/cpp/src/arrow/dbi/hiveserver2/CMakeLists.txt +++ b/cpp/src/arrow/dbi/hiveserver2/CMakeLists.txt @@ -55,12 +55,9 @@ set(HIVESERVER2_THRIFT_SRC Types_constants.cpp Types_types.cpp) -set_source_files_properties(${HIVESERVER2_THRIFT_SRC} - PROPERTIES - COMPILE_FLAGS - "-Wno-unused-variable -Wno-shadow-field" - GENERATED - TRUE) +set_source_files_properties( + ${HIVESERVER2_THRIFT_SRC} + PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-shadow-field" GENERATED TRUE) # keep everything in one library, the object files reference # each other @@ -76,20 +73,21 @@ add_library(arrow_hiveserver2_thrift STATIC ${HIVESERVER2_THRIFT_SRC}) add_dependencies(arrow_hiveserver2_thrift hs2-thrift-cpp) set_target_properties( + arrow_hiveserver2_thrift PROPERTIES LIBRARY_OUTPUT_DIRECTORY + "${BUILD_OUTPUT_ROOT_DIRECTORY}") + +add_arrow_lib( + arrow_hiveserver2 + SOURCES + ${ARROW_HIVESERVER2_SRCS} + OUTPUTS + ARROW_HIVESERVER2_LIBRARIES + DEPENDENCIES arrow_hiveserver2_thrift - PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}") - -add_arrow_lib(arrow_hiveserver2 - SOURCES - ${ARROW_HIVESERVER2_SRCS} - OUTPUTS - ARROW_HIVESERVER2_LIBRARIES - DEPENDENCIES - arrow_hiveserver2_thrift - SHARED_LINK_FLAGS - "" - SHARED_LINK_LIBS - ${ARROW_PYTHON_SHARED_LINK_LIBS}) + SHARED_LINK_FLAGS + "" + SHARED_LINK_LIBS + ${ARROW_PYTHON_SHARED_LINK_LIBS}) add_dependencies(arrow_hiveserver2 ${ARROW_HIVESERVER2_LIBRARIES}) @@ -97,22 +95,21 @@ foreach(LIB_TARGET ${ARROW_HIVESERVER2_LIBRARIES}) target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_EXPORTING) endforeach() -set_property(SOURCE ${ARROW_HIVESERVER2_SRCS} - APPEND_STRING - PROPERTY COMPILE_FLAGS " -Wno-shadow-field") +set_property( + SOURCE ${ARROW_HIVESERVER2_SRCS} + APPEND_STRING + PROPERTY COMPILE_FLAGS " -Wno-shadow-field") set(ARROW_HIVESERVER2_TEST_LINK_LIBS arrow_hiveserver2_static arrow_hiveserver2_thrift ${ARROW_TEST_LINK_LIBS} thrift::thrift) if(ARROW_BUILD_TESTS) - add_test_case(hiveserver2_test - STATIC_LINK_LIBS - "${ARROW_HIVESERVER2_TEST_LINK_LIBS}" - LABELS - "arrow_hiveserver2-tests") + add_test_case(hiveserver2_test STATIC_LINK_LIBS "${ARROW_HIVESERVER2_TEST_LINK_LIBS}" + LABELS "arrow_hiveserver2-tests") if(TARGET arrow-hiveserver2-test) - set_property(TARGET arrow-hiveserver2-test - APPEND_STRING - PROPERTY COMPILE_FLAGS " -Wno-shadow-field") + set_property( + TARGET arrow-hiveserver2-test + APPEND_STRING + PROPERTY COMPILE_FLAGS " -Wno-shadow-field") endif() endif(ARROW_BUILD_TESTS) diff --git a/cpp/src/arrow/dbi/hiveserver2/thrift/CMakeLists.txt b/cpp/src/arrow/dbi/hiveserver2/thrift/CMakeLists.txt index f6c88473a6ed9..54d8d22d027c6 100644 --- a/cpp/src/arrow/dbi/hiveserver2/thrift/CMakeLists.txt +++ b/cpp/src/arrow/dbi/hiveserver2/thrift/CMakeLists.txt @@ -44,43 +44,35 @@ function(HS2_THRIFT_GEN VAR) # All the output files we can determine based on filename. # - Does not include .skeleton.cpp files # - Does not include java output files - set(OUTPUT_BE_FILE "${GEN_DIR}/${FIL_WE}_types.cpp" "${GEN_DIR}/${FIL_WE}_types.h" - "${GEN_DIR}/${FIL_WE}_constants.cpp" - "${GEN_DIR}/${FIL_WE}_constants.h") + set(OUTPUT_BE_FILE + "${GEN_DIR}/${FIL_WE}_types.cpp" "${GEN_DIR}/${FIL_WE}_types.h" + "${GEN_DIR}/${FIL_WE}_constants.cpp" "${GEN_DIR}/${FIL_WE}_constants.h") list(APPEND ${VAR} ${OUTPUT_BE_FILE}) # BeeswaxService thrift generation # It depends on hive_meta_store, which in turn depends on fb303. # The java dependency is handled by maven. # We need to generate C++ src file for the parent dependencies using the "-r" option. - set(CPP_ARGS - -nowarn - --gen - cpp - -out - ${GEN_DIR}) + set(CPP_ARGS -nowarn --gen cpp -out ${GEN_DIR}) if(FIL STREQUAL "beeswax.thrift") - set(CPP_ARGS - -r - -nowarn - --gen - cpp - -out - ${GEN_DIR}) + set(CPP_ARGS -r -nowarn --gen cpp -out ${GEN_DIR}) endif(FIL STREQUAL "beeswax.thrift") # Be able to include generated ErrorCodes.thrift file set(CPP_ARGS ${CPP_ARGS} -I ${CMAKE_CURRENT_BINARY_DIR}) - add_custom_command(OUTPUT ${OUTPUT_BE_FILE} - COMMAND ${THRIFT_COMPILER} ${CPP_ARGS} ${FIL} - DEPENDS ${ABS_FIL} - COMMENT "Running thrift compiler on ${FIL}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - VERBATIM) + add_custom_command( + OUTPUT ${OUTPUT_BE_FILE} + COMMAND ${THRIFT_COMPILER} ${CPP_ARGS} ${FIL} + DEPENDS ${ABS_FIL} + COMMENT "Running thrift compiler on ${FIL}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM) endforeach(FIL) - set(${VAR} ${${VAR}} PARENT_SCOPE) + set(${VAR} + ${${VAR}} + PARENT_SCOPE) endfunction(HS2_THRIFT_GEN) message("Using Thrift compiler: ${THRIFT_COMPILER}") @@ -88,10 +80,11 @@ message("Using Thrift compiler: ${THRIFT_COMPILER}") set(OUTPUT_DIR ${ARROW_BINARY_DIR}/src) file(MAKE_DIRECTORY ${OUTPUT_DIR}) -add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ErrorCodes.thrift - COMMAND python generate_error_codes.py ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS generate_error_codes.py - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ErrorCodes.thrift + COMMAND python generate_error_codes.py ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS generate_error_codes.py + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) set(SRC_FILES ${CMAKE_CURRENT_BINARY_DIR}/ErrorCodes.thrift @@ -102,8 +95,8 @@ set(SRC_FILES Status.thrift Types.thrift) -set_source_files_properties(Status.thrift PROPERTIES OBJECT_DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/ErrorCodes.thrift) +set_source_files_properties( + Status.thrift PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ErrorCodes.thrift) # Create a build command for each of the thrift src files and generate # a list of files they produce diff --git a/cpp/src/arrow/filesystem/CMakeLists.txt b/cpp/src/arrow/filesystem/CMakeLists.txt index 5b06646157b4d..4488f3adb8d1c 100644 --- a/cpp/src/arrow/filesystem/CMakeLists.txt +++ b/cpp/src/arrow/filesystem/CMakeLists.txt @@ -21,13 +21,14 @@ arrow_install_all_headers("arrow/filesystem") # pkg-config support arrow_add_pkg_config("arrow-filesystem") -add_arrow_test(filesystem-test - SOURCES - filesystem_test.cc - localfs_test.cc - path_forest_test.cc - EXTRA_LABELS - filesystem) +add_arrow_test( + filesystem-test + SOURCES + filesystem_test.cc + localfs_test.cc + path_forest_test.cc + EXTRA_LABELS + filesystem) if(ARROW_S3) add_arrow_test(s3fs_test EXTRA_LABELS filesystem) @@ -48,8 +49,8 @@ if(ARROW_S3) if(AWS_CPP_SDK_S3_TYPE STREQUAL "STATIC_LIBRARY" AND NOT APPLE) list(APPEND ARROW_S3FS_TEST_COMPILE_DEFINITIONS "AWS_CPP_SDK_S3_NOT_SHARED") endif() - target_compile_definitions(arrow-s3fs-test PRIVATE - ${ARROW_S3FS_TEST_COMPILE_DEFINITIONS}) + target_compile_definitions(arrow-s3fs-test + PRIVATE ${ARROW_S3FS_TEST_COMPILE_DEFINITIONS}) endif() if(ARROW_BUILD_TESTS) @@ -61,8 +62,8 @@ if(ARROW_S3) if(ARROW_BUILD_BENCHMARKS AND ARROW_PARQUET) add_arrow_benchmark(s3fs_benchmark PREFIX "arrow-filesystem") - target_compile_definitions(arrow-filesystem-s3fs-benchmark PRIVATE - ${ARROW_BOOST_PROCESS_COMPILE_DEFINITIONS}) + target_compile_definitions(arrow-filesystem-s3fs-benchmark + PRIVATE ${ARROW_BOOST_PROCESS_COMPILE_DEFINITIONS}) if(ARROW_TEST_LINKAGE STREQUAL "static") target_link_libraries(arrow-filesystem-s3fs-benchmark PRIVATE parquet_static) else() diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt index 835a56cdfa212..89d530ff4c3c7 100644 --- a/cpp/src/arrow/flight/CMakeLists.txt +++ b/cpp/src/arrow/flight/CMakeLists.txt @@ -19,17 +19,17 @@ add_custom_target(arrow_flight) arrow_install_all_headers("arrow/flight") -set(ARROW_FLIGHT_STATIC_LINK_LIBS ${ARROW_PROTOBUF_LIBPROTOBUF} gRPC::grpc++ c-ares::cares - ZLIB::ZLIB) +set(ARROW_FLIGHT_STATIC_LINK_LIBS ${ARROW_PROTOBUF_LIBPROTOBUF} gRPC::grpc++ + c-ares::cares ZLIB::ZLIB) if(WIN32) list(APPEND ARROW_FLIGHT_STATIC_LINK_LIBS ws2_32.lib) endif() if(ARROW_TEST_LINKAGE STREQUAL "static") - set(ARROW_FLIGHT_TEST_LINK_LIBS arrow_flight_static arrow_flight_testing_static - ${ARROW_FLIGHT_STATIC_LINK_LIBS} - ${ARROW_TEST_LINK_LIBS}) + set(ARROW_FLIGHT_TEST_LINK_LIBS + arrow_flight_static arrow_flight_testing_static ${ARROW_FLIGHT_STATIC_LINK_LIBS} + ${ARROW_TEST_LINK_LIBS}) else() set(ARROW_FLIGHT_TEST_LINK_LIBS arrow_flight_shared arrow_flight_testing_shared ${ARROW_TEST_LINK_LIBS}) @@ -40,22 +40,22 @@ endif() set(FLIGHT_PROTO_PATH "${ARROW_SOURCE_DIR}/../format") set(FLIGHT_PROTO ${ARROW_SOURCE_DIR}/../format/Flight.proto) -set(FLIGHT_GENERATED_PROTO_FILES "${CMAKE_CURRENT_BINARY_DIR}/Flight.pb.cc" - "${CMAKE_CURRENT_BINARY_DIR}/Flight.pb.h" - "${CMAKE_CURRENT_BINARY_DIR}/Flight.grpc.pb.cc" - "${CMAKE_CURRENT_BINARY_DIR}/Flight.grpc.pb.h") +set(FLIGHT_GENERATED_PROTO_FILES + "${CMAKE_CURRENT_BINARY_DIR}/Flight.pb.cc" "${CMAKE_CURRENT_BINARY_DIR}/Flight.pb.h" + "${CMAKE_CURRENT_BINARY_DIR}/Flight.grpc.pb.cc" + "${CMAKE_CURRENT_BINARY_DIR}/Flight.grpc.pb.h") set(PROTO_DEPENDS ${FLIGHT_PROTO} ${ARROW_PROTOBUF_LIBPROTOBUF} gRPC::grpc_cpp_plugin) -add_custom_command(OUTPUT ${FLIGHT_GENERATED_PROTO_FILES} - COMMAND ${ARROW_PROTOBUF_PROTOC} "-I${FLIGHT_PROTO_PATH}" - "--cpp_out=${CMAKE_CURRENT_BINARY_DIR}" "${FLIGHT_PROTO}" - DEPENDS ${PROTO_DEPENDS} ARGS - COMMAND ${ARROW_PROTOBUF_PROTOC} - "-I${FLIGHT_PROTO_PATH}" - "--grpc_out=${CMAKE_CURRENT_BINARY_DIR}" - "--plugin=protoc-gen-grpc=$" - "${FLIGHT_PROTO}") +add_custom_command( + OUTPUT ${FLIGHT_GENERATED_PROTO_FILES} + COMMAND ${ARROW_PROTOBUF_PROTOC} "-I${FLIGHT_PROTO_PATH}" + "--cpp_out=${CMAKE_CURRENT_BINARY_DIR}" "${FLIGHT_PROTO}" + DEPENDS ${PROTO_DEPENDS} ARGS + COMMAND + ${ARROW_PROTOBUF_PROTOC} "-I${FLIGHT_PROTO_PATH}" + "--grpc_out=${CMAKE_CURRENT_BINARY_DIR}" + "--plugin=protoc-gen-grpc=$" "${FLIGHT_PROTO}") set_source_files_properties(${FLIGHT_GENERATED_PROTO_FILES} PROPERTIES GENERATED TRUE) @@ -71,14 +71,16 @@ string(REPLACE "-Werror " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # verification when using TLS. if(NOT DEFINED HAS_GRPC_132) message(STATUS "Checking support for TlsCredentialsOptions...") - get_property(CURRENT_INCLUDE_DIRECTORIES - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - PROPERTY INCLUDE_DIRECTORIES) - try_compile(HAS_GRPC_132 ${CMAKE_CURRENT_BINARY_DIR}/try_compile SOURCES - "${CMAKE_CURRENT_SOURCE_DIR}/try_compile/check_tls_opts_132.cc" - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CURRENT_INCLUDE_DIRECTORIES}" - LINK_LIBRARIES gRPC::grpc - OUTPUT_VARIABLE TSL_CREDENTIALS_OPTIONS_CHECK_OUTPUT CXX_STANDARD 11) + get_property( + CURRENT_INCLUDE_DIRECTORIES + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + PROPERTY INCLUDE_DIRECTORIES) + try_compile( + HAS_GRPC_132 ${CMAKE_CURRENT_BINARY_DIR}/try_compile + SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/try_compile/check_tls_opts_132.cc" + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CURRENT_INCLUDE_DIRECTORIES}" + LINK_LIBRARIES gRPC::grpc + OUTPUT_VARIABLE TSL_CREDENTIALS_OPTIONS_CHECK_OUTPUT CXX_STANDARD 11) if(HAS_GRPC_132) message(STATUS "TlsCredentialsOptions found in grpc::experimental.") @@ -90,10 +92,11 @@ if(NOT DEFINED HAS_GRPC_132) message(DEBUG ${TSL_CREDENTIALS_OPTIONS_CHECK_OUTPUT}) list(REMOVE_AT CMAKE_MESSAGE_INDENT -1) - try_compile(HAS_GRPC_127 ${CMAKE_CURRENT_BINARY_DIR}/try_compile SOURCES - "${CMAKE_CURRENT_SOURCE_DIR}/try_compile/check_tls_opts_127.cc" - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CURRENT_INCLUDE_DIRECTORIES}" - OUTPUT_VARIABLE TSL_CREDENTIALS_OPTIONS_CHECK_OUTPUT CXX_STANDARD 11) + try_compile( + HAS_GRPC_127 ${CMAKE_CURRENT_BINARY_DIR}/try_compile + SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/try_compile/check_tls_opts_127.cc" + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CURRENT_INCLUDE_DIRECTORIES}" + OUTPUT_VARIABLE TSL_CREDENTIALS_OPTIONS_CHECK_OUTPUT CXX_STANDARD 11) if(HAS_GRPC_127) message(STATUS "TlsCredentialsOptions found in grpc_impl::experimental.") @@ -127,27 +130,28 @@ set(ARROW_FLIGHT_SRCS server_auth.cc types.cc) -add_arrow_lib(arrow_flight - CMAKE_PACKAGE_NAME - ArrowFlight - PKG_CONFIG_NAME - arrow-flight - OUTPUTS - ARROW_FLIGHT_LIBRARIES - SOURCES - ${ARROW_FLIGHT_SRCS} - PRECOMPILED_HEADERS - "$<$:arrow/flight/pch.h>" - DEPENDENCIES - flight_grpc_gen - SHARED_LINK_FLAGS - ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt - SHARED_LINK_LIBS - arrow_shared - ${ARROW_FLIGHT_STATIC_LINK_LIBS} - STATIC_LINK_LIBS - arrow_static - ${ARROW_FLIGHT_STATIC_LINK_LIBS}) +add_arrow_lib( + arrow_flight + CMAKE_PACKAGE_NAME + ArrowFlight + PKG_CONFIG_NAME + arrow-flight + OUTPUTS + ARROW_FLIGHT_LIBRARIES + SOURCES + ${ARROW_FLIGHT_SRCS} + PRECOMPILED_HEADERS + "$<$:arrow/flight/pch.h>" + DEPENDENCIES + flight_grpc_gen + SHARED_LINK_FLAGS + ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt + SHARED_LINK_LIBS + arrow_shared + ${ARROW_FLIGHT_STATIC_LINK_LIBS} + STATIC_LINK_LIBS + arrow_static + ${ARROW_FLIGHT_STATIC_LINK_LIBS}) foreach(LIB_TARGET ${ARROW_FLIGHT_LIBRARIES}) target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_EXPORTING) @@ -155,42 +159,41 @@ endforeach() # Define arrow_flight_testing library if(ARROW_TESTING) - add_arrow_lib(arrow_flight_testing - CMAKE_PACKAGE_NAME - ArrowFlightTesting - PKG_CONFIG_NAME - arrow-flight-testing - OUTPUTS - ARROW_FLIGHT_TESTING_LIBRARIES - SOURCES - test_integration.cc - test_util.cc - DEPENDENCIES - GTest::gtest - flight_grpc_gen - arrow_dependencies - SHARED_LINK_LIBS - arrow_shared - arrow_flight_shared - arrow_testing_shared - ${BOOST_FILESYSTEM_LIBRARY} - ${BOOST_SYSTEM_LIBRARY} - GTest::gtest - STATIC_LINK_LIBS - arrow_static - arrow_flight_static - arrow_testing_static) + add_arrow_lib( + arrow_flight_testing + CMAKE_PACKAGE_NAME + ArrowFlightTesting + PKG_CONFIG_NAME + arrow-flight-testing + OUTPUTS + ARROW_FLIGHT_TESTING_LIBRARIES + SOURCES + test_integration.cc + test_util.cc + DEPENDENCIES + GTest::gtest + flight_grpc_gen + arrow_dependencies + SHARED_LINK_LIBS + arrow_shared + arrow_flight_shared + arrow_testing_shared + ${BOOST_FILESYSTEM_LIBRARY} + ${BOOST_SYSTEM_LIBRARY} + GTest::gtest + STATIC_LINK_LIBS + arrow_static + arrow_flight_static + arrow_testing_static) endif() foreach(LIB_TARGET ${ARROW_FLIGHT_TESTING_LIBRARIES}) - target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_FLIGHT_EXPORTING - ${ARROW_BOOST_PROCESS_COMPILE_DEFINITIONS}) + target_compile_definitions( + ${LIB_TARGET} PRIVATE ARROW_FLIGHT_EXPORTING + ${ARROW_BOOST_PROCESS_COMPILE_DEFINITIONS}) endforeach() -add_arrow_test(flight_test - STATIC_LINK_LIBS - ${ARROW_FLIGHT_TEST_LINK_LIBS} - LABELS +add_arrow_test(flight_test STATIC_LINK_LIBS ${ARROW_FLIGHT_TEST_LINK_LIBS} LABELS "arrow_flight") # Build test server for unit tests or benchmarks @@ -226,10 +229,11 @@ if(ARROW_BUILD_BENCHMARKS) set(PERF_PROTO_GENERATED_FILES "${CMAKE_CURRENT_BINARY_DIR}/perf.pb.cc" "${CMAKE_CURRENT_BINARY_DIR}/perf.pb.h") - add_custom_command(OUTPUT ${PERF_PROTO_GENERATED_FILES} - COMMAND ${ARROW_PROTOBUF_PROTOC} "-I${CMAKE_CURRENT_SOURCE_DIR}" - "--cpp_out=${CMAKE_CURRENT_BINARY_DIR}" "perf.proto" - DEPENDS ${PROTO_DEPENDS}) + add_custom_command( + OUTPUT ${PERF_PROTO_GENERATED_FILES} + COMMAND ${ARROW_PROTOBUF_PROTOC} "-I${CMAKE_CURRENT_SOURCE_DIR}" + "--cpp_out=${CMAKE_CURRENT_BINARY_DIR}" "perf.proto" + DEPENDS ${PROTO_DEPENDS}) add_executable(arrow-flight-perf-server perf_server.cc perf.pb.cc) target_link_libraries(arrow-flight-perf-server ${ARROW_FLIGHT_TEST_LINK_LIBS} diff --git a/cpp/src/arrow/gpu/CMakeLists.txt b/cpp/src/arrow/gpu/CMakeLists.txt index a31b4be6ed1d7..3bfbfbf72ac37 100644 --- a/cpp/src/arrow/gpu/CMakeLists.txt +++ b/cpp/src/arrow/gpu/CMakeLists.txt @@ -38,22 +38,24 @@ set(ARROW_CUDA_SRCS cuda_arrow_ipc.cc cuda_context.cc cuda_internal.cc cuda_memo set(ARROW_CUDA_SHARED_LINK_LIBS ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) -add_arrow_lib(arrow_cuda - CMAKE_PACKAGE_NAME - ArrowCUDA - PKG_CONFIG_NAME - arrow-cuda - SOURCES - ${ARROW_CUDA_SRCS} - OUTPUTS - ARROW_CUDA_LIBRARIES - SHARED_LINK_FLAGS - ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt - SHARED_LINK_LIBS - arrow_shared - ${ARROW_CUDA_SHARED_LINK_LIBS} - # Static arrow_cuda must also link against CUDA shared libs - STATIC_LINK_LIBS ${ARROW_CUDA_SHARED_LINK_LIBS}) +add_arrow_lib( + arrow_cuda + CMAKE_PACKAGE_NAME + ArrowCUDA + PKG_CONFIG_NAME + arrow-cuda + SOURCES + ${ARROW_CUDA_SRCS} + OUTPUTS + ARROW_CUDA_LIBRARIES + SHARED_LINK_FLAGS + ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt + SHARED_LINK_LIBS + arrow_shared + ${ARROW_CUDA_SHARED_LINK_LIBS} + # Static arrow_cuda must also link against CUDA shared libs + STATIC_LINK_LIBS + ${ARROW_CUDA_SHARED_LINK_LIBS}) add_dependencies(arrow_cuda ${ARROW_CUDA_LIBRARIES}) diff --git a/cpp/src/arrow/ipc/CMakeLists.txt b/cpp/src/arrow/ipc/CMakeLists.txt index 335a858dc35fc..d39f14eba1eba 100644 --- a/cpp/src/arrow/ipc/CMakeLists.txt +++ b/cpp/src/arrow/ipc/CMakeLists.txt @@ -24,10 +24,7 @@ function(ADD_ARROW_IPC_TEST REL_TEST_NAME) set(options) set(one_value_args PREFIX) set(multi_value_args LABELS) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_PREFIX) @@ -36,12 +33,8 @@ function(ADD_ARROW_IPC_TEST REL_TEST_NAME) set(PREFIX "arrow-ipc") endif() - add_arrow_test(${REL_TEST_NAME} - EXTRA_LINK_LIBS - ${ARROW_DATASET_TEST_LINK_LIBS} - PREFIX - ${PREFIX} - ${ARG_UNPARSED_ARGUMENTS}) + add_arrow_test(${REL_TEST_NAME} EXTRA_LINK_LIBS ${ARROW_DATASET_TEST_LINK_LIBS} PREFIX + ${PREFIX} ${ARG_UNPARSED_ARGUMENTS}) endfunction() add_arrow_test(feather_test) diff --git a/cpp/src/arrow/json/CMakeLists.txt b/cpp/src/arrow/json/CMakeLists.txt index 5f26a2e1ebd2f..1a1c6fadc7544 100644 --- a/cpp/src/arrow/json/CMakeLists.txt +++ b/cpp/src/arrow/json/CMakeLists.txt @@ -15,14 +15,15 @@ # specific language governing permissions and limitations # under the License. -add_arrow_test(test - SOURCES - chunker_test.cc - converter_test.cc - parser_test.cc - reader_test.cc - PREFIX - "arrow-json") +add_arrow_test( + test + SOURCES + chunker_test.cc + converter_test.cc + parser_test.cc + reader_test.cc + PREFIX + "arrow-json") add_arrow_benchmark(parser_benchmark PREFIX "arrow-json") arrow_install_all_headers("arrow/json") diff --git a/cpp/src/arrow/python/CMakeLists.txt b/cpp/src/arrow/python/CMakeLists.txt index 960155703e1ed..ca9879a5da355 100644 --- a/cpp/src/arrow/python/CMakeLists.txt +++ b/cpp/src/arrow/python/CMakeLists.txt @@ -45,12 +45,8 @@ set(ARROW_PYTHON_SRCS pyarrow.cc serialize.cc) -set_source_files_properties(init.cc - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - SKIP_UNITY_BUILD_INCLUSION - ON) +set_source_files_properties(init.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON + SKIP_UNITY_BUILD_INCLUSION ON) if(ARROW_FILESYSTEM) list(APPEND ARROW_PYTHON_SRCS filesystem.cc) @@ -59,7 +55,10 @@ endif() set(ARROW_PYTHON_DEPENDENCIES arrow_dependencies) 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 ") + set_property( + SOURCE pyarrow.cc + APPEND_STRING + PROPERTY COMPILE_FLAGS " -Wno-cast-qual ") endif() set(ARROW_PYTHON_SHARED_LINK_LIBS arrow_shared) @@ -69,27 +68,28 @@ endif() set(ARROW_PYTHON_INCLUDES ${NUMPY_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}) -add_arrow_lib(arrow_python - CMAKE_PACKAGE_NAME - ArrowPython - PKG_CONFIG_NAME - arrow-python - SOURCES - ${ARROW_PYTHON_SRCS} - PRECOMPILED_HEADERS - "$<$:arrow/python/pch.h>" - OUTPUTS - ARROW_PYTHON_LIBRARIES - DEPENDENCIES - ${ARROW_PYTHON_DEPENDENCIES} - SHARED_LINK_FLAGS - ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt - SHARED_LINK_LIBS - ${ARROW_PYTHON_SHARED_LINK_LIBS} - STATIC_LINK_LIBS - ${PYTHON_OTHER_LIBS} - EXTRA_INCLUDES - "${ARROW_PYTHON_INCLUDES}") +add_arrow_lib( + arrow_python + CMAKE_PACKAGE_NAME + ArrowPython + PKG_CONFIG_NAME + arrow-python + SOURCES + ${ARROW_PYTHON_SRCS} + PRECOMPILED_HEADERS + "$<$:arrow/python/pch.h>" + OUTPUTS + ARROW_PYTHON_LIBRARIES + DEPENDENCIES + ${ARROW_PYTHON_DEPENDENCIES} + SHARED_LINK_FLAGS + ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt + SHARED_LINK_LIBS + ${ARROW_PYTHON_SHARED_LINK_LIBS} + STATIC_LINK_LIBS + ${PYTHON_OTHER_LIBS} + EXTRA_INCLUDES + "${ARROW_PYTHON_INCLUDES}") add_dependencies(arrow_python ${ARROW_PYTHON_LIBRARIES}) @@ -107,26 +107,27 @@ if(ARROW_FLIGHT AND ARROW_BUILD_SHARED) # fail with weird errors due to multiple copies of global static state (The # other solution is to link gRPC shared everywhere instead of statically only # in Flight) - add_arrow_lib(arrow_python_flight - CMAKE_PACKAGE_NAME - ArrowPythonFlight - PKG_CONFIG_NAME - arrow-python-flight - SOURCES - flight.cc - OUTPUTS - ARROW_PYFLIGHT_LIBRARIES - DEPENDENCIES - flight_grpc_gen - SHARED_LINK_FLAGS - ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt - SHARED_LINK_LIBS - arrow_python_shared - arrow_flight_shared - STATIC_LINK_LIBS - ${PYTHON_OTHER_LIBS} - EXTRA_INCLUDES - "${ARROW_PYTHON_INCLUDES}") + add_arrow_lib( + arrow_python_flight + CMAKE_PACKAGE_NAME + ArrowPythonFlight + PKG_CONFIG_NAME + arrow-python-flight + SOURCES + flight.cc + OUTPUTS + ARROW_PYFLIGHT_LIBRARIES + DEPENDENCIES + flight_grpc_gen + SHARED_LINK_FLAGS + ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt + SHARED_LINK_LIBS + arrow_python_shared + arrow_flight_shared + STATIC_LINK_LIBS + ${PYTHON_OTHER_LIBS} + EXTRA_INCLUDES + "${ARROW_PYTHON_INCLUDES}") add_dependencies(arrow_python ${ARROW_PYFLIGHT_LIBRARIES}) @@ -141,9 +142,10 @@ endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # Clang, be quiet. Python C API has lots of macros - set_property(SOURCE ${ARROW_PYTHON_SRCS} - APPEND_STRING - PROPERTY COMPILE_FLAGS -Wno-parentheses-equality) + set_property( + SOURCE ${ARROW_PYTHON_SRCS} + APPEND_STRING + PROPERTY COMPILE_FLAGS -Wno-parentheses-equality) endif() arrow_install_all_headers("arrow/python") @@ -159,8 +161,8 @@ if(ARROW_BUILD_TESTS) if(APPLE) target_link_libraries(arrow_python_test_main ${CMAKE_DL_LIBS}) - set_target_properties(arrow_python_test_main - PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + set_target_properties(arrow_python_test_main PROPERTIES LINK_FLAGS + "-undefined dynamic_lookup") elseif(NOT MSVC) target_link_libraries(arrow_python_test_main pthread ${CMAKE_DL_LIBS}) endif() @@ -173,14 +175,15 @@ if(ARROW_BUILD_TESTS) arrow_testing_static arrow_static) endif() - add_arrow_test(python_test - STATIC_LINK_LIBS - "${ARROW_PYTHON_TEST_LINK_LIBS}" - EXTRA_LINK_LIBS - ${PYTHON_LIBRARIES} - EXTRA_INCLUDES - "${ARROW_PYTHON_INCLUDES}" - LABELS - "arrow_python-tests" - NO_VALGRIND) + add_arrow_test( + python_test + STATIC_LINK_LIBS + "${ARROW_PYTHON_TEST_LINK_LIBS}" + EXTRA_LINK_LIBS + ${PYTHON_LIBRARIES} + EXTRA_INCLUDES + "${ARROW_PYTHON_INCLUDES}" + LABELS + "arrow_python-tests" + NO_VALGRIND) endif() diff --git a/cpp/src/arrow/python/util/CMakeLists.txt b/cpp/src/arrow/python/util/CMakeLists.txt index c75b622847d84..74141bebc8bf2 100644 --- a/cpp/src/arrow/python/util/CMakeLists.txt +++ b/cpp/src/arrow/python/util/CMakeLists.txt @@ -24,8 +24,8 @@ if(PYARROW_BUILD_TESTS) if(APPLE) target_link_libraries(arrow/python_test_main GTest::gtest dl) - set_target_properties(arrow/python_test_main - PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + set_target_properties(arrow/python_test_main PROPERTIES LINK_FLAGS + "-undefined dynamic_lookup") else() target_link_libraries(arrow/python_test_main GTest::gtest pthread dl) endif() diff --git a/cpp/src/arrow/util/CMakeLists.txt b/cpp/src/arrow/util/CMakeLists.txt index d46894d775d61..160e765c35887 100644 --- a/cpp/src/arrow/util/CMakeLists.txt +++ b/cpp/src/arrow/util/CMakeLists.txt @@ -38,36 +38,34 @@ else() set(IO_UTIL_TEST_SOURCES io_util_test.cc) endif() -add_arrow_test(utility-test - SOURCES - align_util_test.cc - bit_block_counter_test.cc - bit_util_test.cc - checked_cast_test.cc - compression_test.cc - decimal_test.cc - formatting_util_test.cc - key_value_metadata_test.cc - hashing_test.cc - int_util_test.cc - ${IO_UTIL_TEST_SOURCES} - iterator_test.cc - logging_test.cc - range_test.cc - rle_encoding_test.cc - stl_util_test.cc - string_test.cc - time_test.cc - trie_test.cc - uri_test.cc - utf8_util_test.cc - value_parsing_test.cc - variant_test.cc) +add_arrow_test( + utility-test + SOURCES + align_util_test.cc + bit_block_counter_test.cc + bit_util_test.cc + checked_cast_test.cc + compression_test.cc + decimal_test.cc + formatting_util_test.cc + key_value_metadata_test.cc + hashing_test.cc + int_util_test.cc + ${IO_UTIL_TEST_SOURCES} + iterator_test.cc + logging_test.cc + range_test.cc + rle_encoding_test.cc + stl_util_test.cc + string_test.cc + time_test.cc + trie_test.cc + uri_test.cc + utf8_util_test.cc + value_parsing_test.cc + variant_test.cc) -add_arrow_test(threading-utility-test - SOURCES - future_test - task_group_test +add_arrow_test(threading-utility-test SOURCES future_test task_group_test thread_pool_test) add_arrow_benchmark(bit_block_counter_benchmark) diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt index 8a19ee5853f1d..21bc5e62a6855 100644 --- a/cpp/src/gandiva/CMakeLists.txt +++ b/cpp/src/gandiva/CMakeLists.txt @@ -93,8 +93,8 @@ set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared LLVM::LLVM_INTERFACE) set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_INTERFACE) -if(ARROW_GANDIVA_STATIC_LIBSTDCPP - AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)) +if(ARROW_GANDIVA_STATIC_LIBSTDCPP AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX + )) set(GANDIVA_STATIC_LINK_LIBS ${GANDIVA_STATIC_LINK_LIBS} -static-libstdc++ -static-libgcc) endif() @@ -117,30 +117,31 @@ if(NOT APPLE AND NOT MSVC_TOOLCHAIN) "${GANDIVA_SHARED_LINK_FLAGS} ${GANDIVA_VERSION_SCRIPT_FLAGS}") endif() -add_arrow_lib(gandiva - CMAKE_PACKAGE_NAME - Gandiva - PKG_CONFIG_NAME - gandiva - SOURCES - ${SRC_FILES} - PRECOMPILED_HEADERS - "$<$:gandiva/pch.h>" - OUTPUTS - GANDIVA_LIBRARIES - DEPENDENCIES - arrow_dependencies - precompiled - EXTRA_INCLUDES - $ - SHARED_LINK_FLAGS - ${GANDIVA_SHARED_LINK_FLAGS} - SHARED_LINK_LIBS - arrow_shared - SHARED_PRIVATE_LINK_LIBS - ${GANDIVA_SHARED_PRIVATE_LINK_LIBS} - STATIC_LINK_LIBS - ${GANDIVA_STATIC_LINK_LIBS}) +add_arrow_lib( + gandiva + CMAKE_PACKAGE_NAME + Gandiva + PKG_CONFIG_NAME + gandiva + SOURCES + ${SRC_FILES} + PRECOMPILED_HEADERS + "$<$:gandiva/pch.h>" + OUTPUTS + GANDIVA_LIBRARIES + DEPENDENCIES + arrow_dependencies + precompiled + EXTRA_INCLUDES + $ + SHARED_LINK_FLAGS + ${GANDIVA_SHARED_LINK_FLAGS} + SHARED_LINK_LIBS + arrow_shared + SHARED_PRIVATE_LINK_LIBS + ${GANDIVA_SHARED_PRIVATE_LINK_LIBS} + STATIC_LINK_LIBS + ${GANDIVA_STATIC_LINK_LIBS}) foreach(LIB_TARGET ${GANDIVA_LIBRARIES}) target_compile_definitions(${LIB_TARGET} PRIVATE GANDIVA_EXPORTING) @@ -163,38 +164,24 @@ function(ADD_GANDIVA_TEST REL_TEST_NAME) set(options USE_STATIC_LINKING) set(one_value_args) set(multi_value_args) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(NO_TESTS) return() endif() - set(TEST_ARGUMENTS - ENABLED - PREFIX - "gandiva" - LABELS - "gandiva-tests" - ${ARG_UNPARSED_ARGUMENTS}) + set(TEST_ARGUMENTS ENABLED PREFIX "gandiva" LABELS "gandiva-tests" + ${ARG_UNPARSED_ARGUMENTS}) # and uses less disk space, but in some cases we need to force static # linking (see rationale below). if(ARG_USE_STATIC_LINKING OR ARROW_TEST_LINKAGE STREQUAL "static") - add_test_case(${REL_TEST_NAME} - ${TEST_ARGUMENTS} - STATIC_LINK_LIBS - ${GANDIVA_STATIC_TEST_LINK_LIBS} - ${ARG_UNPARSED_ARGUMENTS}) + add_test_case(${REL_TEST_NAME} ${TEST_ARGUMENTS} STATIC_LINK_LIBS + ${GANDIVA_STATIC_TEST_LINK_LIBS} ${ARG_UNPARSED_ARGUMENTS}) else() - add_test_case(${REL_TEST_NAME} - ${TEST_ARGUMENTS} - STATIC_LINK_LIBS - ${GANDIVA_SHARED_TEST_LINK_LIBS} - ${ARG_UNPARSED_ARGUMENTS}) + add_test_case(${REL_TEST_NAME} ${TEST_ARGUMENTS} STATIC_LINK_LIBS + ${GANDIVA_SHARED_TEST_LINK_LIBS} ${ARG_UNPARSED_ARGUMENTS}) endif() set(TEST_NAME gandiva-${REL_TEST_NAME}) @@ -206,31 +193,32 @@ set(GANDIVA_INTERNALS_TEST_ARGUMENTS) if(WIN32) list(APPEND GANDIVA_INTERNALS_TEST_ARGUMENTS EXTRA_LINK_LIBS LLVM::LLVM_INTERFACE) endif() -add_gandiva_test(internals-test - SOURCES - bitmap_accumulator_test.cc - engine_llvm_test.cc - function_registry_test.cc - function_signature_test.cc - llvm_types_test.cc - llvm_generator_test.cc - annotator_test.cc - tree_expr_test.cc - expr_decomposer_test.cc - expression_registry_test.cc - selection_vector_test.cc - lru_cache_test.cc - to_date_holder_test.cc - simple_arena_test.cc - like_holder_test.cc - decimal_type_util_test.cc - random_generator_holder_test.cc - gdv_function_stubs_test.cc - EXTRA_DEPENDENCIES - LLVM::LLVM_INTERFACE - EXTRA_INCLUDES - $ - ${GANDIVA_INTERNALS_TEST_ARGUMENTS}) +add_gandiva_test( + internals-test + SOURCES + bitmap_accumulator_test.cc + engine_llvm_test.cc + function_registry_test.cc + function_signature_test.cc + llvm_types_test.cc + llvm_generator_test.cc + annotator_test.cc + tree_expr_test.cc + expr_decomposer_test.cc + expression_registry_test.cc + selection_vector_test.cc + lru_cache_test.cc + to_date_holder_test.cc + simple_arena_test.cc + like_holder_test.cc + decimal_type_util_test.cc + random_generator_holder_test.cc + gdv_function_stubs_test.cc + EXTRA_DEPENDENCIES + LLVM::LLVM_INTERFACE + EXTRA_INCLUDES + $ + ${GANDIVA_INTERNALS_TEST_ARGUMENTS}) if(ARROW_GANDIVA_JAVA) add_subdirectory(jni) diff --git a/cpp/src/gandiva/jni/CMakeLists.txt b/cpp/src/gandiva/jni/CMakeLists.txt index b456d5f3def36..ce34d60cbeec9 100644 --- a/cpp/src/gandiva/jni/CMakeLists.txt +++ b/cpp/src/gandiva/jni/CMakeLists.txt @@ -32,19 +32,16 @@ set(PROTO_OUTPUT_FILES ${PROTO_OUTPUT_FILES} "${PROTO_OUTPUT_DIR}/Types.pb.h") set_source_files_properties(${PROTO_OUTPUT_FILES} PROPERTIES GENERATED TRUE) -get_filename_component(ABS_GANDIVA_PROTO ${CMAKE_SOURCE_DIR}/src/gandiva/proto/Types.proto - ABSOLUTE) +get_filename_component(ABS_GANDIVA_PROTO + ${CMAKE_SOURCE_DIR}/src/gandiva/proto/Types.proto ABSOLUTE) -add_custom_command(OUTPUT ${PROTO_OUTPUT_FILES} - COMMAND ${ARROW_PROTOBUF_PROTOC} - --proto_path - ${CMAKE_SOURCE_DIR}/src/gandiva/proto - --cpp_out - ${PROTO_OUTPUT_DIR} - ${CMAKE_SOURCE_DIR}/src/gandiva/proto/Types.proto - DEPENDS ${ABS_GANDIVA_PROTO} ${ARROW_PROTOBUF_LIBPROTOBUF} - COMMENT "Running PROTO compiler on Types.proto" - VERBATIM) +add_custom_command( + OUTPUT ${PROTO_OUTPUT_FILES} + COMMAND ${ARROW_PROTOBUF_PROTOC} --proto_path ${CMAKE_SOURCE_DIR}/src/gandiva/proto + --cpp_out ${PROTO_OUTPUT_DIR} ${CMAKE_SOURCE_DIR}/src/gandiva/proto/Types.proto + DEPENDS ${ABS_GANDIVA_PROTO} ${ARROW_PROTOBUF_LIBPROTOBUF} + COMMENT "Running PROTO compiler on Types.proto" + VERBATIM) add_custom_target(gandiva_jni_proto ALL DEPENDS ${PROTO_OUTPUT_FILES}) set(PROTO_SRCS "${PROTO_OUTPUT_DIR}/Types.pb.cc") @@ -61,39 +58,36 @@ else() list(APPEND GANDIVA_LINK_LIBS gandiva_shared) endif() -set(GANDIVA_JNI_SOURCES - config_builder.cc - config_holder.cc - expression_registry_helper.cc - jni_common.cc - ${PROTO_SRCS}) +set(GANDIVA_JNI_SOURCES config_builder.cc config_holder.cc expression_registry_helper.cc + jni_common.cc ${PROTO_SRCS}) # For users of gandiva_jni library (including integ tests), include-dir is : # /usr/**/include dir after install, # cpp/include during build # For building gandiva_jni library itself, include-dir (in addition to above) is : # cpp/src -add_arrow_lib(gandiva_jni - SOURCES - ${GANDIVA_JNI_SOURCES} - OUTPUTS - GANDIVA_JNI_LIBRARIES - SHARED_PRIVATE_LINK_LIBS - ${GANDIVA_LINK_LIBS} - STATIC_LINK_LIBS - ${GANDIVA_LINK_LIBS} - DEPENDENCIES - ${GANDIVA_LINK_LIBS} - gandiva_java - gandiva_jni_headers - gandiva_jni_proto - EXTRA_INCLUDES - $ - $ - $ - PRIVATE_INCLUDES - ${JNI_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR}) +add_arrow_lib( + gandiva_jni + SOURCES + ${GANDIVA_JNI_SOURCES} + OUTPUTS + GANDIVA_JNI_LIBRARIES + SHARED_PRIVATE_LINK_LIBS + ${GANDIVA_LINK_LIBS} + STATIC_LINK_LIBS + ${GANDIVA_LINK_LIBS} + DEPENDENCIES + ${GANDIVA_LINK_LIBS} + gandiva_java + gandiva_jni_headers + gandiva_jni_proto + EXTRA_INCLUDES + $ + $ + $ + PRIVATE_INCLUDES + ${JNI_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR}) add_dependencies(gandiva ${GANDIVA_JNI_LIBRARIES}) diff --git a/cpp/src/gandiva/precompiled/CMakeLists.txt b/cpp/src/gandiva/precompiled/CMakeLists.txt index 7343bc052c447..a7c478c412678 100644 --- a/cpp/src/gandiva/precompiled/CMakeLists.txt +++ b/cpp/src/gandiva/precompiled/CMakeLists.txt @@ -53,91 +53,89 @@ foreach(SRC_FILE ${PRECOMPILED_SRCS}) set(BC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${SRC_BASE}.bc) set(PRECOMPILE_COMMAND) if(CMAKE_OSX_SYSROOT) - list(APPEND PRECOMPILE_COMMAND - ${CMAKE_COMMAND} - -E - env - SDKROOT=${CMAKE_OSX_SYSROOT}) + list(APPEND PRECOMPILE_COMMAND ${CMAKE_COMMAND} -E env SDKROOT=${CMAKE_OSX_SYSROOT}) endif() list( - APPEND PRECOMPILE_COMMAND - ${CLANG_EXECUTABLE} - ${PLATFORM_CLANG_OPTIONS} - -DGANDIVA_IR - -DNDEBUG # DCHECK macros not implemented in precompiled code - -DARROW_STATIC # Do not set __declspec(dllimport) on MSVC on Arrow symbols - -DGANDIVA_STATIC # Do not set __declspec(dllimport) on MSVC on Gandiva symbols - -fno-use-cxa-atexit # Workaround for unresolved __dso_handle - -emit-llvm - -O3 - -c - ${ABSOLUTE_SRC} - -o - ${BC_FILE} - ${ARROW_GANDIVA_PC_CXX_FLAGS} - -I${CMAKE_SOURCE_DIR}/src - -I${ARROW_BINARY_DIR}/src) + APPEND + PRECOMPILE_COMMAND + ${CLANG_EXECUTABLE} + ${PLATFORM_CLANG_OPTIONS} + -DGANDIVA_IR + -DNDEBUG # DCHECK macros not implemented in precompiled code + -DARROW_STATIC # Do not set __declspec(dllimport) on MSVC on Arrow symbols + -DGANDIVA_STATIC # Do not set __declspec(dllimport) on MSVC on Gandiva symbols + -fno-use-cxa-atexit # Workaround for unresolved __dso_handle + -emit-llvm + -O3 + -c + ${ABSOLUTE_SRC} + -o + ${BC_FILE} + ${ARROW_GANDIVA_PC_CXX_FLAGS} + -I${CMAKE_SOURCE_DIR}/src + -I${ARROW_BINARY_DIR}/src) if(NOT ARROW_USE_NATIVE_INT128) list(APPEND PRECOMPILE_COMMAND -I${Boost_INCLUDE_DIR}) endif() - add_custom_command(OUTPUT ${BC_FILE} COMMAND ${PRECOMPILE_COMMAND} DEPENDS ${SRC_FILE}) + add_custom_command( + OUTPUT ${BC_FILE} + COMMAND ${PRECOMPILE_COMMAND} + DEPENDS ${SRC_FILE}) list(APPEND BC_FILES ${BC_FILE}) endforeach() # link all of the bitcode files into a single bitcode file. -add_custom_command(OUTPUT ${GANDIVA_PRECOMPILED_BC_PATH} - COMMAND ${LLVM_LINK_EXECUTABLE} -o ${GANDIVA_PRECOMPILED_BC_PATH} - ${BC_FILES} - DEPENDS ${BC_FILES}) +add_custom_command( + OUTPUT ${GANDIVA_PRECOMPILED_BC_PATH} + COMMAND ${LLVM_LINK_EXECUTABLE} -o ${GANDIVA_PRECOMPILED_BC_PATH} ${BC_FILES} + DEPENDS ${BC_FILES}) # turn the bitcode file into a C++ static data variable. -add_custom_command(OUTPUT ${GANDIVA_PRECOMPILED_CC_PATH} - COMMAND ${PYTHON_EXECUTABLE} - "${CMAKE_CURRENT_SOURCE_DIR}/../make_precompiled_bitcode.py" - ${GANDIVA_PRECOMPILED_CC_IN_PATH} - ${GANDIVA_PRECOMPILED_BC_PATH} - ${GANDIVA_PRECOMPILED_CC_PATH} - DEPENDS ${GANDIVA_PRECOMPILED_CC_IN_PATH} - ${GANDIVA_PRECOMPILED_BC_PATH}) +add_custom_command( + OUTPUT ${GANDIVA_PRECOMPILED_CC_PATH} + COMMAND + ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/../make_precompiled_bitcode.py" + ${GANDIVA_PRECOMPILED_CC_IN_PATH} ${GANDIVA_PRECOMPILED_BC_PATH} + ${GANDIVA_PRECOMPILED_CC_PATH} + DEPENDS ${GANDIVA_PRECOMPILED_CC_IN_PATH} ${GANDIVA_PRECOMPILED_BC_PATH}) -add_custom_target(precompiled ALL - DEPENDS ${GANDIVA_PRECOMPILED_BC_PATH} ${GANDIVA_PRECOMPILED_CC_PATH}) +add_custom_target(precompiled ALL DEPENDS ${GANDIVA_PRECOMPILED_BC_PATH} + ${GANDIVA_PRECOMPILED_CC_PATH}) # testing if(ARROW_BUILD_TESTS) - add_executable(gandiva-precompiled-test - ../context_helper.cc - bitmap_test.cc - bitmap.cc - epoch_time_point_test.cc - time_test.cc - time.cc - timestamp_arithmetic.cc - ../cast_time.cc - ../../arrow/vendored/datetime/tz.cpp - hash_test.cc - hash.cc - string_ops_test.cc - string_ops.cc - arithmetic_ops_test.cc - arithmetic_ops.cc - extended_math_ops_test.cc - extended_math_ops.cc - decimal_ops_test.cc - decimal_ops.cc - ../decimal_type_util.cc - ../decimal_xlarge.cc) + add_executable( + gandiva-precompiled-test + ../context_helper.cc + bitmap_test.cc + bitmap.cc + epoch_time_point_test.cc + time_test.cc + time.cc + timestamp_arithmetic.cc + ../cast_time.cc + ../../arrow/vendored/datetime/tz.cpp + hash_test.cc + hash.cc + string_ops_test.cc + string_ops.cc + arithmetic_ops_test.cc + arithmetic_ops.cc + extended_math_ops_test.cc + extended_math_ops.cc + decimal_ops_test.cc + decimal_ops.cc + ../decimal_type_util.cc + ../decimal_xlarge.cc) target_include_directories(gandiva-precompiled-test PRIVATE ${CMAKE_SOURCE_DIR}/src) target_link_libraries(gandiva-precompiled-test PRIVATE ${ARROW_TEST_LINK_LIBS}) - target_compile_definitions(gandiva-precompiled-test - PRIVATE - GANDIVA_UNIT_TEST=1 - ARROW_STATIC - GANDIVA_STATIC) + target_compile_definitions(gandiva-precompiled-test PRIVATE GANDIVA_UNIT_TEST=1 + ARROW_STATIC GANDIVA_STATIC) set(TEST_PATH "${EXECUTABLE_OUTPUT_PATH}/gandiva-precompiled-test") add_test(gandiva-precompiled-test ${TEST_PATH}) - set_property(TEST gandiva-precompiled-test - APPEND - PROPERTY LABELS "unittest;gandiva-tests") + set_property( + TEST gandiva-precompiled-test + APPEND + PROPERTY LABELS "unittest;gandiva-tests") add_dependencies(gandiva-tests gandiva-precompiled-test) endif() diff --git a/cpp/src/gandiva/tests/CMakeLists.txt b/cpp/src/gandiva/tests/CMakeLists.txt index 5fa2da16c632f..4139f78bf922c 100644 --- a/cpp/src/gandiva/tests/CMakeLists.txt +++ b/cpp/src/gandiva/tests/CMakeLists.txt @@ -34,9 +34,5 @@ add_gandiva_test(filter_project_test) if(ARROW_BUILD_STATIC) add_gandiva_test(projector_test_static SOURCES projector_test.cc USE_STATIC_LINKING) - add_arrow_benchmark(micro_benchmarks - PREFIX - "gandiva" - EXTRA_LINK_LIBS - gandiva_static) + add_arrow_benchmark(micro_benchmarks PREFIX "gandiva" EXTRA_LINK_LIBS gandiva_static) endif() diff --git a/cpp/src/jni/orc/CMakeLists.txt b/cpp/src/jni/orc/CMakeLists.txt index eceda52949470..d8e6de5c14284 100644 --- a/cpp/src/jni/orc/CMakeLists.txt +++ b/cpp/src/jni/orc/CMakeLists.txt @@ -31,23 +31,24 @@ set(JNI_HEADERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") add_subdirectory(../../../../java/adapter/orc ./java) -add_arrow_lib(arrow_orc_jni - BUILD_SHARED - ON - BUILD_STATIC - OFF - SOURCES - jni_wrapper.cpp - OUTPUTS - ARROW_ORC_JNI_LIBRARIES - SHARED_PRIVATE_LINK_LIBS - arrow_static - EXTRA_INCLUDES - ${JNI_HEADERS_DIR} - PRIVATE_INCLUDES - ${JNI_INCLUDE_DIRS} - DEPENDENCIES - arrow_static - arrow_orc_java) +add_arrow_lib( + arrow_orc_jni + BUILD_SHARED + ON + BUILD_STATIC + OFF + SOURCES + jni_wrapper.cpp + OUTPUTS + ARROW_ORC_JNI_LIBRARIES + SHARED_PRIVATE_LINK_LIBS + arrow_static + EXTRA_INCLUDES + ${JNI_HEADERS_DIR} + PRIVATE_INCLUDES + ${JNI_INCLUDE_DIRS} + DEPENDENCIES + arrow_static + arrow_orc_java) add_dependencies(arrow_orc_jni ${ARROW_ORC_JNI_LIBRARIES}) diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt index 03443b282f29e..d9bb2b1b76fe5 100644 --- a/cpp/src/parquet/CMakeLists.txt +++ b/cpp/src/parquet/CMakeLists.txt @@ -27,41 +27,31 @@ string(REGEX MATCH "^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)" VERSION ${PARQUET_VERS if(NOT VERSION) message(FATAL_ERROR "invalid .parquetcppversion") endif() -set(PARQUET_VERSION "${PARQUET_VERSION}" PARENT_SCOPE) - -string(REGEX - REPLACE "^([0-9]+)\.[0-9]+\.[0-9]+(-.+)?$" "\\1" PARQUET_VERSION_MAJOR - "${PARQUET_VERSION}") -string(REGEX - REPLACE "^[0-9]+\.([0-9]+)\.[0-9]+(-.+)?$" "\\1" PARQUET_VERSION_MINOR - "${PARQUET_VERSION}") -string(REGEX - REPLACE "^[0-9]+\.[0-9]+\.([0-9]+)(-.+)?$" "\\1" PARQUET_VERSION_PATCH - "${PARQUET_VERSION}") +set(PARQUET_VERSION + "${PARQUET_VERSION}" + PARENT_SCOPE) + +string(REGEX REPLACE "^([0-9]+)\.[0-9]+\.[0-9]+(-.+)?$" "\\1" PARQUET_VERSION_MAJOR + "${PARQUET_VERSION}") +string(REGEX REPLACE "^[0-9]+\.([0-9]+)\.[0-9]+(-.+)?$" "\\1" PARQUET_VERSION_MINOR + "${PARQUET_VERSION}") +string(REGEX REPLACE "^[0-9]+\.[0-9]+\.([0-9]+)(-.+)?$" "\\1" PARQUET_VERSION_PATCH + "${PARQUET_VERSION}") function(ADD_PARQUET_TEST REL_TEST_NAME) set(one_value_args) set(multi_value_args EXTRA_DEPENDENCIES LABELS) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) set(TEST_ARGUMENTS PREFIX "parquet" LABELS "parquet-tests") if(ARROW_TEST_LINKAGE STREQUAL "static") - add_test_case(${REL_TEST_NAME} - STATIC_LINK_LIBS - ${PARQUET_STATIC_TEST_LINK_LIBS} - ${TEST_ARGUMENTS} - ${ARG_UNPARSED_ARGUMENTS}) + add_test_case(${REL_TEST_NAME} STATIC_LINK_LIBS ${PARQUET_STATIC_TEST_LINK_LIBS} + ${TEST_ARGUMENTS} ${ARG_UNPARSED_ARGUMENTS}) else() - add_test_case(${REL_TEST_NAME} - STATIC_LINK_LIBS - ${PARQUET_SHARED_TEST_LINK_LIBS} - ${TEST_ARGUMENTS} - ${ARG_UNPARSED_ARGUMENTS}) + add_test_case(${REL_TEST_NAME} STATIC_LINK_LIBS ${PARQUET_SHARED_TEST_LINK_LIBS} + ${TEST_ARGUMENTS} ${ARG_UNPARSED_ARGUMENTS}) endif() endfunction() @@ -69,10 +59,7 @@ function(ADD_PARQUET_FUZZ_TARGET REL_FUZZING_NAME) set(options) set(one_value_args PREFIX) set(multi_value_args) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_PREFIX) @@ -86,11 +73,7 @@ function(ADD_PARQUET_FUZZ_TARGET REL_FUZZING_NAME) else() set(LINK_LIBS parquet_shared) endif() - add_fuzz_target(${REL_FUZZING_NAME} - PREFIX - ${PREFIX} - LINK_LIBS - ${LINK_LIBS} + add_fuzz_target(${REL_FUZZING_NAME} PREFIX ${PREFIX} LINK_LIBS ${LINK_LIBS} ${ARG_UNPARSED_ARGUMENTS}) endfunction() @@ -98,23 +81,21 @@ function(ADD_PARQUET_BENCHMARK REL_TEST_NAME) set(options) set(one_value_args PREFIX) set(multi_value_args) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_PREFIX) set(PREFIX ${ARG_PREFIX}) else() set(PREFIX "parquet") endif() - add_benchmark(${REL_TEST_NAME} - PREFIX - ${PREFIX} - LABELS - "parquet-benchmarks" - ${PARQUET_BENCHMARK_LINK_OPTION} - ${ARG_UNPARSED_ARGUMENTS}) + add_benchmark( + ${REL_TEST_NAME} + PREFIX + ${PREFIX} + LABELS + "parquet-benchmarks" + ${PARQUET_BENCHMARK_LINK_OPTION} + ${ARG_UNPARSED_ARGUMENTS}) endfunction() # ---------------------------------------------------------------------- @@ -152,19 +133,14 @@ set(PARQUET_STATIC_TEST_LINK_LIBS ${PARQUET_MIN_TEST_LIBS} parquet_static thrift # # Generated Thrift sources -set_source_files_properties(src/generated/parquet_types.cpp - src/generated/parquet_types.h - src/generated/parquet_constants.cpp - src/generated/parquet_constants.h - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - SKIP_UNITY_BUILD_INCLUSION - ON) +set_source_files_properties( + src/generated/parquet_types.cpp src/generated/parquet_types.h + src/generated/parquet_constants.cpp src/generated/parquet_constants.h + PROPERTIES SKIP_PRECOMPILE_HEADERS ON SKIP_UNITY_BUILD_INCLUSION ON) if(NOT MSVC) - set_source_files_properties(src/parquet/parquet_types.cpp PROPERTIES COMPILE_FLAGS - -Wno-unused-variable) + set_source_files_properties(src/parquet/parquet_types.cpp + PROPERTIES COMPILE_FLAGS -Wno-unused-variable) endif() # @@ -207,22 +183,17 @@ set(PARQUET_SRCS if(ARROW_HAVE_RUNTIME_AVX2) # AVX2 is used as a proxy for BMI2. list(APPEND PARQUET_SRCS level_comparison_avx2.cc level_conversion_bmi2.cc) - set_source_files_properties(level_comparison_avx2.cc - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - COMPILE_FLAGS - "${ARROW_AVX2_FLAG}") + set_source_files_properties( + level_comparison_avx2.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON COMPILE_FLAGS + "${ARROW_AVX2_FLAG}") # WARNING: DO NOT BLINDLY COPY THIS CODE FOR OTHER BMI2 USE CASES. # This code is always guarded by runtime dispatch which verifies # BMI2 is present. For a very small number of CPUs AVX2 does not # imply BMI2. - set_source_files_properties(level_conversion_bmi2.cc - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - COMPILE_FLAGS - "${ARROW_AVX2_FLAG} -DARROW_HAVE_BMI2 -mbmi2") + set_source_files_properties( + level_conversion_bmi2.cc + PROPERTIES SKIP_PRECOMPILE_HEADERS ON COMPILE_FLAGS + "${ARROW_AVX2_FLAG} -DARROW_HAVE_BMI2 -mbmi2") endif() if(PARQUET_REQUIRE_ENCRYPTION) @@ -264,32 +235,33 @@ if(NOT APPLE AND NOT MSVC_TOOLCHAIN) "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map") endif() -add_arrow_lib(parquet - CMAKE_PACKAGE_NAME - Parquet - PKG_CONFIG_NAME - parquet - SOURCES - ${PARQUET_SRCS} - PRECOMPILED_HEADERS - "$<$:parquet/pch.h>" - OUTPUTS - PARQUET_LIBRARIES - DEPENDENCIES - ${PARQUET_DEPENDENCIES} - SHARED_LINK_FLAGS - ${PARQUET_SHARED_LINK_FLAGS} - SHARED_LINK_LIBS - ${PARQUET_SHARED_LINK_LIBS} - SHARED_PRIVATE_LINK_LIBS - ${PARQUET_SHARED_PRIVATE_LINK_LIBS} - STATIC_LINK_LIBS - ${PARQUET_STATIC_LINK_LIBS}) +add_arrow_lib( + parquet + CMAKE_PACKAGE_NAME + Parquet + PKG_CONFIG_NAME + parquet + SOURCES + ${PARQUET_SRCS} + PRECOMPILED_HEADERS + "$<$:parquet/pch.h>" + OUTPUTS + PARQUET_LIBRARIES + DEPENDENCIES + ${PARQUET_DEPENDENCIES} + SHARED_LINK_FLAGS + ${PARQUET_SHARED_LINK_FLAGS} + SHARED_LINK_LIBS + ${PARQUET_SHARED_LINK_LIBS} + SHARED_PRIVATE_LINK_LIBS + ${PARQUET_SHARED_PRIVATE_LINK_LIBS} + STATIC_LINK_LIBS + ${PARQUET_STATIC_LINK_LIBS}) if(WIN32 AND NOT (ARROW_TEST_LINKAGE STREQUAL "static")) - add_library(parquet_test_support STATIC - "${ARROW_SOURCE_DIR}/src/generated/parquet_constants.cpp" - "${ARROW_SOURCE_DIR}/src/generated/parquet_types.cpp") + add_library( + parquet_test_support STATIC "${ARROW_SOURCE_DIR}/src/generated/parquet_constants.cpp" + "${ARROW_SOURCE_DIR}/src/generated/parquet_types.cpp") add_dependencies(parquet_test_support thrift::thrift) set(PARQUET_SHARED_TEST_LINK_LIBS ${PARQUET_SHARED_TEST_LINK_LIBS} parquet_test_support) set(PARQUET_LIBRARIES ${PARQUET_LIBRARIES} parquet_test_support) @@ -311,13 +283,11 @@ add_dependencies(parquet ${PARQUET_LIBRARIES} thrift::thrift) # Thrift requires these definitions for some types that we use foreach(LIB_TARGET ${PARQUET_LIBRARIES}) - target_compile_definitions(${LIB_TARGET} - PRIVATE - PARQUET_EXPORTING - PRIVATE - HAVE_INTTYPES_H - PRIVATE - HAVE_NETDB_H) + target_compile_definitions( + ${LIB_TARGET} + PRIVATE PARQUET_EXPORTING + PRIVATE HAVE_INTTYPES_H + PRIVATE HAVE_NETDB_H) if(WIN32) target_compile_definitions(${LIB_TARGET} PRIVATE NOMINMAX) else() @@ -339,60 +309,45 @@ configure_file(parquet_version.h.in "${CMAKE_CURRENT_BINARY_DIR}/parquet_version install(FILES "${CMAKE_CURRENT_BINARY_DIR}/parquet_version.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/parquet") -add_parquet_test(internals-test - SOURCES - bloom_filter_test.cc - deprecated_io_test.cc - properties_test.cc - statistics_test.cc - encoding_test.cc - metadata_test.cc - public_api_test.cc - types_test.cc - test_util.cc) - -set_source_files_properties(public_api_test.cc - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - SKIP_UNITY_BUILD_INCLUSION - ON) - -add_parquet_test(reader_test - SOURCES - column_reader_test.cc - level_conversion_test.cc - column_scanner_test.cc - reader_test.cc - stream_reader_test.cc - test_util.cc) - -add_parquet_test(writer-test - SOURCES - column_writer_test.cc - file_serialize_test.cc - stream_writer_test.cc - test_util.cc) - -add_parquet_test(arrow-test - SOURCES - arrow/arrow_reader_writer_test.cc - arrow/arrow_schema_test.cc - test_util.cc) - -add_parquet_test(arrow-internals-test - SOURCES - arrow/path_internal_test.cc - arrow/reconstruct_internal_test.cc - test_util.cc) +add_parquet_test( + internals-test + SOURCES + bloom_filter_test.cc + deprecated_io_test.cc + properties_test.cc + statistics_test.cc + encoding_test.cc + metadata_test.cc + public_api_test.cc + types_test.cc + test_util.cc) + +set_source_files_properties(public_api_test.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON + SKIP_UNITY_BUILD_INCLUSION ON) + +add_parquet_test( + reader_test + SOURCES + column_reader_test.cc + level_conversion_test.cc + column_scanner_test.cc + reader_test.cc + stream_reader_test.cc + test_util.cc) + +add_parquet_test(writer-test SOURCES column_writer_test.cc file_serialize_test.cc + stream_writer_test.cc test_util.cc) + +add_parquet_test(arrow-test SOURCES arrow/arrow_reader_writer_test.cc + arrow/arrow_schema_test.cc test_util.cc) + +add_parquet_test(arrow-internals-test SOURCES arrow/path_internal_test.cc + arrow/reconstruct_internal_test.cc test_util.cc) if(PARQUET_REQUIRE_ENCRYPTION) - add_parquet_test(encryption-test - SOURCES - encryption_write_configurations_test.cc - encryption_read_configurations_test.cc - encryption_properties_test.cc - test_util.cc) + add_parquet_test( + encryption-test SOURCES encryption_write_configurations_test.cc + encryption_read_configurations_test.cc encryption_properties_test.cc test_util.cc) endif() # Those tests need to use static linking as they access thrift-generated diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt index 8c8523a37d556..43c606aedc234 100644 --- a/cpp/src/plasma/CMakeLists.txt +++ b/cpp/src/plasma/CMakeLists.txt @@ -69,21 +69,22 @@ if(NOT APPLE AND NOT MSVC_TOOLCHAIN) "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map") endif() -add_arrow_lib(plasma - CMAKE_PACKAGE_NAME - Plasma - PKG_CONFIG_NAME - plasma - SOURCES - ${PLASMA_SRCS} - OUTPUTS - PLASMA_LIBRARIES - SHARED_LINK_FLAGS - ${PLASMA_SHARED_LINK_FLAGS} - SHARED_LINK_LIBS - ${PLASMA_LINK_LIBS} - STATIC_LINK_LIBS - ${PLASMA_STATIC_LINK_LIBS}) +add_arrow_lib( + plasma + CMAKE_PACKAGE_NAME + Plasma + PKG_CONFIG_NAME + plasma + SOURCES + ${PLASMA_SRCS} + OUTPUTS + PLASMA_LIBRARIES + SHARED_LINK_FLAGS + ${PLASMA_SHARED_LINK_FLAGS} + SHARED_LINK_LIBS + ${PLASMA_LINK_LIBS} + STATIC_LINK_LIBS + ${PLASMA_STATIC_LINK_LIBS}) add_dependencies(plasma ${PLASMA_LIBRARIES}) @@ -96,16 +97,22 @@ endforeach() set_source_files_properties(dlmalloc.cc PROPERTIES COMPILE_FLAGS "-O3") if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set_property(SOURCE dlmalloc.cc - APPEND_STRING - PROPERTY COMPILE_FLAGS " -Wno-parentheses-equality \ + set_property( + SOURCE dlmalloc.cc + APPEND_STRING + PROPERTY + COMPILE_FLAGS + " -Wno-parentheses-equality \ -Wno-null-pointer-arithmetic \ -Wno-shorten-64-to-32 \ -Wno-unused-macros") endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set_property(SOURCE dlmalloc.cc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-conversion") + set_property( + SOURCE dlmalloc.cc + APPEND_STRING + PROPERTY COMPILE_FLAGS " -Wno-conversion") endif() list(APPEND PLASMA_EXTERNAL_STORE_SOURCES "external_store.cc" "hash_table_store.cc") @@ -128,8 +135,8 @@ if(ARROW_RPATH_ORIGIN) else() set(_lib_install_rpath "\$ORIGIN") endif() - set_target_properties(plasma-store-server - PROPERTIES INSTALL_RPATH ${_lib_install_rpath}) + set_target_properties(plasma-store-server PROPERTIES INSTALL_RPATH + ${_lib_install_rpath}) elseif(APPLE) # With OSX and conda, we need to set the correct RPATH so that dependencies # are found. The installed libraries with conda have an RPATH that matches @@ -137,27 +144,21 @@ elseif(APPLE) # $ENV{CONDA_PREFIX}/lib but our test libraries and executables are not # installed there. if(NOT "$ENV{CONDA_PREFIX}" STREQUAL "" AND APPLE) - set_target_properties(plasma-store-server - PROPERTIES BUILD_WITH_INSTALL_RPATH - TRUE - INSTALL_RPATH_USE_LINK_PATH - TRUE - INSTALL_RPATH - "$ENV{CONDA_PREFIX}/lib") + set_target_properties( + plasma-store-server + PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE + INSTALL_RPATH_USE_LINK_PATH TRUE + INSTALL_RPATH "$ENV{CONDA_PREFIX}/lib") endif() endif() -install(FILES common.h - compat.h - client.h - events.h - test_util.h +install(FILES common.h compat.h client.h events.h test_util.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/plasma") # Plasma store set_target_properties(plasma-store-server PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) -install(TARGETS plasma-store-server ${INSTALL_IS_OPTIONAL} DESTINATION - ${CMAKE_INSTALL_BINDIR}) +install(TARGETS plasma-store-server ${INSTALL_IS_OPTIONAL} + DESTINATION ${CMAKE_INSTALL_BINDIR}) if(ARROW_PLASMA_JAVA_CLIENT) # Plasma java client support @@ -187,11 +188,8 @@ if(ARROW_PLASMA_JAVA_CLIENT) add_library(plasma_java SHARED ${PLASMA_LIBRARY_EXT_java_SRC}) if(APPLE) - target_link_libraries(plasma_java - plasma_shared - ${PLASMA_LINK_LIBS} - "-undefined dynamic_lookup" - ${PTHREAD_LIBRARY}) + target_link_libraries(plasma_java plasma_shared ${PLASMA_LINK_LIBS} + "-undefined dynamic_lookup" ${PTHREAD_LIBRARY}) else(APPLE) target_link_libraries(plasma_java plasma_shared ${PLASMA_LINK_LIBS} ${PTHREAD_LIBRARY}) @@ -206,16 +204,9 @@ function(ADD_PLASMA_TEST REL_TEST_NAME) set(options) set(one_value_args) set(multi_value_args) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) - add_test_case(${REL_TEST_NAME} - PREFIX - "plasma" - LABELS - "plasma-tests" + add_test_case(${REL_TEST_NAME} PREFIX "plasma" LABELS "plasma-tests" ${ARG_UNPARSED_ARGUMENTS}) endfunction() @@ -226,13 +217,7 @@ else() endif() add_plasma_test(test/serialization_tests EXTRA_LINK_LIBS ${PLASMA_TEST_LIBS}) -add_plasma_test(test/client_tests - EXTRA_LINK_LIBS - ${PLASMA_TEST_LIBS} - EXTRA_DEPENDENCIES - plasma-store-server) -add_plasma_test(test/external_store_tests - EXTRA_LINK_LIBS - ${PLASMA_TEST_LIBS} - EXTRA_DEPENDENCIES +add_plasma_test(test/client_tests EXTRA_LINK_LIBS ${PLASMA_TEST_LIBS} EXTRA_DEPENDENCIES plasma-store-server) +add_plasma_test(test/external_store_tests EXTRA_LINK_LIBS ${PLASMA_TEST_LIBS} + EXTRA_DEPENDENCIES plasma-store-server) diff --git a/go/arrow/math/_lib/CMakeLists.txt b/go/arrow/math/_lib/CMakeLists.txt index ec1558b25fbed..050bd40804fc0 100644 --- a/go/arrow/math/_lib/CMakeLists.txt +++ b/go/arrow/math/_lib/CMakeLists.txt @@ -20,5 +20,3 @@ project(math-func) set(CMAKE_C_STANDARD 99) add_library(memory STATIC float64.c int64.c uint64.c) - - diff --git a/go/arrow/memory/_lib/CMakeLists.txt b/go/arrow/memory/_lib/CMakeLists.txt index f6815302de1a3..6126acd7c67f0 100644 --- a/go/arrow/memory/_lib/CMakeLists.txt +++ b/go/arrow/memory/_lib/CMakeLists.txt @@ -20,5 +20,3 @@ project(memory-func) set(CMAKE_C_STANDARD 99) add_library(memory STATIC memory.c) - - diff --git a/java/adapter/orc/CMakeLists.txt b/java/adapter/orc/CMakeLists.txt index c6facacf4656b..23110a0760df0 100644 --- a/java/adapter/orc/CMakeLists.txt +++ b/java/adapter/orc/CMakeLists.txt @@ -31,13 +31,14 @@ include(FindJNI) message("generating headers to ${JNI_HEADERS_DIR}") add_jar( - arrow_orc_java - src/main/java/org/apache/arrow/adapter/orc/OrcReaderJniWrapper.java - src/main/java/org/apache/arrow/adapter/orc/OrcStripeReaderJniWrapper.java - src/main/java/org/apache/arrow/adapter/orc/OrcMemoryJniWrapper.java - src/main/java/org/apache/arrow/adapter/orc/OrcJniUtils.java - src/main/java/org/apache/arrow/adapter/orc/OrcRecordBatch.java - src/main/java/org/apache/arrow/adapter/orc/OrcFieldNode.java - GENERATE_NATIVE_HEADERS arrow_orc_java-native - DESTINATION ${JNI_HEADERS_DIR} -) + arrow_orc_java + src/main/java/org/apache/arrow/adapter/orc/OrcReaderJniWrapper.java + src/main/java/org/apache/arrow/adapter/orc/OrcStripeReaderJniWrapper.java + src/main/java/org/apache/arrow/adapter/orc/OrcMemoryJniWrapper.java + src/main/java/org/apache/arrow/adapter/orc/OrcJniUtils.java + src/main/java/org/apache/arrow/adapter/orc/OrcRecordBatch.java + src/main/java/org/apache/arrow/adapter/orc/OrcFieldNode.java + GENERATE_NATIVE_HEADERS + arrow_orc_java-native + DESTINATION + ${JNI_HEADERS_DIR}) diff --git a/java/gandiva/CMakeLists.txt b/java/gandiva/CMakeLists.txt index 0a7c4d03e3bec..d14a11f29bffb 100644 --- a/java/gandiva/CMakeLists.txt +++ b/java/gandiva/CMakeLists.txt @@ -35,19 +35,15 @@ if(ARROW_GANDIVA_JAVA7) src/main/java/org/apache/arrow/gandiva/evaluator/ExpressionRegistryJniHelper.java src/main/java/org/apache/arrow/gandiva/exceptions/GandivaException.java) - create_javah(TARGET - gandiva_jni_headers - CLASSES - org.apache.arrow.gandiva.evaluator.ConfigurationBuilder - org.apache.arrow.gandiva.evaluator.JniWrapper - org.apache.arrow.gandiva.evaluator.ExpressionRegistryJniHelper - org.apache.arrow.gandiva.exceptions.GandivaException - DEPENDS - gandiva_java - CLASSPATH - gandiva_java - OUTPUT_DIR - ${JNI_HEADERS_DIR}/jni) + create_javah( + TARGET gandiva_jni_headers + CLASSES org.apache.arrow.gandiva.evaluator.ConfigurationBuilder + org.apache.arrow.gandiva.evaluator.JniWrapper + org.apache.arrow.gandiva.evaluator.ExpressionRegistryJniHelper + org.apache.arrow.gandiva.exceptions.GandivaException + DEPENDS gandiva_java + CLASSPATH gandiva_java + OUTPUT_DIR ${JNI_HEADERS_DIR}/jni) else() add_jar( gandiva_java diff --git a/matlab/CMakeLists.txt b/matlab/CMakeLists.txt index 993497006e130..e46ff3fa529fc 100755 --- a/matlab/CMakeLists.txt +++ b/matlab/CMakeLists.txt @@ -19,8 +19,7 @@ cmake_minimum_required(VERSION 3.2) set(CMAKE_CXX_STANDARD 11) set(MLARROW_VERSION "3.0.0-SNAPSHOT") -string(REGEX MATCH - "^[0-9]+\\.[0-9]+\\.[0-9]+" MLARROW_BASE_VERSION "${MLARROW_VERSION}") +string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" MLARROW_BASE_VERSION "${MLARROW_VERSION}") project(mlarrow VERSION "${MLARROW_BASE_VERSION}") @@ -33,23 +32,21 @@ endif() ## Arrow is Required find_package(Arrow REQUIRED) -## MATLAB is required to be installed to build MEX interfaces +## MATLAB is required to be installed to build MEX interfaces set(MATLAB_ADDITIONAL_VERSIONS "R2018a=9.4") find_package(Matlab REQUIRED MX_LIBRARY) # Build featherread mex file based on the arrow shared library -matlab_add_mex(NAME featherreadmex - SRC src/featherreadmex.cc - src/feather_reader.cc - src/util/handle_status.cc - src/util/unicode_conversion.cc - LINK_TO ${ARROW_SHARED_LIB}) +matlab_add_mex( + NAME featherreadmex + SRC src/featherreadmex.cc src/feather_reader.cc src/util/handle_status.cc + src/util/unicode_conversion.cc + LINK_TO ${ARROW_SHARED_LIB}) target_include_directories(featherreadmex PRIVATE ${ARROW_INCLUDE_DIR}) # Build featherwrite mex file based on the arrow shared library -matlab_add_mex(NAME featherwritemex - SRC src/featherwritemex.cc - src/feather_writer.cc - src/util/handle_status.cc - LINK_TO ${ARROW_SHARED_LIB}) +matlab_add_mex( + NAME featherwritemex + SRC src/featherwritemex.cc src/feather_writer.cc src/util/handle_status.cc + LINK_TO ${ARROW_SHARED_LIB}) target_include_directories(featherwritemex PRIVATE ${ARROW_INCLUDE_DIR}) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 58b76d79e1827..1cff52a3234d8 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -77,7 +77,9 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") option(PYARROW_BUNDLE_ARROW_CPP "Bundle the Arrow C++ libraries" OFF) option(PYARROW_BUNDLE_BOOST "Bundle the Boost libraries when we bundle Arrow C++" OFF) option(PYARROW_GENERATE_COVERAGE "Build with Cython code coverage enabled" OFF) - set(PYARROW_CXXFLAGS "" CACHE STRING "Compiler flags to append when compiling Arrow") + set(PYARROW_CXXFLAGS + "" + CACHE STRING "Compiler flags to append when compiling Arrow") endif() find_program(CCACHE_FOUND ccache) @@ -128,8 +130,8 @@ else() # Suppress Cython warnings set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -Wno-maybe-uninitialized") - if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL + "Clang") # Cython warnings in clang set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-parentheses-equality") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-constant-logical-operand") @@ -168,10 +170,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) if(NOT APPLE) set(MORE_ARGS "-T") endif() - execute_process(COMMAND ln - ${MORE_ARGS} - -sf - ${BUILD_OUTPUT_ROOT_DIRECTORY} + execute_process(COMMAND ln ${MORE_ARGS} -sf ${BUILD_OUTPUT_ROOT_DIRECTORY} ${CMAKE_CURRENT_BINARY_DIR}/build/latest) else() set(BUILD_OUTPUT_ROOT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${BUILD_SUBDIR_NAME}") @@ -218,10 +217,7 @@ function(bundle_arrow_lib library_path) set(options) set(one_value_args SO_VERSION) set(multi_value_args) - cmake_parse_arguments(ARG - "${options}" - "${one_value_args}" - "${multi_value_args}" + cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(ARG_UNPARSED_ARGUMENTS) message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}") @@ -300,15 +296,17 @@ function(bundle_arrow_dependency library_name) list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}") endif() if(SHARED_LIB_HOME) - find_library(SHARED_LIB_PATH - NAMES "${shared_lib_name}" - PATHS "${SHARED_LIB_HOME}" - PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES} - NO_DEFAULT_PATH) + find_library( + SHARED_LIB_PATH + NAMES "${shared_lib_name}" + PATHS "${SHARED_LIB_HOME}" + PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES} + NO_DEFAULT_PATH) else() - find_library(SHARED_LIB_PATH - NAMES "${shared_lib_name}" - PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES}) + find_library( + SHARED_LIB_PATH + NAMES "${shared_lib_name}" + PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES}) endif() if(MSVC) set(CMAKE_SHARED_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_ORIGINAL}) @@ -362,7 +360,10 @@ if(PYARROW_BUNDLE_ARROW_CPP) # disable autolinking in boost add_definitions(-DBOOST_ALL_NO_LIB) endif() - find_package(Boost COMPONENTS regex REQUIRED) + find_package( + Boost + COMPONENTS regex + REQUIRED) bundle_boost_lib(Boost_REGEX_LIBRARY) endif() @@ -382,12 +383,7 @@ if(UNIX) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) endif() -set(CYTHON_EXTENSIONS - lib - _fs - _compute - _csv - _json) +set(CYTHON_EXTENSIONS lib _fs _compute _csv _json) set(LINK_LIBS arrow_shared arrow_python_shared) @@ -455,7 +451,10 @@ if(PYARROW_BUILD_PARQUET) else() set(Boost_USE_STATIC_LIBS ON) endif() - find_package(Boost COMPONENTS regex REQUIRED) + find_package( + Boost + COMPONENTS regex + REQUIRED) add_thirdparty_lib(boost_regex STATIC_LIB ${Boost_REGEX_LIBRARY_RELEASE}) add_thirdparty_lib(thrift STATIC_LIB ${THRIFT_STATIC_LIB}) set(PARQUET_LINK_LIBS parquet_static thrift_static boost_regex_static) @@ -552,8 +551,8 @@ foreach(module ${CYTHON_EXTENSIONS}) if(directories) string(REPLACE ";" "/" module_output_directory ${directories}) - set_target_properties(${module_name} - PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${module_output_directory}) + set_target_properties(${module_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY + ${module_output_directory}) endif() if(PYARROW_BUNDLE_ARROW_CPP) @@ -581,9 +580,8 @@ foreach(module ${CYTHON_EXTENSIONS}) endif() if(PYARROW_GENERATE_COVERAGE) - set_target_properties(${module_name} - PROPERTIES COMPILE_DEFINITIONS - "CYTHON_TRACE=1;CYTHON_TRACE_NOGIL=1") + set_target_properties(${module_name} PROPERTIES COMPILE_DEFINITIONS + "CYTHON_TRACE=1;CYTHON_TRACE_NOGIL=1") endif() target_link_libraries(${module_name} PRIVATE ${LINK_LIBS})