diff --git a/.dockerignore b/.dockerignore index eb71138c679a5..a369d7d59a662 100644 --- a/.dockerignore +++ b/.dockerignore @@ -27,7 +27,7 @@ # include explicitly !ci/** !c_glib/Gemfile -!dev/archery/requirements*.txt +!dev/archery/setup.py !python/requirements*.txt !python/manylinux1/** !python/manylinux2010/** diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8b5a24476d81e..0718072308a8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,13 +29,6 @@ repos: entry: bash -c "git archive HEAD --prefix=apache-arrow/ --output=arrow-src.tar && ./dev/release/run-rat.sh arrow-src.tar" always_run: true pass_filenames: false - - id: cmake-format - name: CMake Format - language: python - entry: python run-cmake-format.py - types: [cmake] - additional_dependencies: - - cmake_format==0.5.2 - id: hadolint name: Docker Format language: docker_image diff --git a/ci/docker/linux-apt-lint.dockerfile b/ci/docker/linux-apt-lint.dockerfile index c711c4c883c3d..2f4bf0010bc2e 100644 --- a/ci/docker/linux-apt-lint.dockerfile +++ b/ci/docker/linux-apt-lint.dockerfile @@ -49,12 +49,8 @@ RUN arrow/ci/scripts/install_iwyu.sh /tmp/iwyu /usr/local ${clang_tools} RUN ln -s /usr/bin/python3 /usr/local/bin/python && \ ln -s /usr/bin/pip3 /usr/local/bin/pip -COPY dev/archery/requirements.txt \ - dev/archery/requirements-lint.txt \ - /arrow/dev/archery/ -RUN pip install \ - -r arrow/dev/archery/requirements.txt \ - -r arrow/dev/archery/requirements-lint.txt +COPY dev/archery/setup.py /arrow/dev/archery/ +RUN pip install -e arrow/dev/archery[lint] ENV LC_ALL=C.UTF-8 \ LANG=C.UTF-8 diff --git a/cmake-format.py b/cmake-format.py index 0976642031f72..3e77733f4d1ee 100644 --- a/cmake-format.py +++ b/cmake-format.py @@ -16,44 +16,61 @@ # under the License. # cmake-format configuration file -# Use run-cmake-format.py to reformat all cmake files in the source tree +# Use `archery lint --cmake-format --fix` to reformat all cmake files in the +# source tree -# How wide to allow formatted cmake files -line_width = 90 +# ----------------------------- +# Options affecting formatting. +# ----------------------------- +with section("format"): + # How wide to allow formatted cmake files + line_width = 90 -# How many spaces to tab for indent -tab_size = 2 + # How many spaces to tab for indent + tab_size = 2 -# If arglists are longer than this, break them always -max_subargs_per_line = 4 + # If a positional argument group contains more than this many arguments, + # then force it to a vertical layout. + max_pargs_hwrap = 4 -# If true, separate flow control names from their parentheses with a space -separate_ctrl_name_with_space = False + # If the statement spelling length (including space and parenthesis) is + # smaller than this amount, then force reject nested layouts. + # This value only comes into play when considering whether or not to nest + # arguments below their parent. If the number of characters in the parent + # is less than this value, we will not nest. + min_prefix_chars = 32 -# If true, separate function names from parentheses with a space -separate_fn_name_with_space = False + # If true, separate flow control names from their parentheses with a space + separate_ctrl_name_with_space = False -# If a statement is wrapped to more than one line, than dangle the closing -# parenthesis on it's own line -dangle_parens = False + # If true, separate function names from parentheses with a space + separate_fn_name_with_space = False -# What style line endings to use in the output. -line_ending = 'unix' + # If a statement is wrapped to more than one line, than dangle the closing + # parenthesis on it's own line + dangle_parens = False -# Format command names consistently as 'lower' or 'upper' case -command_case = 'lower' + # What style line endings to use in the output. + line_ending = 'unix' -# Format keywords consistently as 'lower' or 'upper' case -keyword_case = 'unchanged' + # Format command names consistently as 'lower' or 'upper' case + command_case = 'lower' -# enable comment markup parsing and reflow -enable_markup = False + # Format keywords consistently as 'lower' or 'upper' case + keyword_case = 'unchanged' -# If comment markup is enabled, don't reflow the first comment block in -# eachlistfile. Use this to preserve formatting of your -# copyright/licensestatements. -first_comment_is_literal = False +# ------------------------------------------------ +# Options affecting comment reflow and formatting. +# ------------------------------------------------ +with section("markup"): + # enable comment markup parsing and reflow + enable_markup = False -# If comment markup is enabled, don't reflow any comment block which matchesthis -# (regex) pattern. Default is `None` (disabled). -literal_comment_pattern = None + # If comment markup is enabled, don't reflow the first comment block in + # eachlistfile. Use this to preserve formatting of your + # copyright/licensestatements. + first_comment_is_literal = True + + # If comment markup is enabled, don't reflow any comment block which + # matchesthis (regex) pattern. Default is `None` (disabled). + literal_comment_pattern = None diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index a31af74f68efa..91b3528bf7086 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) @@ -117,18 +119,15 @@ set(ARROW_LLVM_VERSIONS "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) @@ -163,7 +162,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 @@ -226,7 +227,9 @@ 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 @@ -271,7 +274,7 @@ if(${CLANG_FORMAT_FOUND}) 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") @@ -469,10 +472,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}/") @@ -550,12 +550,9 @@ include_directories(src/generated) # if(PARQUET_BUILD_SHARED) set_target_properties(arrow_shared - PROPERTIES C_VISIBILITY_PRESET - hidden - CXX_VISIBILITY_PRESET - hidden - VISIBILITY_INLINES_HIDDEN - 1) + PROPERTIES C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN 1) endif() # @@ -599,7 +596,9 @@ endif(UNIX) # "make cscope" target # if(UNIX) - add_custom_target(cscope find ${CMAKE_CURRENT_SOURCE_DIR} + add_custom_target(cscope + find + ${CMAKE_CURRENT_SOURCE_DIR} (-name \\*.cc -or @@ -636,23 +635,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() # @@ -721,7 +711,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() @@ -916,8 +906,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..cd8290d1bbb67 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -62,17 +62,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 +79,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 +114,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}") @@ -159,10 +155,9 @@ function(create_merged_static_lib output_target) 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 +165,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 +178,9 @@ 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) @@ -218,9 +210,8 @@ function(create_merged_static_lib output_target) COMMENT "Bundling ${output_lib_path}" VERBATIM) - message( - STATUS "Creating bundled static library target ${output_target} at ${output_lib_path}" - ) + 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}) @@ -355,7 +346,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 @@ -367,20 +360,13 @@ function(ADD_ARROW_LIB LIB_NAME) 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}") + 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 @@ -395,8 +381,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) @@ -407,7 +393,7 @@ function(ADD_ARROW_LIB LIB_NAME) endif() set_target_properties(${LIB_NAME}_shared PROPERTIES BUILD_WITH_INSTALL_RPATH ON INSTALL_NAME_DIR - "${_lib_install_name}") + "${_lib_install_name}") endif() install(TARGETS ${LIB_NAME}_shared ${INSTALL_IS_OPTIONAL} @@ -415,7 +401,8 @@ function(ADD_ARROW_LIB LIB_NAME) RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) endif() if(BUILD_STATIC) @@ -451,8 +438,8 @@ function(ADD_ARROW_LIB LIB_NAME) endif() set_target_properties(${LIB_NAME}_static - PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_PATH}" OUTPUT_NAME - ${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 @@ -469,7 +456,8 @@ function(ADD_ARROW_LIB LIB_NAME) RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) endif() if(ARG_CMAKE_PACKAGE_NAME) @@ -488,9 +476,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 +490,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() @@ -589,10 +580,8 @@ function(ADD_BENCHMARK REL_BENCHMARK_NAME) # 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 + PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE + INSTALL_RPATH_USE_LINK_PATH TRUE INSTALL_RPATH "$ENV{CONDA_PREFIX}/lib;${EXECUTABLE_OUTPUT_PATH}") endif() @@ -619,7 +608,9 @@ function(ADD_BENCHMARK REL_BENCHMARK_NAME) benchmark ${BENCHMARK_PATH} ${NO_COLOR}) - set_property(TEST ${BENCHMARK_NAME} APPEND PROPERTY LABELS ${ARG_LABELS}) + set_property(TEST ${BENCHMARK_NAME} + APPEND + PROPERTY LABELS ${ARG_LABELS}) endfunction() # @@ -699,10 +690,8 @@ function(ADD_TEST_CASE REL_TEST_NAME) # 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 + PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE + INSTALL_RPATH_USE_LINK_PATH TRUE INSTALL_RPATH "${EXECUTABLE_OUTPUT_PATH};$ENV{CONDA_PREFIX}/lib") endif() @@ -735,9 +724,10 @@ function(ADD_TEST_CASE REL_TEST_NAME) endif() if(ARROW_TEST_MEMCHECK AND NOT ARG_NO_VALGRIND) - add_test( - ${TEST_NAME} bash -c - "cd '${CMAKE_SOURCE_DIR}'; \ + add_test(${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 \ --error-exitcode=1 ${TEST_PATH}") @@ -773,17 +763,16 @@ function(ADD_TEST_CASE REL_TEST_NAME) set(LABEL_TEST_NAME "test-${LABEL}") if(NOT TARGET ${LABEL_TEST_NAME}) add_custom_target(${LABEL_TEST_NAME} - ctest - -L - "${LABEL}" - --output-on-failure + 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() # @@ -896,8 +885,8 @@ 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) diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake index 033076ebdb096..e2a85a4aa551b 100644 --- a/cpp/cmake_modules/DefineOptions.cmake +++ b/cpp/cmake_modules/DefineOptions.cmake @@ -33,7 +33,9 @@ endfunction() function(list_join lst glue out) if("${${lst}}" STREQUAL "") - set(${out} "" PARENT_SCOPE) + set(${out} + "" + PARENT_SCOPE) return() endif() @@ -42,7 +44,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 +65,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}) @@ -181,8 +187,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) @@ -320,7 +326,8 @@ 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" + define_option(ARROW_OPENSSL_USE_SHARED + "Rely on OpenSSL shared libraries where relevant" ${ARROW_DEPENDENCY_USE_SHARED}) define_option(ARROW_PROTOBUF_USE_SHARED @@ -363,14 +370,12 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") define_option(ARROW_WITH_ZLIB "Build with zlib compression" OFF) define_option(ARROW_WITH_ZSTD "Build with zstd compression" OFF) - define_option( - ARROW_WITH_UTF8PROC - "Build with support for Unicode properties using the utf8proc library;(only used if ARROW_COMPUTE is ON or ARROW_GANDIVA is ON)" - ON) - define_option( - ARROW_WITH_RE2 - "Build with support for regular expressions using the re2 library;(only used if ARROW_COMPUTE or ARROW_GANDIVA is ON)" - ON) + define_option(ARROW_WITH_UTF8PROC + "Build with support for Unicode properties using the utf8proc library;(only used if ARROW_COMPUTE is ON or ARROW_GANDIVA is ON)" + ON) + define_option(ARROW_WITH_RE2 + "Build with support for regular expressions using the re2 library;(only used if ARROW_COMPUTE or ARROW_GANDIVA is ON)" + ON) #---------------------------------------------------------------------- if(MSVC_TOOLCHAIN) @@ -416,9 +421,9 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") "Depend only on Thirdparty headers to build libparquet.;\ Always OFF if building binaries" OFF) - define_option( - PARQUET_BUILD_EXECUTABLES - "Build the Parquet executable CLI tools. Requires static libraries to be built." OFF) + define_option(PARQUET_BUILD_EXECUTABLES + "Build the Parquet executable CLI tools. Requires static libraries to be built." + OFF) define_option(PARQUET_BUILD_EXAMPLES "Build the Parquet examples. Requires static libraries to be built." OFF) @@ -432,10 +437,9 @@ Always OFF if building binaries" OFF) define_option(ARROW_GANDIVA_JAVA "Build the Gandiva JNI wrappers" OFF) # ARROW-3860: Temporary workaround - define_option( - ARROW_GANDIVA_STATIC_LIBSTDCPP - "Include -static-libstdc++ -static-libgcc when linking with;Gandiva static libraries" - OFF) + define_option(ARROW_GANDIVA_STATIC_LIBSTDCPP + "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" @@ -450,7 +454,8 @@ Always OFF if building binaries" OFF) 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) @@ -465,9 +470,8 @@ macro(validate_config) set(value "${${name}}") if(possible_values) if(NOT "${value}" IN_LIST possible_values) - message( - FATAL_ERROR "Configuration option ${name} got invalid value '${value}'. " - "Allowed values: ${${name}_OPTION_ENUM}.") + message(FATAL_ERROR "Configuration option ${name} got invalid value '${value}'. " + "Allowed values: ${${name}_OPTION_ENUM}.") endif() endif() endforeach() @@ -486,8 +490,8 @@ macro(config_summary_message) message(STATUS " Source directory: ${CMAKE_CURRENT_SOURCE_DIR}") message(STATUS " Install prefix: ${CMAKE_INSTALL_PREFIX}") if(${CMAKE_EXPORT_COMPILE_COMMANDS}) - message( - STATUS " Compile commands: ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json") + message(STATUS " Compile commands: ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json" + ) endif() foreach(category ${ARROW_OPTION_CATEGORIES}) diff --git a/cpp/cmake_modules/FindArrow.cmake b/cpp/cmake_modules/FindArrow.cmake index 9c987665896d8..68024cc27609d 100644 --- a/cpp/cmake_modules/FindArrow.cmake +++ b/cpp/cmake_modules/FindArrow.cmake @@ -50,11 +50,12 @@ 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") +list(APPEND + ARROW_SEARCH_LIB_PATH_SUFFIXES + "lib64" + "lib32" + "lib" + "bin") set(ARROW_CONFIG_SUFFIXES "_RELEASE" "_RELWITHDEBINFO" @@ -120,10 +121,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,9 +138,11 @@ 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. @@ -152,7 +154,9 @@ macro(arrow_find_package_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}) @@ -169,13 +173,15 @@ macro(arrow_find_package_home) 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}" @@ -183,7 +189,9 @@ macro(arrow_find_package_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() @@ -195,13 +203,15 @@ macro(arrow_find_package_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 +222,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 +233,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 +246,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 +262,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}") @@ -270,18 +287,21 @@ macro(arrow_find_package_pkg_config) 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}") + 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 @@ -289,7 +309,9 @@ macro(arrow_find_package_pkg_config) 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} @@ -315,7 +337,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 +348,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 +362,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,9 +374,13 @@ 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 "") @@ -384,9 +416,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) @@ -416,16 +447,13 @@ mark_as_advanced(ARROW_ABI_VERSION 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..014386f30122a 100644 --- a/cpp/cmake_modules/FindArrowCUDA.cmake +++ b/cpp/cmake_modules/FindArrowCUDA.cmake @@ -74,13 +74,10 @@ mark_as_advanced(ARROW_CUDA_IMPORT_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..fe74f247fc3f0 100644 --- a/cpp/cmake_modules/FindArrowDataset.cmake +++ b/cpp/cmake_modules/FindArrowDataset.cmake @@ -74,13 +74,11 @@ mark_as_advanced(ARROW_DATASET_IMPORT_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..805a4ff38036e 100644 --- a/cpp/cmake_modules/FindArrowFlight.cmake +++ b/cpp/cmake_modules/FindArrowFlight.cmake @@ -75,13 +75,10 @@ mark_as_advanced(ARROW_FLIGHT_IMPORT_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..c0756cf637c54 100644 --- a/cpp/cmake_modules/FindArrowFlightTesting.cmake +++ b/cpp/cmake_modules/FindArrowFlightTesting.cmake @@ -79,25 +79,20 @@ mark_as_advanced(ARROW_FLIGHT_TESTING_IMPORT_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) - message( - STATUS "Found the Arrow Flight testing by ${ARROW_FLIGHT_TESTING_FIND_APPROACH}") - message( - STATUS - "Found the Arrow Flight testing shared library: ${ARROW_FLIGHT_TESTING_SHARED_LIB}") - message( - STATUS - "Found the Arrow Flight testing import library: ${ARROW_FLIGHT_TESTING_IMPORT_LIB}") - message( - STATUS - "Found the Arrow Flight testing static library: ${ARROW_FLIGHT_TESTING_STATIC_LIB}") + message(STATUS "Found the Arrow Flight testing by ${ARROW_FLIGHT_TESTING_FIND_APPROACH}" + ) + message(STATUS "Found the Arrow Flight testing shared library: ${ARROW_FLIGHT_TESTING_SHARED_LIB}" + ) + message(STATUS "Found the Arrow Flight testing import library: ${ARROW_FLIGHT_TESTING_IMPORT_LIB}" + ) + message(STATUS "Found the Arrow Flight testing static library: ${ARROW_FLIGHT_TESTING_STATIC_LIB}" + ) endif() diff --git a/cpp/cmake_modules/FindArrowPython.cmake b/cpp/cmake_modules/FindArrowPython.cmake index 3d1280dff72df..b503e6a9e022c 100644 --- a/cpp/cmake_modules/FindArrowPython.cmake +++ b/cpp/cmake_modules/FindArrowPython.cmake @@ -73,13 +73,10 @@ mark_as_advanced(ARROW_PYTHON_IMPORT_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..3a639928ce5ef 100644 --- a/cpp/cmake_modules/FindArrowPythonFlight.cmake +++ b/cpp/cmake_modules/FindArrowPythonFlight.cmake @@ -76,24 +76,19 @@ mark_as_advanced(ARROW_PYTHON_FLIGHT_IMPORT_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) message(STATUS "Found the Arrow Python Flight by ${ARROW_PYTHON_FLIGHT_FIND_APPROACH}") - message( - STATUS - "Found the Arrow Python Flight shared library: ${ARROW_PYTHON_FLIGHT_SHARED_LIB}") - message( - STATUS - "Found the Arrow Python Flight import library: ${ARROW_PYTHON_FLIGHT_IMPORT_LIB}") - message( - STATUS - "Found the Arrow Python Flight static library: ${ARROW_PYTHON_FLIGHT_STATIC_LIB}") + message(STATUS "Found the Arrow Python Flight shared library: ${ARROW_PYTHON_FLIGHT_SHARED_LIB}" + ) + message(STATUS "Found the Arrow Python Flight import library: ${ARROW_PYTHON_FLIGHT_IMPORT_LIB}" + ) + message(STATUS "Found the Arrow Python Flight static library: ${ARROW_PYTHON_FLIGHT_STATIC_LIB}" + ) endif() diff --git a/cpp/cmake_modules/FindArrowTesting.cmake b/cpp/cmake_modules/FindArrowTesting.cmake index ed5a28cd3e4d2..c405003ad70f4 100644 --- a/cpp/cmake_modules/FindArrowTesting.cmake +++ b/cpp/cmake_modules/FindArrowTesting.cmake @@ -74,13 +74,11 @@ mark_as_advanced(ARROW_TESTING_IMPORT_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/FindBrotli.cmake b/cpp/cmake_modules/FindBrotli.cmake index b46a0f1a0cf4e..e2670b51a9eba 100644 --- a/cpp/cmake_modules/FindBrotli.cmake +++ b/cpp/cmake_modules/FindBrotli.cmake @@ -110,12 +110,9 @@ else() 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) diff --git a/cpp/cmake_modules/FindClangTools.cmake b/cpp/cmake_modules/FindClangTools.cmake index 88171abed922b..52fc59895b822 100644 --- a/cpp/cmake_modules/FindClangTools.cmake +++ b/cpp/cmake_modules/FindClangTools.cmake @@ -69,15 +69,18 @@ function(FIND_CLANG_TOOL NAME OUTPUT VERSION_CHECK_PATTERN) 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 +103,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..d67eb005621fe 100644 --- a/cpp/cmake_modules/FindGLOG.cmake +++ b/cpp/cmake_modules/FindGLOG.cmake @@ -38,7 +38,9 @@ elseif(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_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}) diff --git a/cpp/cmake_modules/FindGandiva.cmake b/cpp/cmake_modules/FindGandiva.cmake index 15279fd841afc..c533abed733e0 100644 --- a/cpp/cmake_modules/FindGandiva.cmake +++ b/cpp/cmake_modules/FindGandiva.cmake @@ -79,14 +79,11 @@ mark_as_advanced(GANDIVA_ABI_VERSION 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/FindLLVMAlt.cmake b/cpp/cmake_modules/FindLLVMAlt.cmake index 7695c09ae8ce1..380f2d47c72f0 100644 --- a/cpp/cmake_modules/FindLLVMAlt.cmake +++ b/cpp/cmake_modules/FindLLVMAlt.cmake @@ -58,22 +58,17 @@ if(LLVM_FOUND) 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}") + 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..bc8051fe9c55e 100644 --- a/cpp/cmake_modules/FindLz4.cmake +++ b/cpp/cmake_modules/FindLz4.cmake @@ -23,16 +23,13 @@ set(LZ4_LIB_NAME_BASE "${LZ4_MSVC_LIB_PREFIX}lz4") 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}" - ) + list(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") @@ -70,7 +67,9 @@ 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_path(LZ4_INCLUDE_DIR + NAMES lz4.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() endif() diff --git a/cpp/cmake_modules/FindORC.cmake b/cpp/cmake_modules/FindORC.cmake index 061a0df2e9e2c..d45b1607833f8 100644 --- a/cpp/cmake_modules/FindORC.cmake +++ b/cpp/cmake_modules/FindORC.cmake @@ -33,7 +33,9 @@ if(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_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}) diff --git a/cpp/cmake_modules/FindParquet.cmake b/cpp/cmake_modules/FindParquet.cmake index 99124b2c037d9..e071fc822b63b 100644 --- a/cpp/cmake_modules/FindParquet.cmake +++ b/cpp/cmake_modules/FindParquet.cmake @@ -83,13 +83,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) @@ -113,13 +112,10 @@ mark_as_advanced(PARQUET_ABI_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..2e634844c5967 100644 --- a/cpp/cmake_modules/FindPlasma.cmake +++ b/cpp/cmake_modules/FindPlasma.cmake @@ -87,14 +87,10 @@ mark_as_advanced(PLASMA_ABI_VERSION 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..ab91c7be0527e 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,17 @@ 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() @@ -72,12 +73,11 @@ get_target_property(NUMPY_INCLUDE_DIRS Python3::NumPy INTERFACE_INCLUDE_DIRECTOR # CMake's python3_add_library() doesn't apply the required extension suffix, # detect it ourselves. # (https://gitlab.kitware.com/cmake/cmake/issues/20408) -execute_process( - COMMAND "${PYTHON_EXECUTABLE}" "-c" - "from distutils import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))" - RESULT_VARIABLE _PYTHON_RESULT - OUTPUT_VARIABLE _PYTHON_STDOUT - ERROR_VARIABLE _PYTHON_STDERR) +execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" + "from distutils import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))" + RESULT_VARIABLE _PYTHON_RESULT + OUTPUT_VARIABLE _PYTHON_STDOUT + ERROR_VARIABLE _PYTHON_STDERR) if(NOT _PYTHON_RESULT MATCHES 0) if(Python3Alt_FIND_REQUIRED) @@ -92,8 +92,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/FindRapidJSONAlt.cmake b/cpp/cmake_modules/FindRapidJSONAlt.cmake index a967ef61a66d4..9a449a5280e59 100644 --- a/cpp/cmake_modules/FindRapidJSONAlt.cmake +++ b/cpp/cmake_modules/FindRapidJSONAlt.cmake @@ -36,39 +36,37 @@ if(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 26cccb786c531..747df31854dd2 100644 --- a/cpp/cmake_modules/FindSnappy.cmake +++ b/cpp/cmake_modules/FindSnappy.cmake @@ -19,20 +19,19 @@ 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}") 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) diff --git a/cpp/cmake_modules/FindThrift.cmake b/cpp/cmake_modules/FindThrift.cmake index 273d907ed07a5..750d8ce8341f1 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) @@ -53,21 +57,19 @@ set(THRIFT_LIB_NAME_BASE "thrift${THRIFT_MSVC_LIB_SUFFIX}") if(ARROW_THRIFT_USE_SHARED) set(THRIFT_LIB_NAMES thrift) 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}" + 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}" + ) 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) @@ -78,7 +80,9 @@ if(Thrift_ROOT) 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_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. @@ -115,13 +119,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) diff --git a/cpp/cmake_modules/Findc-aresAlt.cmake b/cpp/cmake_modules/Findc-aresAlt.cmake index dd16393cad2e0..5213e8d12a1a5 100644 --- a/cpp/cmake_modules/Findc-aresAlt.cmake +++ b/cpp/cmake_modules/Findc-aresAlt.cmake @@ -55,7 +55,9 @@ else() NAMES cares "${CMAKE_SHARED_LIBRARY_PREFIX}cares${CMAKE_SHARED_LIBRARY_SUFFIX}" PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}) - find_path(c-ares_INCLUDE_DIR NAMES ares.h PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) + find_path(c-ares_INCLUDE_DIR + NAMES ares.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() find_package_handle_standard_args(c-aresAlt REQUIRED_VARS c-ares_LIB c-ares_INCLUDE_DIR) @@ -63,9 +65,9 @@ find_package_handle_standard_args(c-aresAlt REQUIRED_VARS c-ares_LIB c-ares_INCL if(c-aresAlt_FOUND) if(NOT TARGET c-ares::cares) add_library(c-ares::cares UNKNOWN IMPORTED) - set_target_properties( - c-ares::cares - PROPERTIES IMPORTED_LOCATION "${c-ares_LIB}" INTERFACE_INCLUDE_DIRECTORIES - "${c-ares_INCLUDE_DIR}") + set_target_properties(c-ares::cares + PROPERTIES IMPORTED_LOCATION "${c-ares_LIB}" + INTERFACE_INCLUDE_DIRECTORIES + "${c-ares_INCLUDE_DIR}") endif() endif() diff --git a/cpp/cmake_modules/FindgRPCAlt.cmake b/cpp/cmake_modules/FindgRPCAlt.cmake index 841b3b61b8355..18b23f32269b5 100644 --- a/cpp/cmake_modules/FindgRPCAlt.cmake +++ b/cpp/cmake_modules/FindgRPCAlt.cmake @@ -36,11 +36,9 @@ if(GRPCPP_PC_FOUND) else() set(GRPCPP_LINK_LIBRARIES) foreach(GRPCPP_LIBRARY_NAME ${GRPCPP_PC_STATIC_LIBRARIES}) - find_library( - GRPCPP_LIBRARY_${GRPCPP_LIBRARY_NAME} - NAMES - "${CMAKE_STATIC_LIBRARY_PREFIX}${GRPCPP_LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - HINTS ${GRPCPP_PC_STATIC_LIBRARY_DIRS}) + find_library(GRPCPP_LIBRARY_${GRPCPP_LIBRARY_NAME} + NAMES "${CMAKE_STATIC_LIBRARY_PREFIX}${GRPCPP_LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + HINTS ${GRPCPP_PC_STATIC_LIBRARY_DIRS}) list(APPEND GRPCPP_LINK_LIBRARIES "${GRPCPP_LIBRARY_${GRPCPP_LIBRARY_NAME}}") endforeach() set(GRPCPP_LINK_OPTIONS ${GRPCPP_PC_STATIC_LDFLAGS_OTHER}) @@ -65,18 +63,14 @@ endif() if(gRPCAlt_FOUND) add_library(gRPC::grpc++ UNKNOWN IMPORTED) set_target_properties(gRPC::grpc++ - PROPERTIES IMPORTED_LOCATION - "${GRPCPP_IMPORTED_LOCATION}" - INTERFACE_COMPILE_OPTIONS - "${GRPCPP_COMPILE_OPTIONS}" + PROPERTIES IMPORTED_LOCATION "${GRPCPP_IMPORTED_LOCATION}" + INTERFACE_COMPILE_OPTIONS "${GRPCPP_COMPILE_OPTIONS}" INTERFACE_INCLUDE_DIRECTORIES "${GRPCPP_INCLUDE_DIRECTORIES}" - INTERFACE_LINK_LIBRARIES - "${GRPCPP_LINK_LIBRARIES}" - INTERFACE_LINK_OPTIONS - "${GRPCPP_LINK_OPTIONS}") + INTERFACE_LINK_LIBRARIES "${GRPCPP_LINK_LIBRARIES}" + INTERFACE_LINK_OPTIONS "${GRPCPP_LINK_OPTIONS}") 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/Findre2Alt.cmake b/cpp/cmake_modules/Findre2Alt.cmake index 93b69ce77cbbb..68abf1b75fe5e 100644 --- a/cpp/cmake_modules/Findre2Alt.cmake +++ b/cpp/cmake_modules/Findre2Alt.cmake @@ -42,35 +42,37 @@ if(RE2_PC_FOUND) # 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() endif() elseif(RE2_ROOT) - find_library( - RE2_LIB - NAMES - 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_library(RE2_LIB + NAMES 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}) else() - find_library( - RE2_LIB - NAMES - 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_library(RE2_LIB + NAMES 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}) endif() find_package_handle_standard_args(re2Alt REQUIRED_VARS RE2_LIB RE2_INCLUDE_DIR) diff --git a/cpp/cmake_modules/Findutf8proc.cmake b/cpp/cmake_modules/Findutf8proc.cmake index 03c720d9a3c9a..4d732f186941c 100644 --- a/cpp/cmake_modules/Findutf8proc.cmake +++ b/cpp/cmake_modules/Findutf8proc.cmake @@ -36,7 +36,9 @@ function(extract_utf8proc_version) "${UTF8PROC_MAJOR_VERSION}.${UTF8PROC_MINOR_VERSION}.${UTF8PROC_PATCH_VERSION}" PARENT_SCOPE) else() - set(utf8proc_VERSION "" PARENT_SCOPE) + set(utf8proc_VERSION + "" + PARENT_SCOPE) endif() endfunction(extract_utf8proc_version) @@ -44,10 +46,10 @@ 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") @@ -80,22 +82,20 @@ else() extract_utf8proc_version() endif() -find_package_handle_standard_args(utf8proc - REQUIRED_VARS - utf8proc_LIB - utf8proc_INCLUDE_DIR - VERSION_VAR - utf8proc_VERSION) +find_package_handle_standard_args( + utf8proc + REQUIRED_VARS utf8proc_LIB utf8proc_INCLUDE_DIR + VERSION_VAR utf8proc_VERSION) 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..73b7ab250fb30 100644 --- a/cpp/cmake_modules/Findzstd.cmake +++ b/cpp/cmake_modules/Findzstd.cmake @@ -23,16 +23,14 @@ set(ZSTD_LIB_NAME_BASE "${ZSTD_MSVC_LIB_PREFIX}zstd") 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}" - ) + list(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}") + list(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") @@ -75,7 +73,9 @@ else() 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_path(ZSTD_INCLUDE_DIR + NAMES zstd.h + PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES}) endif() endif() diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 0a92702c4ec94..354461cbd2792 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -76,12 +76,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() @@ -252,8 +253,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") @@ -286,8 +287,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") @@ -342,8 +343,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() @@ -370,8 +371,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 @@ -453,8 +454,8 @@ if(ARROW_CPU_FLAG STREQUAL "armv8") add_definitions(-DARROW_HAVE_NEON) endif() - 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") @@ -491,7 +492,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() @@ -588,9 +591,8 @@ set(CXX_FLAGS_PROFILE_GEN "${CXX_FLAGS_RELEASE} -fprofile-generate") 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,...})" - ) +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 1350f274565f9..40f73f9212929 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -279,7 +279,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() @@ -291,7 +293,9 @@ if((NOT ARROW_COMPUTE) AND (NOT ARROW_GANDIVA)) set(ARROW_WITH_UTF8PROC OFF) endif() -if((NOT ARROW_COMPUTE) AND (NOT ARROW_GANDIVA) AND (NOT ARROW_WITH_GRPC)) +if((NOT ARROW_COMPUTE) + AND (NOT ARROW_GANDIVA) + AND (NOT ARROW_WITH_GRPC)) set(ARROW_WITH_RE2 OFF) endif() @@ -313,9 +317,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() @@ -336,46 +339,42 @@ endforeach() if(DEFINED ENV{ARROW_ABSL_URL}) set(ABSL_SOURCE_URL "$ENV{ARROW_ABSL_URL}") else() - set_urls( - ABSL_SOURCE_URL - "https://github.com/abseil/abseil-cpp/archive/${ARROW_ABSL_BUILD_VERSION}.tar.gz") + set_urls(ABSL_SOURCE_URL + "https://github.com/abseil/abseil-cpp/archive/${ARROW_ABSL_BUILD_VERSION}.tar.gz" + ) endif() if(DEFINED ENV{ARROW_AWS_C_COMMON_URL}) set(AWS_C_COMMON_SOURCE_URL "$ENV{ARROW_AWS_C_COMMON_URL}") else() - set_urls( - AWS_C_COMMON_SOURCE_URL - "https://github.com/awslabs/aws-c-common/archive/${ARROW_AWS_C_COMMON_BUILD_VERSION}.tar.gz" - ) + 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}) set(AWS_CHECKSUMS_SOURCE_URL "$ENV{ARROW_AWS_CHECKSUMS_URL}") else() - set_urls( - AWS_CHECKSUMS_SOURCE_URL - "https://github.com/awslabs/aws-checksums/archive/${ARROW_AWS_CHECKSUMS_BUILD_VERSION}.tar.gz" - ) + 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}) set(AWS_C_EVENT_STREAM_SOURCE_URL "$ENV{ARROW_AWS_C_EVENT_STREAM_URL}") 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" - ) + 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}) set(AWSSDK_SOURCE_URL "$ENV{ARROW_AWSSDK_URL}") else() - set_urls( - AWSSDK_SOURCE_URL - "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" - ) + set_urls(AWSSDK_SOURCE_URL + "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" + ) endif() if(DEFINED ENV{ARROW_BOOST_URL}) @@ -383,136 +382,125 @@ if(DEFINED ENV{ARROW_BOOST_URL}) else() string(REPLACE "." "_" ARROW_BOOST_BUILD_VERSION_UNDERSCORES ${ARROW_BOOST_BUILD_VERSION}) - set_urls( - BOOST_SOURCE_URL - # These are trimmed boost bundles we maintain. - # See cpp/build-support/trim-boost.sh - # FIXME(ARROW-6407) automate uploading this archive to ensure it reflects - # 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" - "https://sourceforge.net/projects/boost/files/boost/${ARROW_BOOST_BUILD_VERSION}/boost_${ARROW_BOOST_BUILD_VERSION_UNDERSCORES}.tar.gz" - "https://github.com/boostorg/boost/archive/boost-${ARROW_BOOST_BUILD_VERSION}.tar.gz") + set_urls(BOOST_SOURCE_URL + # These are trimmed boost bundles we maintain. + # See cpp/build-support/trim-boost.sh + # FIXME(ARROW-6407) automate uploading this archive to ensure it reflects + # 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" + "https://sourceforge.net/projects/boost/files/boost/${ARROW_BOOST_BUILD_VERSION}/boost_${ARROW_BOOST_BUILD_VERSION_UNDERSCORES}.tar.gz" + "https://github.com/boostorg/boost/archive/boost-${ARROW_BOOST_BUILD_VERSION}.tar.gz" + ) endif() if(DEFINED ENV{ARROW_BROTLI_URL}) set(BROTLI_SOURCE_URL "$ENV{ARROW_BROTLI_URL}") else() - set_urls( - 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" - ) + set_urls(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_BZIP2_URL}) set(ARROW_BZIP2_SOURCE_URL "$ENV{ARROW_BZIP2_URL}") else() - set_urls( - 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" - ) + set_urls(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_CARES_URL}) set(CARES_SOURCE_URL "$ENV{ARROW_CARES_URL}") else() - set_urls( - 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" - ) + set_urls(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}) set(GBENCHMARK_SOURCE_URL "$ENV{ARROW_GBENCHMARK_URL}") else() - set_urls( - 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" - ) + set_urls(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}) set(GFLAGS_SOURCE_URL "$ENV{ARROW_GFLAGS_URL}") else() - set_urls( - 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" - ) + set_urls(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}) set(GLOG_SOURCE_URL "$ENV{ARROW_GLOG_URL}") else() - set_urls( - 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" - ) + set_urls(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}) set(GRPC_SOURCE_URL "$ENV{ARROW_GRPC_URL}") else() - set_urls( - 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" - ) + set_urls(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}) set(GTEST_SOURCE_URL "$ENV{ARROW_GTEST_URL}") else() - set_urls( - GTEST_SOURCE_URL - "https://github.com/google/googletest/archive/release-${ARROW_GTEST_BUILD_VERSION}.tar.gz" - "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" - ) + set_urls(GTEST_SOURCE_URL + "https://github.com/google/googletest/archive/release-${ARROW_GTEST_BUILD_VERSION}.tar.gz" + "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" + ) endif() if(DEFINED ENV{ARROW_JEMALLOC_URL}) set(JEMALLOC_SOURCE_URL "$ENV{ARROW_JEMALLOC_URL}") else() - set_urls( - 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" - ) + set_urls(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}) set(MIMALLOC_SOURCE_URL "$ENV{ARROW_MIMALLOC_URL}") else() - set_urls( - 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" - ) + set_urls(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" - "https://github.com/ursa-labs/thirdparty/releases/download/latest/lz4-${ARROW_LZ4_BUILD_VERSION}.tar.gz" - ) + set_urls(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}) set(ORC_SOURCE_URL "$ENV{ARROW_ORC_URL}") else() - set_urls( - 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" - ) + set_urls(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}) @@ -521,109 +509,101 @@ else() string(SUBSTRING ${ARROW_PROTOBUF_BUILD_VERSION} 1 -1 ARROW_PROTOBUF_STRIPPED_BUILD_VERSION) # strip the leading `v` - set_urls( - 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" - ) + set_urls(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}) set(RE2_SOURCE_URL "$ENV{ARROW_RE2_URL}") else() - set_urls( - 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" - ) + set_urls(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}) set(RAPIDJSON_SOURCE_URL "$ENV{ARROW_RAPIDJSON_URL}") else() - set_urls( - 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" - ) + set_urls(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}) set(SNAPPY_SOURCE_URL "$ENV{ARROW_SNAPPY_URL}") else() - set_urls( - 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" - ) + set_urls(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}) set(THRIFT_SOURCE_URL "$ENV{ARROW_THRIFT_URL}") else() - set_urls( - THRIFT_SOURCE_URL - "http://www.apache.org/dyn/closer.cgi?action=download&filename=/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://downloads.apache.org/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://github.com/apache/thrift/archive/v${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://apache.claz.org/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://apache.cs.utah.edu/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://apache.mirrors.lucidnetworks.net/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://apache.osuosl.org/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://ftp.wayne.edu/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://mirror.olnevhost.net/pub/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://mirrors.gigenet.com/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://mirrors.koehn.com/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://mirrors.ocf.berkeley.edu/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "https://mirrors.sonic.net/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" - "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" - ) + set_urls(THRIFT_SOURCE_URL + "http://www.apache.org/dyn/closer.cgi?action=download&filename=/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://downloads.apache.org/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://github.com/apache/thrift/archive/v${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://apache.claz.org/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://apache.cs.utah.edu/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://apache.mirrors.lucidnetworks.net/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://apache.osuosl.org/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://ftp.wayne.edu/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://mirror.olnevhost.net/pub/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://mirrors.gigenet.com/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://mirrors.koehn.com/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://mirrors.ocf.berkeley.edu/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "https://mirrors.sonic.net/apache/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz" + "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" + ) endif() if(DEFINED ENV{ARROW_UTF8PROC_URL}) set(ARROW_UTF8PROC_SOURCE_URL "$ENV{ARROW_UTF8PROC_URL}") else() - set_urls( - ARROW_UTF8PROC_SOURCE_URL - "https://github.com/JuliaStrings/utf8proc/archive/${ARROW_UTF8PROC_BUILD_VERSION}.tar.gz" - ) + set_urls(ARROW_UTF8PROC_SOURCE_URL + "https://github.com/JuliaStrings/utf8proc/archive/${ARROW_UTF8PROC_BUILD_VERSION}.tar.gz" + ) endif() if(DEFINED ENV{ARROW_XSIMD_URL}) set(XSIMD_SOURCE_URL "$ENV{ARROW_XSIMD_URL}") else() - set_urls( - XSIMD_SOURCE_URL - "https://github.com/xtensor-stack/xsimd/archive/${ARROW_XSIMD_BUILD_VERSION}.tar.gz") + set_urls(XSIMD_SOURCE_URL + "https://github.com/xtensor-stack/xsimd/archive/${ARROW_XSIMD_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" - "https://github.com/ursa-labs/thirdparty/releases/download/latest/zlib-${ARROW_ZLIB_BUILD_VERSION}.tar.gz" - ) + set_urls(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}) set(ZSTD_SOURCE_URL "$ENV{ARROW_ZSTD_URL}") else() - set_urls( - 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" - ) + set_urls(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() # ---------------------------------------------------------------------- # ExternalProject options -set( - EP_CXX_FLAGS - "${CMAKE_CXX_COMPILER_ARG1} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}}" - ) +set(EP_CXX_FLAGS + "${CMAKE_CXX_COMPILER_ARG1} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}}" +) set(EP_C_FLAGS "${CMAKE_C_COMPILER_ARG1} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}}") @@ -730,12 +710,12 @@ macro(build_boost) set(BOOST_BUILD_WITH_LIBRARIES "filesystem" "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}) @@ -760,14 +740,12 @@ 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_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_SYSTEM_LIBRARY boost_system_static) set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_static) set(BOOST_BUILD_PRODUCTS ${BOOST_STATIC_SYSTEM_LIBRARY} @@ -925,14 +903,13 @@ 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} @@ -970,18 +947,15 @@ 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}) @@ -1016,8 +990,11 @@ macro(build_brotli) INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}") add_dependencies(Brotli::brotlidec brotli_ep) - list(APPEND ARROW_BUNDLED_STATIC_LIBS Brotli::brotlicommon Brotli::brotlienc - Brotli::brotlidec) + list(APPEND + ARROW_BUNDLED_STATIC_LIBS + Brotli::brotlicommon + Brotli::brotlienc + Brotli::brotlidec) endmacro() if(ARROW_WITH_BROTLI) @@ -1049,7 +1026,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. @@ -1079,10 +1058,8 @@ if(ARROW_USE_OPENSSL) include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) else() - message( - STATUS - "Building without OpenSSL support. Minimum OpenSSL version ${ARROW_OPENSSL_REQUIRED_VERSION} required." - ) + message(STATUS "Building without OpenSSL support. Minimum OpenSSL version ${ARROW_OPENSSL_REQUIRED_VERSION} required." + ) endif() # ---------------------------------------------------------------------- @@ -1097,10 +1074,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) @@ -1201,8 +1177,8 @@ macro(build_gflags) 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}) @@ -1237,8 +1213,8 @@ endif() macro(build_thrift) if(CMAKE_VERSION VERSION_LESS 3.10) - message( - FATAL_ERROR "Building thrift using ExternalProject requires at least CMake 3.10") + message(FATAL_ERROR "Building thrift using ExternalProject requires at least CMake 3.10" + ) endif() message("Building Apache Thrift from source") set(THRIFT_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/thrift_ep-install") @@ -1372,8 +1348,8 @@ macro(build_protobuf) 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 @@ -1386,18 +1362,18 @@ macro(build_protobuf) file(MAKE_DIRECTORY "${PROTOBUF_INCLUDE_DIR}") add_library(arrow::protobuf::libprotobuf STATIC IMPORTED) - set_target_properties( - arrow::protobuf::libprotobuf - PROPERTIES IMPORTED_LOCATION "${PROTOBUF_STATIC_LIB}" INTERFACE_INCLUDE_DIRECTORIES - "${PROTOBUF_INCLUDE_DIR}") + set_target_properties(arrow::protobuf::libprotobuf + PROPERTIES IMPORTED_LOCATION "${PROTOBUF_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES + "${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}") + set_target_properties(arrow::protobuf::libprotoc + PROPERTIES IMPORTED_LOCATION "${PROTOC_STATIC_LIB}" + INTERFACE_INCLUDE_DIRECTORIES + "${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) @@ -1463,8 +1439,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() @@ -1502,32 +1478,33 @@ 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}" - "--libdir=${JEMALLOC_LIB_DIR}" - "--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}" + "--libdir=${JEMALLOC_LIB_DIR}" + "--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}") endif() - externalproject_add( - jemalloc_ep - URL ${JEMALLOC_SOURCE_URL} - PATCH_COMMAND - touch doc/jemalloc.3 doc/jemalloc.html - # The prefix "je_arrow_" must be kept in sync with the value in memory_pool.cc - CONFIGURE_COMMAND ${JEMALLOC_CONFIGURE_COMMAND} - BUILD_IN_SOURCE 1 - BUILD_COMMAND ${JEMALLOC_BUILD_COMMAND} - BUILD_BYPRODUCTS "${JEMALLOC_STATIC_LIB}" - INSTALL_COMMAND ${MAKE} -j1 install) + externalproject_add(jemalloc_ep + URL ${JEMALLOC_SOURCE_URL} + PATCH_COMMAND touch doc/jemalloc.3 doc/jemalloc.html + # The prefix "je_arrow_" must be kept in sync with the value in memory_pool.cc + CONFIGURE_COMMAND ${JEMALLOC_CONFIGURE_COMMAND} + BUILD_IN_SOURCE 1 + BUILD_COMMAND ${JEMALLOC_BUILD_COMMAND} + BUILD_BYPRODUCTS "${JEMALLOC_STATIC_LIB}" + INSTALL_COMMAND ${MAKE} -j1 install) # Don't use the include directory directly so that we can point to a path # that is unique to our codebase. @@ -1536,10 +1513,8 @@ if(ARROW_JEMALLOC) 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}" + 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) @@ -1564,10 +1539,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} @@ -1588,10 +1562,8 @@ if(ARROW_MIMALLOC) add_library(mimalloc::mimalloc STATIC IMPORTED) set_target_properties(mimalloc::mimalloc - PROPERTIES INTERFACE_LINK_LIBRARIES - Threads::Threads - IMPORTED_LOCATION - "${MIMALLOC_STATIC_LIB}" + PROPERTIES INTERFACE_LINK_LIBRARIES Threads::Threads + IMPORTED_LOCATION "${MIMALLOC_STATIC_LIB}" INTERFACE_INCLUDE_DIRECTORIES "${MIMALLOC_INCLUDE_DIR}") add_dependencies(mimalloc::mimalloc mimalloc_ep) @@ -1643,10 +1615,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_INSTALL_NAME_DIR "$/lib") # Fix syntax highlighting mess introduced by unclosed bracket above set(dummy ">") @@ -1684,20 +1655,18 @@ 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 - "Building GoogleTest from source on Windows requires at least CMake 3.9") + message(FATAL_ERROR "Building GoogleTest from source on Windows requires at least CMake 3.9" + ) endif() get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_GENERATOR_IS_MULTI_CONFIG) @@ -1708,20 +1677,11 @@ macro(build_gtest) externalproject_add_step(googletest_ep copy COMMAND ${CMAKE_COMMAND} -E make_directory ${_GTEST_RUNTIME_OUTPUT_DIR} - COMMAND ${CMAKE_COMMAND} - -E - copy - ${_GTEST_RUNTIME_LIB} + COMMAND ${CMAKE_COMMAND} -E copy ${_GTEST_RUNTIME_LIB} ${_GTEST_RUNTIME_OUTPUT_DIR} - COMMAND ${CMAKE_COMMAND} - -E - copy - ${_GMOCK_RUNTIME_LIB} + COMMAND ${CMAKE_COMMAND} -E copy ${_GMOCK_RUNTIME_LIB} ${_GTEST_RUNTIME_OUTPUT_DIR} - COMMAND ${CMAKE_COMMAND} - -E - copy - ${_GTEST_MAIN_RUNTIME_LIB} + COMMAND ${CMAKE_COMMAND} -E copy ${_GTEST_MAIN_RUNTIME_LIB} ${_GTEST_RUNTIME_OUTPUT_DIR} DEPENDEES install) endif() @@ -1800,25 +1760,20 @@ 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}" @@ -1858,8 +1813,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. # @@ -1940,8 +1895,8 @@ macro(build_xsimd) set(XSIMD_VENDORED TRUE) endmacro() -if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") - OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE")) +if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE" + )) set(xsimd_SOURCE "BUNDLED") resolve_dependency(xsimd) # TODO: Don't use global includes but rather target_include_directories @@ -2008,29 +1963,21 @@ macro(build_lz4) set(LZ4_STATIC_LIB "${LZ4_BUILD_DIR}/build/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}/build/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" + UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_directory + "${LZ4_BUILD_DIR}/lib" "${LZ4_PREFIX}/include" ${LZ4_PATCH_COMMAND} CONFIGURE_COMMAND "" INSTALL_COMMAND "" @@ -2184,9 +2131,9 @@ 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}") @@ -2208,10 +2155,10 @@ macro(build_bzip2) 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") + set_target_properties(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) @@ -2238,10 +2185,9 @@ 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 @@ -2261,10 +2207,8 @@ macro(build_utf8proc) 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" + PROPERTIES IMPORTED_LOCATION "${UTF8PROC_STATIC_LIB}" + INTERFACE_COMPILER_DEFINITIONS "UTF8PROC_STATIC" INTERFACE_INCLUDE_DIRECTORIES "${UTF8PROC_PREFIX}/include") @@ -2301,10 +2245,9 @@ 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}" @@ -2331,8 +2274,8 @@ macro(build_cares) 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) @@ -2389,13 +2332,12 @@ macro(build_grpc) raw_logging_internal) 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() @@ -2411,23 +2353,21 @@ macro(build_grpc) 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${CMAKE_EXECUTABLE_SUFFIX}") set(GRPC_CMAKE_PREFIX) @@ -2553,26 +2493,20 @@ macro(build_grpc) ZLIB::ZLIB Threads::Threads) set_target_properties(gRPC::grpc - PROPERTIES IMPORTED_LOCATION - "${GRPC_STATIC_LIBRARY_GRPC}" - INTERFACE_INCLUDE_DIRECTORIES - "${GRPC_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES - "${GRPC_LINK_LIBRARIES}") + PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_GRPC}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${GRPC_LINK_LIBRARIES}") add_library(gRPC::grpc++ STATIC IMPORTED) set(GRPCPP_LINK_LIBRARIES gRPC::grpc ${ARROW_PROTOBUF_LIBPROTOBUF}) set_target_properties(gRPC::grpc++ - PROPERTIES IMPORTED_LOCATION - "${GRPC_STATIC_LIBRARY_GRPCPP}" - INTERFACE_INCLUDE_DIRECTORIES - "${GRPC_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES - "${GRPCPP_LINK_LIBRARIES}") + PROPERTIES IMPORTED_LOCATION "${GRPC_STATIC_LIBRARY_GRPCPP}" + INTERFACE_INCLUDE_DIRECTORIES "${GRPC_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${GRPCPP_LINK_LIBRARIES}") 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) @@ -2584,15 +2518,11 @@ 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}" - ) + 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 - $ + COMMAND ${CMAKE_COMMAND} -E copy $ ${GRPC_STATIC_LIBRARY_GRPCPP_FOR_AR} DEPENDS grpc_ep) add_library(gRPC::grpcpp_for_bundling STATIC IMPORTED) @@ -2601,17 +2531,18 @@ macro(build_grpc) "${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::address_sorting - gRPC::gpr - gRPC::grpc - gRPC::grpcpp_for_bundling - gRPC::upb) + list(APPEND + ARROW_BUNDLED_STATIC_LIBS + ${ABSL_LIBRARIES} + gRPC::address_sorting + gRPC::gpr + gRPC::grpc + gRPC::grpcpp_for_bundling + gRPC::upb) endmacro() if(ARROW_WITH_GRPC) @@ -2748,8 +2679,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") @@ -2776,14 +2707,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}) @@ -2804,20 +2735,19 @@ 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() set(_AWSSDK_TARGET_NAME AWS::${_AWSSDK_LIB}) endif() add_library(${_AWSSDK_TARGET_NAME} STATIC IMPORTED) - set_target_properties( - ${_AWSSDK_TARGET_NAME} - PROPERTIES IMPORTED_LOCATION ${_AWSSDK_STATIC_LIBRARY} INTERFACE_INCLUDE_DIRECTORIES - "${AWSSDK_INCLUDE_DIR}") + set_target_properties(${_AWSSDK_TARGET_NAME} + PROPERTIES IMPORTED_LOCATION ${_AWSSDK_STATIC_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES + "${AWSSDK_INCLUDE_DIR}") set("${_AWSSDK_LIB_NAME_PREFIX}_STATIC_LIBRARY" ${_AWSSDK_STATIC_LIBRARY}) list(APPEND AWSSDK_LIBRARIES ${_AWSSDK_TARGET_NAME}) endforeach() @@ -2874,7 +2804,7 @@ macro(build_awssdk) set_target_properties(CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}" IMPORTED_LOCATION - "${CURL_LIBRARIES}") + "${CURL_LIBRARIES}") endif() set_property(TARGET aws-cpp-sdk-core APPEND diff --git a/cpp/cmake_modules/Usevcpkg.cmake b/cpp/cmake_modules/Usevcpkg.cmake index 781bec436f346..7d228f59f03f6 100644 --- a/cpp/cmake_modules/Usevcpkg.cmake +++ b/cpp/cmake_modules/Usevcpkg.cmake @@ -22,7 +22,9 @@ message(STATUS "Using vcpkg to find dependencies") # macro to list subdirectirectories (non-recursive) macro(list_subdirs SUBDIRS DIR) - file(GLOB children_ RELATIVE ${DIR} ${DIR}/*) + file(GLOB children_ + RELATIVE ${DIR} + ${DIR}/*) set(subdirs_ "") foreach(child_ ${children_}) if(IS_DIRECTORY "${DIR}/${child_}") @@ -44,24 +46,27 @@ if(DEFINED CMAKE_TOOLCHAIN_FILE) get_filename_component(_VCPKG_BUILDSYSTEMS_DIR "${CMAKE_TOOLCHAIN_FILE}" DIRECTORY) get_filename_component(VCPKG_ROOT "${_VCPKG_BUILDSYSTEMS_DIR}/../.." ABSOLUTE) else() - message( - FATAL_ERROR - "vcpkg toolchain file not found at path specified in -DCMAKE_TOOLCHAIN_FILE") + message(FATAL_ERROR "vcpkg toolchain file not found at path specified in -DCMAKE_TOOLCHAIN_FILE" + ) endif() else() if(DEFINED VCPKG_ROOT) # Get it from the CMake variable VCPKG_ROOT - find_program(_VCPKG_BIN vcpkg PATHS "${VCPKG_ROOT}" NO_DEFAULT_PATH) + find_program(_VCPKG_BIN vcpkg + PATHS "${VCPKG_ROOT}" + NO_DEFAULT_PATH) if(NOT _VCPKG_BIN) message(FATAL_ERROR "vcpkg not found in directory specified in -DVCPKG_ROOT") endif() elseif(DEFINED ENV{VCPKG_ROOT}) # Get it from the environment variable VCPKG_ROOT set(VCPKG_ROOT $ENV{VCPKG_ROOT}) - find_program(_VCPKG_BIN vcpkg PATHS "${VCPKG_ROOT}" NO_DEFAULT_PATH) + find_program(_VCPKG_BIN vcpkg + PATHS "${VCPKG_ROOT}" + NO_DEFAULT_PATH) if(NOT _VCPKG_BIN) - message( - FATAL_ERROR "vcpkg not found in directory in environment variable VCPKG_ROOT") + message(FATAL_ERROR "vcpkg not found in directory in environment variable VCPKG_ROOT" + ) endif() else() # Get it from the file vcpkg.path.txt @@ -78,12 +83,13 @@ else() if(EXISTS "${_VCPKG_PATH_TXT}") file(READ "${_VCPKG_PATH_TXT}" VCPKG_ROOT) else() - message( - FATAL_ERROR - "vcpkg not found. Install vcpkg if not installed, " - "then run vcpkg integrate install or set environment variable VCPKG_ROOT.") + message(FATAL_ERROR "vcpkg not found. Install vcpkg if not installed, " + "then run vcpkg integrate install or set environment variable VCPKG_ROOT." + ) endif() - find_program(_VCPKG_BIN vcpkg PATHS "${VCPKG_ROOT}" NO_DEFAULT_PATH) + find_program(_VCPKG_BIN vcpkg + PATHS "${VCPKG_ROOT}" + NO_DEFAULT_PATH) if(NOT _VCPKG_BIN) message(FATAL_ERROR "vcpkg not found. Re-run vcpkg integrate install " "or set environment variable VCPKG_ROOT.") @@ -105,7 +111,9 @@ if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET) endif() # Explicitly set manifest mode on if it is not set and vcpkg.json exists if(NOT DEFINED VCPKG_MANIFEST_MODE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg.json") - set(VCPKG_MANIFEST_MODE ON CACHE BOOL "Use vcpkg.json manifest") + set(VCPKG_MANIFEST_MODE + ON + CACHE BOOL "Use vcpkg.json manifest") message(STATUS "vcpkg.json manifest found. Using VCPKG_MANIFEST_MODE: ON") endif() # vcpkg can install packages in three different places @@ -113,13 +121,7 @@ set(_INST_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/vcpkg_installed") # try here fi set(_INST_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed") # try here second set(_INST_VCPKG_ROOT "${VCPKG_ROOT}/installed") # Iterate over the places -foreach(_INST_DIR - IN - LISTS - _INST_BUILD_DIR - _INST_SOURCE_DIR - _INST_VCPKG_ROOT - "notfound") +foreach(_INST_DIR IN LISTS _INST_BUILD_DIR _INST_SOURCE_DIR _INST_VCPKG_ROOT "notfound") if(_INST_DIR STREQUAL "notfound") message(FATAL_ERROR "vcpkg installed libraries directory not found. " "Install packages with vcpkg before executing cmake.") @@ -158,10 +160,8 @@ if(NOT DEFINED VCPKG_TARGET_TRIPLET) message(FATAL_ERROR "Could not infer VCPKG_TARGET_TRIPLET. " "Specify triplet with -DVCPKG_TARGET_TRIPLET.") elseif(NOT DEFINED _VCPKG_INSTALLED_DIR) - message( - FATAL_ERROR - "Could not find installed vcpkg packages for triplet ${VCPKG_TARGET_TRIPLET}. " - "Install packages with vcpkg before executing cmake.") + message(FATAL_ERROR "Could not find installed vcpkg packages for triplet ${VCPKG_TARGET_TRIPLET}. " + "Install packages with vcpkg before executing cmake.") endif() set(VCPKG_TARGET_TRIPLET @@ -194,24 +194,50 @@ set(ARROW_VCPKG_PREFIX "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "Path to target triplet subdirectory in vcpkg installed directory") -set(ARROW_VCPKG ON CACHE BOOL "Use vcpkg for dependencies") +set(ARROW_VCPKG + ON + CACHE BOOL "Use vcpkg for dependencies") set(ARROW_DEPENDENCY_SOURCE "SYSTEM" CACHE STRING "The specified value VCPKG is implemented internally as SYSTEM" FORCE) -set(BOOST_ROOT "${ARROW_VCPKG_PREFIX}" CACHE STRING "") -set(BOOST_INCLUDEDIR "${ARROW_VCPKG_PREFIX}/include/boost" CACHE STRING "") -set(BOOST_LIBRARYDIR "${ARROW_VCPKG_PREFIX}/lib" CACHE STRING "") -set(OPENSSL_INCLUDE_DIR "${ARROW_VCPKG_PREFIX}/include" CACHE STRING "") -set(OPENSSL_LIBRARIES "${ARROW_VCPKG_PREFIX}/lib" CACHE STRING "") -set(OPENSSL_ROOT_DIR "${ARROW_VCPKG_PREFIX}" CACHE STRING "") -set(Thrift_ROOT "${ARROW_VCPKG_PREFIX}/lib" CACHE STRING "") -set(ZSTD_INCLUDE_DIR "${ARROW_VCPKG_PREFIX}/include" CACHE STRING "") -set(ZSTD_ROOT "${ARROW_VCPKG_PREFIX}" CACHE STRING "") +set(BOOST_ROOT + "${ARROW_VCPKG_PREFIX}" + CACHE STRING "") +set(BOOST_INCLUDEDIR + "${ARROW_VCPKG_PREFIX}/include/boost" + CACHE STRING "") +set(BOOST_LIBRARYDIR + "${ARROW_VCPKG_PREFIX}/lib" + CACHE STRING "") +set(OPENSSL_INCLUDE_DIR + "${ARROW_VCPKG_PREFIX}/include" + CACHE STRING "") +set(OPENSSL_LIBRARIES + "${ARROW_VCPKG_PREFIX}/lib" + CACHE STRING "") +set(OPENSSL_ROOT_DIR + "${ARROW_VCPKG_PREFIX}" + CACHE STRING "") +set(Thrift_ROOT + "${ARROW_VCPKG_PREFIX}/lib" + CACHE STRING "") +set(ZSTD_INCLUDE_DIR + "${ARROW_VCPKG_PREFIX}/include" + CACHE STRING "") +set(ZSTD_ROOT + "${ARROW_VCPKG_PREFIX}" + CACHE STRING "") if(CMAKE_HOST_WIN32) - set(LZ4_MSVC_LIB_PREFIX "" CACHE STRING "") - set(LZ4_MSVC_STATIC_LIB_SUFFIX "" CACHE STRING "") - set(ZSTD_MSVC_LIB_PREFIX "" CACHE STRING "") + set(LZ4_MSVC_LIB_PREFIX + "" + CACHE STRING "") + set(LZ4_MSVC_STATIC_LIB_SUFFIX + "" + CACHE STRING "") + set(ZSTD_MSVC_LIB_PREFIX + "" + CACHE STRING "") endif() diff --git a/cpp/cmake_modules/san-config.cmake b/cpp/cmake_modules/san-config.cmake index 5eee6278009e3..bde9af23e576c 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,31 @@ if(${ARROW_USE_TSAN}) endif() if(${ARROW_USE_COVERAGE}) - 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" - ) + 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." - ) + 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/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index 8e411898a3412..79b48461f9bc8 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -261,11 +261,8 @@ set(ARROW_C_SRCS vendored/uriparser/UriShorten.c) set_source_files_properties(vendored/datetime/tz.cpp - PROPERTIES - SKIP_PRECOMPILE_HEADERS - ON - SKIP_UNITY_BUILD_INCLUSION - ON) + PROPERTIES SKIP_PRECOMPILE_HEADERS ON + SKIP_UNITY_BUILD_INCLUSION ON) # Disable DLL exports in vendored uriparser library add_definitions(-DURI_STATIC_BUILD) @@ -326,16 +323,12 @@ 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) @@ -351,14 +344,15 @@ 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) if(ARROW_COMPUTE) list(APPEND ARROW_SRCS csv/writer.cc) endif() @@ -367,50 +361,51 @@ if(ARROW_CSV) 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/exec/exec_plan.cc - compute/exec/expression.cc - compute/function.cc - compute/kernel.cc - compute/registry.cc - compute/kernels/aggregate_basic.cc - compute/kernels/aggregate_mode.cc - compute/kernels/aggregate_quantile.cc - compute/kernels/aggregate_tdigest.cc - compute/kernels/aggregate_var_std.cc - compute/kernels/codegen_internal.cc - compute/kernels/hash_aggregate.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_temporal.cc - compute/kernels/scalar_validity.cc - compute/kernels/scalar_fill_null.cc - compute/kernels/scalar_if_else.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 - compute/exec/key_hash.cc - compute/exec/key_map.cc - compute/exec/key_compare.cc - compute/exec/key_encode.cc - compute/exec/util.cc) + list(APPEND + ARROW_SRCS + compute/api_aggregate.cc + compute/api_scalar.cc + compute/api_vector.cc + compute/cast.cc + compute/exec.cc + compute/exec/exec_plan.cc + compute/exec/expression.cc + compute/function.cc + compute/kernel.cc + compute/registry.cc + compute/kernels/aggregate_basic.cc + compute/kernels/aggregate_mode.cc + compute/kernels/aggregate_quantile.cc + compute/kernels/aggregate_tdigest.cc + compute/kernels/aggregate_var_std.cc + compute/kernels/codegen_internal.cc + compute/kernels/hash_aggregate.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_temporal.cc + compute/kernels/scalar_validity.cc + compute/kernels/scalar_fill_null.cc + compute/kernels/scalar_if_else.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 + compute/exec/key_hash.cc + compute/exec/key_map.cc + compute/exec/key_compare.cc + compute/exec/key_encode.cc + compute/exec/util.cc) append_avx2_src(compute/kernels/aggregate_basic_avx2.cc) append_avx512_src(compute/kernels/aggregate_basic_avx512.cc) @@ -429,12 +424,13 @@ if(ARROW_FILESYSTEM) add_definitions(-DARROW_HDFS) endif() - list(APPEND ARROW_SRCS - filesystem/filesystem.cc - filesystem/localfs.cc - filesystem/mockfs.cc - filesystem/path_util.cc - filesystem/util_internal.cc) + list(APPEND + ARROW_SRCS + filesystem/filesystem.cc + filesystem/localfs.cc + filesystem/mockfs.cc + filesystem/path_util.cc + filesystem/util_internal.cc) if(ARROW_HDFS) list(APPEND ARROW_SRCS filesystem/hdfs.cc) @@ -442,25 +438,23 @@ if(ARROW_FILESYSTEM) 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) + 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) @@ -468,15 +462,16 @@ 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/object_parser.cc - json/object_writer.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/object_parser.cc + json/object_writer.cc + json/parser.cc + json/reader.cc) endif() if(ARROW_ORC) @@ -627,12 +622,8 @@ add_arrow_test(misc_test 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) diff --git a/cpp/src/arrow/adapters/orc/CMakeLists.txt b/cpp/src/arrow/adapters/orc/CMakeLists.txt index 516196c2eefb4..ca901b07dfd69 100644 --- a/cpp/src/arrow/adapters/orc/CMakeLists.txt +++ b/cpp/src/arrow/adapters/orc/CMakeLists.txt @@ -53,9 +53,5 @@ add_arrow_test(adapter_test 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/dbi/hiveserver2/CMakeLists.txt b/cpp/src/arrow/dbi/hiveserver2/CMakeLists.txt index e8bb533b18ed5..2638456c61cb9 100644 --- a/cpp/src/arrow/dbi/hiveserver2/CMakeLists.txt +++ b/cpp/src/arrow/dbi/hiveserver2/CMakeLists.txt @@ -56,11 +56,9 @@ set(HIVESERVER2_THRIFT_SRC Types_types.cpp) set_source_files_properties(${HIVESERVER2_THRIFT_SRC} - PROPERTIES - COMPILE_FLAGS - "-Wno-unused-variable -Wno-shadow-field" - GENERATED - TRUE) + PROPERTIES COMPILE_FLAGS + "-Wno-unused-variable -Wno-shadow-field" GENERATED + TRUE) # keep everything in one library, the object files reference # each other @@ -75,9 +73,9 @@ 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}") +set_target_properties(arrow_hiveserver2_thrift + PROPERTIES LIBRARY_OUTPUT_DIRECTORY + "${BUILD_OUTPUT_ROOT_DIRECTORY}") add_arrow_lib(arrow_hiveserver2 SOURCES diff --git a/cpp/src/arrow/dbi/hiveserver2/thrift/CMakeLists.txt b/cpp/src/arrow/dbi/hiveserver2/thrift/CMakeLists.txt index f6c88473a6ed9..237a92a827d4e 100644 --- a/cpp/src/arrow/dbi/hiveserver2/thrift/CMakeLists.txt +++ b/cpp/src/arrow/dbi/hiveserver2/thrift/CMakeLists.txt @@ -44,9 +44,9 @@ 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 @@ -80,7 +80,9 @@ function(HS2_THRIFT_GEN VAR) VERBATIM) endforeach(FIL) - set(${VAR} ${${VAR}} PARENT_SCOPE) + set(${VAR} + ${${VAR}} + PARENT_SCOPE) endfunction(HS2_THRIFT_GEN) message("Using Thrift compiler: ${THRIFT_COMPILER}") @@ -102,8 +104,9 @@ 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 473a5ecc0f151..c917db3b99ca6 100644 --- a/cpp/src/arrow/filesystem/CMakeLists.txt +++ b/cpp/src/arrow/filesystem/CMakeLists.txt @@ -47,8 +47,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) @@ -60,8 +60,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 e1176ff0ac072..4e46243b18da1 100644 --- a/cpp/src/arrow/flight/CMakeLists.txt +++ b/cpp/src/arrow/flight/CMakeLists.txt @@ -26,9 +26,9 @@ if(WIN32) 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}) @@ -39,10 +39,10 @@ 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) @@ -50,8 +50,7 @@ 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}" + COMMAND ${ARROW_PROTOBUF_PROTOC} "-I${FLIGHT_PROTO_PATH}" "--grpc_out=${CMAKE_CURRENT_BINARY_DIR}" "--plugin=protoc-gen-grpc=$" "${FLIGHT_PROTO}") @@ -70,13 +69,13 @@ string(REPLACE "-Werror " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # verification when using TLS. function(test_grpc_version DST_VAR DETECT_VERSION TEST_FILE) if(NOT DEFINED ${DST_VAR}) - message( - STATUS "Checking support for TlsCredentialsOptions (gRPC >= ${DETECT_VERSION})...") + message(STATUS "Checking support for TlsCredentialsOptions (gRPC >= ${DETECT_VERSION})..." + ) get_property(CURRENT_INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) - try_compile(HAS_GRPC_VERSION ${CMAKE_CURRENT_BINARY_DIR}/try_compile SOURCES - "${CMAKE_CURRENT_SOURCE_DIR}/try_compile/${TEST_FILE}" + try_compile(HAS_GRPC_VERSION ${CMAKE_CURRENT_BINARY_DIR}/try_compile + SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/try_compile/${TEST_FILE}" CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CURRENT_INCLUDE_DIRECTORIES}" LINK_LIBRARIES gRPC::grpc++ OUTPUT_VARIABLE TLS_CREDENTIALS_OPTIONS_CHECK_OUTPUT CXX_STANDARD 11) @@ -85,10 +84,8 @@ function(test_grpc_version DST_VAR DETECT_VERSION TEST_FILE) "${DETECT_VERSION}" CACHE INTERNAL "The detected (approximate) gRPC version.") else() - message( - STATUS - "TlsCredentialsOptions (for gRPC ${DETECT_VERSION}) not found in grpc::experimental." - ) + message(STATUS "TlsCredentialsOptions (for gRPC ${DETECT_VERSION}) not found in grpc::experimental." + ) message(DEBUG "Build output:") list(APPEND CMAKE_MESSAGE_INDENT "${TEST_FILE}: ") message(DEBUG ${TLS_CREDENTIALS_OPTIONS_CHECK_OUTPUT}) @@ -105,10 +102,8 @@ else() test_grpc_version(GRPC_VERSION "1.34" "check_tls_opts_134.cc") test_grpc_version(GRPC_VERSION "1.32" "check_tls_opts_132.cc") test_grpc_version(GRPC_VERSION "1.27" "check_tls_opts_127.cc") - message( - STATUS - "Found approximate gRPC version: ${GRPC_VERSION} (ARROW_FLIGHT_REQUIRE_TLSCREDENTIALSOPTIONS=${ARROW_FLIGHT_REQUIRE_TLSCREDENTIALSOPTIONS})" - ) + message(STATUS "Found approximate gRPC version: ${GRPC_VERSION} (ARROW_FLIGHT_REQUIRE_TLSCREDENTIALSOPTIONS=${ARROW_FLIGHT_REQUIRE_TLSCREDENTIALSOPTIONS})" + ) endif() if(GRPC_VERSION EQUAL "1.27") add_definitions(-DGRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS=grpc_impl::experimental) @@ -122,18 +117,13 @@ elseif(GRPC_VERSION EQUAL "1.36") add_definitions(-DGRPC_USE_TLS_CHANNEL_CREDENTIALS_OPTIONS -DGRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS=grpc::experimental) else() - message( - STATUS - "A proper version of gRPC could not be found to support TlsCredentialsOptions in Arrow Flight." - ) - message( - STATUS - "You may need a newer version of gRPC (>= 1.27), or the gRPC API has changed and Flight must be updated to match." - ) + message(STATUS "A proper version of gRPC could not be found to support TlsCredentialsOptions in Arrow Flight." + ) + message(STATUS "You may need a newer version of gRPC (>= 1.27), or the gRPC API has changed and Flight must be updated to match." + ) if(ARROW_FLIGHT_REQUIRE_TLSCREDENTIALSOPTIONS) - message( - FATAL_ERROR "Halting build since ARROW_FLIGHT_REQUIRE_TLSCREDENTIALSOPTIONS is set." - ) + message(FATAL_ERROR "Halting build since ARROW_FLIGHT_REQUIRE_TLSCREDENTIALSOPTIONS is set." + ) endif() endif() @@ -211,8 +201,9 @@ if(ARROW_TESTING) 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 diff --git a/cpp/src/arrow/gpu/CMakeLists.txt b/cpp/src/arrow/gpu/CMakeLists.txt index af8cf31796920..a1c182a58bba2 100644 --- a/cpp/src/arrow/gpu/CMakeLists.txt +++ b/cpp/src/arrow/gpu/CMakeLists.txt @@ -51,7 +51,8 @@ add_arrow_lib(arrow_cuda 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}) + STATIC_LINK_LIBS + ${ARROW_CUDA_SHARED_LINK_LIBS}) add_dependencies(arrow_cuda ${ARROW_CUDA_LIBRARIES}) diff --git a/cpp/src/arrow/python/CMakeLists.txt b/cpp/src/arrow/python/CMakeLists.txt index 960155703e1ed..40f351b56a5d2 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,9 @@ 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) @@ -159,8 +157,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() 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/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt index 44b6fab14c30d..83cec08e71c1d 100644 --- a/cpp/src/gandiva/CMakeLists.txt +++ b/cpp/src/gandiva/CMakeLists.txt @@ -97,8 +97,8 @@ set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared LLVM::LLVM_INTERFACE set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_INTERFACE ${GANDIVA_OPENSSL_LIBS}) -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() @@ -210,8 +210,11 @@ endfunction() set(GANDIVA_INTERNALS_TEST_ARGUMENTS) if(WIN32) - list(APPEND GANDIVA_INTERNALS_TEST_ARGUMENTS EXTRA_LINK_LIBS LLVM::LLVM_INTERFACE - ${GANDIVA_OPENSSL_LIBS}) + list(APPEND + GANDIVA_INTERNALS_TEST_ARGUMENTS + EXTRA_LINK_LIBS + LLVM::LLVM_INTERFACE + ${GANDIVA_OPENSSL_LIBS}) endif() add_gandiva_test(internals-test SOURCES diff --git a/cpp/src/gandiva/jni/CMakeLists.txt b/cpp/src/gandiva/jni/CMakeLists.txt index b456d5f3def36..04fd22eec9abe 100644 --- a/cpp/src/gandiva/jni/CMakeLists.txt +++ b/cpp/src/gandiva/jni/CMakeLists.txt @@ -32,14 +32,12 @@ 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 + 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} @@ -101,9 +99,9 @@ if(ARROW_BUILD_SHARED) # filter out everything that is not needed for the jni bridge # statically linked stdc++ has conflicts with stdc++ loaded by other libraries. if(NOT APPLE) - set_target_properties( - gandiva_jni_shared - PROPERTIES LINK_FLAGS - "-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/gandiva/jni/symbols.map") + set_target_properties(gandiva_jni_shared + PROPERTIES LINK_FLAGS + "-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/gandiva/jni/symbols.map" + ) endif() endif() diff --git a/cpp/src/gandiva/precompiled/CMakeLists.txt b/cpp/src/gandiva/precompiled/CMakeLists.txt index 176b0473855a9..1cd505b44a39b 100644 --- a/cpp/src/gandiva/precompiled/CMakeLists.txt +++ b/cpp/src/gandiva/precompiled/CMakeLists.txt @@ -53,35 +53,38 @@ 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) + 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) 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() @@ -96,13 +99,12 @@ 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} + ${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) @@ -130,11 +132,8 @@ if(ARROW_BUILD_TESTS) ../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 diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt index 3f3ca5a529917..a487760a03ea7 100644 --- a/cpp/src/parquet/CMakeLists.txt +++ b/cpp/src/parquet/CMakeLists.txt @@ -127,19 +127,15 @@ 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 +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) + 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() # @@ -182,21 +178,16 @@ 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}") + 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") + PROPERTIES SKIP_PRECOMPILE_HEADERS ON + COMPILE_FLAGS + "${ARROW_AVX2_FLAG} -DARROW_HAVE_BMI2 -mbmi2") endif() if(PARQUET_REQUIRE_ENCRYPTION) @@ -297,12 +288,9 @@ 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) + PRIVATE PARQUET_EXPORTING + PRIVATE HAVE_INTTYPES_H + PRIVATE HAVE_NETDB_H) if(WIN32) target_compile_definitions(${LIB_TARGET} PRIVATE NOMINMAX) else() @@ -336,12 +324,8 @@ add_parquet_test(internals-test types_test.cc test_util.cc) -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_parquet_test(reader_test SOURCES diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt index 8c8523a37d556..a4e6e72b41b05 100644 --- a/cpp/src/plasma/CMakeLists.txt +++ b/cpp/src/plasma/CMakeLists.txt @@ -98,14 +98,17 @@ 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 \ + 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 +131,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 @@ -138,12 +141,9 @@ elseif(APPLE) # 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") + PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE + INSTALL_RPATH_USE_LINK_PATH TRUE + INSTALL_RPATH "$ENV{CONDA_PREFIX}/lib") endif() endif() @@ -156,8 +156,8 @@ install(FILES common.h # Plasma store set_target_properties(plasma-store-server PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) -install(TARGETS plasma-store-server ${INSTALL_IS_OPTIONAL} 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 diff --git a/dev/archery/archery/utils/command.py b/dev/archery/archery/utils/command.py index 84d2842073f38..f655e2ef2e58d 100644 --- a/dev/archery/archery/utils/command.py +++ b/dev/archery/archery/utils/command.py @@ -50,7 +50,8 @@ def wrapper(*argv, **kwargs): class Command: - """ A runnable command. + """ + A runnable command. Class inheriting from the Command class must provide the bin property/attribute. @@ -78,7 +79,9 @@ def run(self, *argv, **kwargs): @property def available(self): - """ Indicate if the command binary is found in PATH. """ + """ + Indicate if the command binary is found in PATH. + """ binary = shlex.split(self.bin)[0] return shutil.which(binary) is not None diff --git a/dev/archery/archery/utils/lint.py b/dev/archery/archery/utils/lint.py index 0b0e8b46948ef..d95bfeea309a9 100644 --- a/dev/archery/archery/utils/lint.py +++ b/dev/archery/archery/utils/lint.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. +import fnmatch import gzip import os from pathlib import Path @@ -31,6 +32,11 @@ from .tmpdir import tmpdir +_archery_install_msg = ( + "Please install archery using: `pip install -e dev/archery[lint]`. " +) + + class LintValidationException(Exception): pass @@ -90,20 +96,75 @@ def cpp_linter(src, build_dir, clang_format=True, cpplint=True, class CMakeFormat(Command): - def __init__(self, cmake_format_bin): - self.bin = cmake_format_bin + + def __init__(self, paths, cmake_format_bin=None): + self.check_version() + self.bin = default_bin(cmake_format_bin, "cmake-format") + self.paths = paths + + @classmethod + def from_patterns(cls, base_path, include_patterns, exclude_patterns): + paths = { + str(path.as_posix()) + for pattern in include_patterns + for path in base_path.glob(pattern) + } + for pattern in exclude_patterns: + pattern = (base_path / pattern).as_posix() + paths -= set(fnmatch.filter(paths, str(pattern))) + return cls(paths) + + @staticmethod + def check_version(): + try: + # cmake_format is part of the cmakelang package + import cmakelang + except ImportError: + raise ImportError( + + ) + # pin a specific version of cmake_format, must be updated in setup.py + if cmakelang.__version__ != "0.6.13": + raise LintValidationException( + f"Wrong version of cmake_format is detected. " + f"{_archery_install_msg}" + ) + + def check(self): + return self.run("-l", "error", "--check", *self.paths, check=False) + + def fix(self): + return self.run("--in-place", *self.paths, check=False) def cmake_linter(src, fix=False): - """ Run cmake-format.py on all CMakeFiles.txt """ + """ + Run cmake-format on all CMakeFiles.txt + """ logger.info("Running cmake-format linters") - if not fix: - logger.warn("run-cmake-format modifies files, regardless of --fix") + cmake_format = CMakeFormat.from_patterns( + src.path, + include_patterns=[ + 'ci/**/*.cmake', + 'cpp/CMakeLists.txt', + 'cpp/src/**/CMakeLists.txt', + 'cpp/cmake_modules/*.cmake', + 'go/**/CMakeLists.txt', + 'java/**/CMakeLists.txt', + 'matlab/**/CMakeLists.txt', + 'python/CMakeLists.txt', + ], + exclude_patterns=[ + 'cpp/cmake_modules/FindNumPy.cmake', + 'cpp/cmake_modules/FindPythonLibsNew.cmake', + 'cpp/cmake_modules/UseCython.cmake', + 'cpp/src/arrow/util/config.h.cmake', + ] + ) + method = cmake_format.fix if fix else cmake_format.check - arrow_cmake_format = os.path.join(src.path, "run-cmake-format.py") - cmake_format = CMakeFormat(cmake_format_bin=arrow_cmake_format) - yield LintResult.from_cmd(cmake_format("--check")) + yield LintResult.from_cmd(method()) def python_linter(src, fix=False): @@ -118,7 +179,7 @@ def python_linter(src, fix=False): if not autopep8.available: logger.error( "Python formatter requested but autopep8 binary not found. " - "Please run `pip install -r dev/archery/requirements-lint.txt`") + f"{_archery_install_msg}") return # Gather files for autopep8 @@ -127,8 +188,7 @@ def python_linter(src, fix=False): "python/pyarrow/**/*.pxd", "python/pyarrow/**/*.pxi", "python/examples/**/*.py", - "dev/archery/**/*.py", - ] + "dev/archery/**/*.py"] files = [setup_py] for pattern in patterns: files += list(map(str, Path(src.path).glob(pattern))) @@ -158,7 +218,7 @@ def python_linter(src, fix=False): if not flake8.available: logger.error( "Python linter requested but flake8 binary not found. " - "Please run `pip install -r dev/archery/requirements-lint.txt`") + f"{_archery_install_msg}") return flake8_exclude = ['.venv*'] diff --git a/dev/archery/requirements-lint.txt b/dev/archery/requirements-lint.txt deleted file mode 100644 index fc7f339ed4dbe..0000000000000 --- a/dev/archery/requirements-lint.txt +++ /dev/null @@ -1,3 +0,0 @@ -autopep8 -flake8 -cmake_format==0.5.2 diff --git a/dev/archery/setup.py b/dev/archery/setup.py index a363824f8c9de..eb70551de52f4 100755 --- a/dev/archery/setup.py +++ b/dev/archery/setup.py @@ -28,7 +28,7 @@ jinja_req = 'jinja2>=2.11' extras = { - 'lint': ['numpydoc==1.1.0', 'autopep8', 'flake8', 'cmake_format==0.5.2'], + 'lint': ['numpydoc==1.1.0', 'autopep8', 'flake8', 'cmake_format==0.6.13'], 'benchmark': ['pandas'], 'docker': ['ruamel.yaml', 'python-dotenv'], 'release': [jinja_req, 'jira', 'semver', 'gitpython'], diff --git a/docker-compose.yml b/docker-compose.yml index fa0f0a28ad1f4..79618a1cfedfb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1332,10 +1332,7 @@ services: environment: <<: *ccache volumes: *ubuntu-volumes - command: > - /bin/bash -c " - pip install -e /arrow/dev/archery && - archery lint --all --no-clang-tidy --no-iwyu --no-numpydoc" + command: archery lint --all --no-clang-tidy --no-iwyu --no-numpydoc ######################### Integration Tests ################################# diff --git a/docs/source/developers/cpp/development.rst b/docs/source/developers/cpp/development.rst index c0f5a0f269a3b..ca7b64a6dc769 100644 --- a/docs/source/developers/cpp/development.rst +++ b/docs/source/developers/cpp/development.rst @@ -100,7 +100,7 @@ following checks: * Passes various C++ (and others) style checks, checked with the ``lint`` subcommand to :ref:`Archery `. * CMake files pass style checks, can be fixed by running - ``run-cmake-format.py`` from the root of the repository. This requires Python + ``archery lint --cmake-format --fix``. This requires Python 3 and `cmake_format `_ (note: this currently does not work on Windows) diff --git a/docs/source/developers/python.rst b/docs/source/developers/python.rst index d1fe086cb159e..f2fbb927ac9bc 100644 --- a/docs/source/developers/python.rst +++ b/docs/source/developers/python.rst @@ -34,8 +34,7 @@ We follow a similar PEP8-like coding style to the `pandas project .. code-block:: shell - pip install -e arrow/dev/archery - pip install -r arrow/dev/archery/requirements-lint.txt + pip install -e arrow/dev/archery[lint] .. code-block:: shell diff --git a/java/gandiva/CMakeLists.txt b/java/gandiva/CMakeLists.txt index 0a7c4d03e3bec..5010daf799620 100644 --- a/java/gandiva/CMakeLists.txt +++ b/java/gandiva/CMakeLists.txt @@ -28,35 +28,28 @@ message("generating headers to ${JNI_HEADERS_DIR}/jni") # centos5 does not have java8 images, so supporting java 7 too. # unfortunately create_javah does not work in java8 correctly. if(ARROW_GANDIVA_JAVA7) - add_jar( - gandiva_java - src/main/java/org/apache/arrow/gandiva/evaluator/ConfigurationBuilder.java - src/main/java/org/apache/arrow/gandiva/evaluator/JniWrapper.java - src/main/java/org/apache/arrow/gandiva/evaluator/ExpressionRegistryJniHelper.java - src/main/java/org/apache/arrow/gandiva/exceptions/GandivaException.java) + add_jar(gandiva_java + src/main/java/org/apache/arrow/gandiva/evaluator/ConfigurationBuilder.java + src/main/java/org/apache/arrow/gandiva/evaluator/JniWrapper.java + 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 - src/main/java/org/apache/arrow/gandiva/evaluator/ConfigurationBuilder.java - src/main/java/org/apache/arrow/gandiva/evaluator/JniWrapper.java - src/main/java/org/apache/arrow/gandiva/evaluator/ExpressionRegistryJniHelper.java - src/main/java/org/apache/arrow/gandiva/exceptions/GandivaException.java - GENERATE_NATIVE_HEADERS - gandiva_jni_headers - DESTINATION - ${JNI_HEADERS_DIR}/jni) + add_jar(gandiva_java + src/main/java/org/apache/arrow/gandiva/evaluator/ConfigurationBuilder.java + src/main/java/org/apache/arrow/gandiva/evaluator/JniWrapper.java + src/main/java/org/apache/arrow/gandiva/evaluator/ExpressionRegistryJniHelper.java + src/main/java/org/apache/arrow/gandiva/exceptions/GandivaException.java + GENERATE_NATIVE_HEADERS + gandiva_jni_headers + DESTINATION + ${JNI_HEADERS_DIR}/jni) endif() diff --git a/matlab/CMakeLists.txt b/matlab/CMakeLists.txt index 3c03e6791ee0e..09c8839aaf021 100644 --- a/matlab/CMakeLists.txt +++ b/matlab/CMakeLists.txt @@ -37,24 +37,14 @@ 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 52220767854e9..8f91fbeb0ddc8 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -81,7 +81,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) @@ -132,8 +134,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") @@ -172,10 +174,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}") @@ -237,20 +236,17 @@ function(bundle_arrow_lib library_path) # Only copy the shared library with ABI version on Linux and macOS if(MSVC) - configure_file( - ${${library_path}} - ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} - COPYONLY) + configure_file(${${library_path}} + ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} + COPYONLY) elseif(APPLE) - configure_file( - ${LIBRARY_DIR}/${LIBRARY_NAME}.${ARG_SO_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} - ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME}.${ARG_SO_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} - COPYONLY) + configure_file(${LIBRARY_DIR}/${LIBRARY_NAME}.${ARG_SO_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} + ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME}.${ARG_SO_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} + COPYONLY) else() - configure_file( - ${${library_path}}.${ARG_SO_VERSION} - ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${ARG_SO_VERSION} - COPYONLY) + configure_file(${${library_path}}.${ARG_SO_VERSION} + ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${ARG_SO_VERSION} + COPYONLY) endif() endfunction(bundle_arrow_lib) @@ -270,15 +266,13 @@ function(bundle_boost_lib library_path) set(Boost_SO_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") if(APPLE) - configure_file( - ${${library_path}} - ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME_WE}${CMAKE_SHARED_LIBRARY_SUFFIX} - COPYONLY) + configure_file(${${library_path}} + ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME_WE}${CMAKE_SHARED_LIBRARY_SUFFIX} + COPYONLY) else() - configure_file( - ${${library_path}} - ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME_WE}${CMAKE_SHARED_LIBRARY_SUFFIX}.${Boost_SO_VERSION} - COPYONLY) + configure_file(${${library_path}} + ${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIBRARY_NAME_WE}${CMAKE_SHARED_LIBRARY_SUFFIX}.${Boost_SO_VERSION} + COPYONLY) endif() endfunction() @@ -320,9 +314,8 @@ function(bundle_arrow_dependency library_name) if(SHARED_LIB_PATH) get_filename_component(SHARED_LIB_REALPATH ${SHARED_LIB_PATH} REALPATH) get_filename_component(SHARED_LIB_NAME ${SHARED_LIB_PATH} NAME) - message( - STATUS - "Bundle dependency ${library_name}: ${SHARED_LIB_REALPATH} as ${SHARED_LIB_NAME}") + message(STATUS "Bundle dependency ${library_name}: ${SHARED_LIB_REALPATH} as ${SHARED_LIB_NAME}" + ) configure_file(${SHARED_LIB_REALPATH} ${BUILD_OUTPUT_ROOT_DIRECTORY}/${SHARED_LIB_NAME} COPYONLY) else() @@ -367,7 +360,9 @@ 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() @@ -461,7 +456,9 @@ 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) @@ -556,8 +553,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) @@ -585,9 +582,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}) diff --git a/run-cmake-format.py b/run-cmake-format.py deleted file mode 100755 index 1ff103868d84b..0000000000000 --- a/run-cmake-format.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python3 - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -import argparse -import fnmatch -import hashlib -import pathlib -import subprocess -import sys - -# Keep an explicit list of files to format as we don't want to reformat -# files we imported from other location. -PATTERNS = [ - 'ci/**/*.cmake', - 'cpp/CMakeLists.txt', - 'cpp/src/**/CMakeLists.txt', - 'cpp/cmake_modules/*.cmake', - 'go/**/CMakeLists.txt', - 'java/**/CMakeLists.txt', - 'matlab/**/CMakeLists.txt', -] -EXCLUDE = [ - 'cpp/cmake_modules/FindNumPy.cmake', - 'cpp/cmake_modules/FindPythonLibsNew.cmake', - 'cpp/cmake_modules/UseCython.cmake', - 'cpp/src/arrow/util/config.h.cmake', -] - -here = pathlib.Path(__file__).parent - - -def find_cmake_files(): - for pat in PATTERNS: - yield from here.glob(pat) - - -def run_cmake_format(paths): - # cmake-format is fast enough that running in parallel doesn't seem - # necessary - # autosort is off because it breaks in cmake_format 5.1 - # See: https://github.com/cheshirekow/cmake_format/issues/111 - cmd = ['cmake-format', '--in-place', '--autosort=false'] + paths - try: - subprocess.run(cmd, check=True) - except FileNotFoundError: - try: - import cmake_format - except ImportError: - raise ImportError( - "Please install cmake-format: `pip install cmake_format`") - else: - # Other error, re-raise - raise - - -def check_cmake_format(paths): - hashes = {} - for p in paths: - contents = p.read_bytes() - hashes[p] = hashlib.sha256(contents).digest() - - run_cmake_format(paths) - - # Check contents didn't change - changed = [] - for p in paths: - contents = p.read_bytes() - if hashes[p] != hashlib.sha256(contents).digest(): - changed.append(p) - - if changed: - items = "\n".join("- %s" % p for p in sorted(changed)) - print("The following cmake files need re-formatting:\n%s" % (items,)) - print() - print("Consider running `run-cmake-format.py`") - sys.exit(1) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument('--check', action='store_true') - parser.add_argument('paths', nargs='*', type=pathlib.Path) - args = parser.parse_args() - - paths = find_cmake_files() - if args.paths: - paths = set(paths) & set([path.resolve() for path in args.paths]) - paths = [ - path for path in paths - if path.relative_to(here).as_posix() not in EXCLUDE - ] - if args.check: - check_cmake_format(paths) - else: - run_cmake_format(paths)