Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ jobs:
CMAKE_INSTALL_LIBDIR: bin
CMAKE_INSTALL_PREFIX: /usr
CMAKE_UNITY_BUILD: ON
CMAKE_VERBOSE_MAKEFILE: ON
VERBOSE: ON
steps:
- name: Disable Crash Dialogs
run: |
Expand Down
2 changes: 1 addition & 1 deletion c_glib/arrow-glib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ gio = cxx.find_library('gio-2.0', dirs: [gobject_libdir], required: false)
if not gio.found()
gio = dependency('gio-2.0')
endif
dependencies = [arrow, arrow_acero, gobject, gio]
dependencies = [arrow, arrow_compute, arrow_acero, gobject, gio]
libarrow_glib = library(
'arrow-glib',
sources: sources + enums,
Expand Down
12 changes: 11 additions & 1 deletion c_glib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ if arrow_cpp_build_lib_dir == ''
modules: ['ArrowCUDA::arrow_cuda_shared'],
required: false,
)
# we do not support compiling GLib without Acero engine
# we do not support compiling glib without Compute and Acero engine
arrow_compute = dependency(
'arrow-compute',
required: true,
version: ['>=' + version],
)
arrow_acero = dependency(
'arrow-acero',
'ArrowAcero',
Expand Down Expand Up @@ -220,6 +225,11 @@ main(void)
dirs: [arrow_cpp_build_lib_dir],
required: true,
)
arrow_compute = cpp_compiler.find_library(
'arrow_compute',
dirs: [arrow_cpp_build_lib_dir],
required: true,
)
arrow_dataset = cpp_compiler.find_library(
'arrow_dataset',
dirs: [arrow_cpp_build_lib_dir],
Expand Down
1 change: 1 addition & 0 deletions ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ else
-DBUILD_WARNING_LEVEL=${BUILD_WARNING_LEVEL:-CHECKIN} \
-Dc-ares_SOURCE=${cares_SOURCE:-} \
-DCMAKE_BUILD_TYPE=${ARROW_BUILD_TYPE:-debug} \
-DVERBOSE=${VERBOSE:-OFF} \
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE:-OFF} \
-DCMAKE_C_FLAGS="${CFLAGS:-}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS:-}" \
Expand Down
7 changes: 7 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,13 @@ if(ARROW_BUILD_STATIC)
string(APPEND ARROW_ACERO_PC_CFLAGS_PRIVATE " -DARROW_ACERO_STATIC")
endif()

# For arrow-compute.pc.
set(ARROW_COMPUTE_PC_CFLAGS "")
set(ARROW_COMPUTE_PC_CFLAGS_PRIVATE "")
if(ARROW_BUILD_STATIC)
string(APPEND ARROW_COMPUTE_PC_CFLAGS_PRIVATE " -DARROW_COMPUTE_STATIC")
endif()

# For arrow-cuda.pc.
set(ARROW_CUDA_PC_CFLAGS "")
set(ARROW_CUDA_PC_CFLAGS_PRIVATE "")
Expand Down
9 changes: 8 additions & 1 deletion cpp/cmake_modules/BuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ function(ADD_TEST_CASE REL_TEST_NAME)
SOURCES
STATIC_LINK_LIBS
EXTRA_LINK_LIBS
EXTRA_LINK_OPTIONS
EXTRA_INCLUDES
EXTRA_DEPENDENCIES
LABELS
Expand Down Expand Up @@ -802,7 +803,13 @@ endfunction()
function(ADD_ARROW_EXAMPLE REL_EXAMPLE_NAME)
set(options)
set(one_value_args PREFIX)
set(multi_value_args EXTRA_INCLUDES EXTRA_LINK_LIBS EXTRA_SOURCES DEPENDENCIES)
set(multi_value_args
EXTRA_INCLUDES
EXTRA_LINK_OPTIONS
EXTRA_LINK_LIBS
EXTRA_SOURCES
DEPENDENCIES)

cmake_parse_arguments(ARG
"${options}"
"${one_value_args}"
Expand Down
10 changes: 9 additions & 1 deletion cpp/examples/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ if(ARROW_SUBSTRAIT)
endif()

if(ARROW_COMPUTE AND ARROW_CSV)
add_arrow_example(compute_and_write_csv_example)
if(ARROW_BUILD_SHARED)
# TODO: Add Apple "-Wl,-force_load"?
set(COMPUTE_KERNELS_LINK_LIBS "-Wl,--push-state,--no-as-needed" arrow_compute_shared
"-Wl,--pop-state")
else()
set(COMPUTE_KERNELS_LINK_LIBS arrow_compute_static)
endif()
add_arrow_example(compute_and_write_csv_example EXTRA_LINK_LIBS
${COMPUTE_KERNELS_LINK_LIBS})
endif()

if(ARROW_FLIGHT)
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/tutorial_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ target_link_libraries(file_access_example PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)

add_executable(compute_example compute_example.cc)
target_link_libraries(compute_example PRIVATE Arrow::arrow_shared)
target_link_libraries(compute_example PRIVATE ArrowCompute::arrow_compute_shared)

add_executable(dataset_example dataset_example.cc)
target_link_libraries(dataset_example PRIVATE ArrowDataset::arrow_dataset_shared)
38 changes: 38 additions & 0 deletions cpp/src/arrow/ArrowComputeConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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.
#
# This config sets the following variables in your project::
#
# ArrowCompute_FOUND - true if Arrow Compute found on the system
#
# This config sets the following targets in your project::
#
# ArrowCompute::arrow_compute_shared - for linked as shared library if shared library is built
# ArrowCompute::arrow_compute_static - for linked as static library if static library is built

@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(Arrow)

include("${CMAKE_CURRENT_LIST_DIR}/ArrowComputeTargets.cmake")

arrow_keep_backward_compatibility(ArrowCompute arrow_compute)

check_required_components(ArrowCompute)

arrow_show_details(ArrowCompute ARROW_COMPUTE)
122 changes: 97 additions & 25 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -704,15 +704,14 @@ set(ARROW_COMPUTE_SRCS
compute/api_scalar.cc
compute/api_vector.cc
compute/cast.cc
compute/codegen_internal.cc
compute/exec.cc
compute/expression.cc
compute/function.cc
compute/function_internal.cc
compute/kernel.cc
compute/ordering.cc
compute/registry.cc
compute/kernels/chunked_internal.cc
compute/kernels/codegen_internal.cc
compute/kernels/ree_util_internal.cc
compute/kernels/scalar_cast_boolean.cc
compute/kernels/scalar_cast_dictionary.cc
Expand All @@ -722,27 +721,38 @@ set(ARROW_COMPUTE_SRCS
compute/kernels/scalar_cast_numeric.cc
compute/kernels/scalar_cast_string.cc
compute/kernels/scalar_cast_temporal.cc
compute/kernels/util_internal.cc
compute/kernels/vector_hash.cc
compute/kernels/vector_run_end_encode.cc
compute/kernels/vector_selection.cc
compute/kernels/vector_selection_filter_internal.cc
compute/kernels/vector_selection_internal.cc
compute/kernels/vector_selection_take_internal.cc)

if(ARROW_COMPUTE)
# If libarrow_compute.a is only built, "pkg-config --cflags --libs
# arrow-compute" outputs build flags for static linking not shared
# linking. ARROW_COMPUTE_PC_* except ARROW_COMPUTE_PC_*_PRIVATE are for
# the static linking case.
if(NOT ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC)
string(APPEND ARROW_COMPUTE_PC_CFLAGS "${ARROW_COMPUTE_PC_CFLAGS_PRIVATE}")
set(ARROW_COMPUTE_PC_CFLAGS_PRIVATE "")
endif()
# Include the remaining kernels
list(APPEND
ARROW_COMPUTE_SRCS
ARROW_COMPUTE_LIB_SRCS
compute/kernels/aggregate_basic.cc
compute/kernels/aggregate_mode.cc
compute/kernels/aggregate_pivot.cc
compute/kernels/aggregate_quantile.cc
compute/kernels/aggregate_tdigest.cc
compute/kernels/aggregate_var_std.cc
compute/kernels/codegen_internal.cc # This is wrong but I am testing something
compute/kernels/chunked_internal.cc
compute/kernels/hash_aggregate.cc
compute/kernels/hash_aggregate_numeric.cc
compute/kernels/hash_aggregate_pivot.cc
compute/kernels/pivot_internal.cc
compute/kernels/registry.cc
compute/kernels/scalar_arithmetic.cc
compute/kernels/scalar_boolean.cc
compute/kernels/scalar_compare.cc
Expand All @@ -756,13 +766,13 @@ if(ARROW_COMPUTE)
compute/kernels/scalar_temporal_binary.cc
compute/kernels/scalar_temporal_unary.cc
compute/kernels/scalar_validity.cc
compute/kernels/util_internal.cc
compute/kernels/vector_array_sort.cc
compute/kernels/vector_cumulative_ops.cc
compute/kernels/vector_nested.cc
compute/kernels/vector_pairwise.cc
compute/kernels/vector_rank.cc
compute/kernels/vector_replace.cc
compute/kernels/vector_run_end_encode.cc
compute/kernels/vector_select_k.cc
compute/kernels/vector_sort.cc
compute/kernels/vector_statistics.cc
Expand All @@ -778,39 +788,101 @@ if(ARROW_COMPUTE)
compute/util.cc
compute/util_internal.cc)

append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/kernels/aggregate_basic_avx2.cc)
append_runtime_avx512_src(ARROW_COMPUTE_SRCS compute/kernels/aggregate_basic_avx512.cc)
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/key_hash_internal_avx2.cc)
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/key_map_internal_avx2.cc)
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/compare_internal_avx2.cc)
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/encode_internal_avx2.cc)
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/util_avx2.cc)
append_runtime_avx2_src(ARROW_COMPUTE_LIB_SRCS compute/kernels/aggregate_basic_avx2.cc)
append_runtime_avx512_src(ARROW_COMPUTE_LIB_SRCS
compute/kernels/aggregate_basic_avx512.cc)
append_runtime_avx2_src(ARROW_COMPUTE_LIB_SRCS compute/key_hash_internal_avx2.cc)
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_LIB_SRCS compute/key_map_internal_avx2.cc)
append_runtime_avx2_src(ARROW_COMPUTE_LIB_SRCS compute/row/compare_internal_avx2.cc)
append_runtime_avx2_src(ARROW_COMPUTE_LIB_SRCS compute/row/encode_internal_avx2.cc)
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_LIB_SRCS compute/util_avx2.cc)

set(ARROW_COMPUTE_SHARED_PRIVATE_LINK_LIBS)
set(ARROW_COMPUTE_SHARED_LINK_LIBS)
set(ARROW_COMPUTE_STATIC_LINK_LIBS)
set(ARROW_COMPUTE_STATIC_INSTALL_INTERFACE_LIBS)
set(ARROW_COMPUTE_SHARED_INSTALL_INTERFACE_LIBS)

list(APPEND ARROW_COMPUTE_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static)
list(APPEND ARROW_COMPUTE_SHARED_INSTALL_INTERFACE_LIBS Arrow::arrow_shared)
list(APPEND ARROW_COMPUTE_STATIC_LINK_LIBS arrow_static)
list(APPEND ARROW_COMPUTE_SHARED_LINK_LIBS arrow_shared)

if(ARROW_USE_BOOST)
list(APPEND ARROW_COMPUTE_STATIC_LINK_LIBS Boost::headers)
list(APPEND ARROW_COMPUTE_SHARED_PRIVATE_LINK_LIBS Boost::headers)
endif()
if(ARROW_USE_XSIMD)
list(APPEND ARROW_COMPUTE_STATIC_LINK_LIBS ${ARROW_XSIMD})
list(APPEND ARROW_COMPUTE_SHARED_PRIVATE_LINK_LIBS ${ARROW_XSIMD})
endif()
if(ARROW_WITH_OPENTELEMETRY)
list(APPEND ARROW_COMPUTE_STATIC_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS})
list(APPEND ARROW_COMPUTE_SHARED_PRIVATE_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS})
endif()
if(ARROW_WITH_RE2)
list(APPEND ARROW_COMPUTE_STATIC_LINK_LIBS re2::re2)
list(APPEND ARROW_COMPUTE_SHARED_PRIVATE_LINK_LIBS re2::re2)
endif()
if(ARROW_WITH_UTF8PROC)
list(APPEND ARROW_COMPUTE_STATIC_LINK_LIBS utf8proc::utf8proc)
list(APPEND ARROW_COMPUTE_SHARED_PRIVATE_LINK_LIBS utf8proc::utf8proc)
endif()

add_arrow_lib(arrow_compute
CMAKE_PACKAGE_NAME
ArrowCompute
PKG_CONFIG_NAME
arrow-compute
SHARED_LINK_LIBS
${ARROW_COMPUTE_SHARED_LINK_LIBS}
SHARED_PRIVATE_LINK_LIBS
${ARROW_COMPUTE_SHARED_PRIVATE_LINK_LIBS}
SHARED_INSTALL_INTERFACE_LIBS
${ARROW_COMPUTE_SHARED_INSTALL_INTERFACE_LIBS}
STATIC_LINK_LIBS
${ARROW_COMPUTE_STATIC_LINK_LIBS}
STATIC_INSTALL_INTERFACE_LIBS
${ARROW_COMPUTE_STATIC_INSTALL_INTERFACE_LIBS}
OUTPUTS
ARROW_COMPUTE_LIBRARIES
SOURCES
${ARROW_COMPUTE_LIB_SRCS}
SHARED_LINK_FLAGS
${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt
)
foreach(LIB_TARGET ${ARROW_COMPUTE_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_COMPUTE_EXPORTING)
endforeach()
endif()

arrow_add_object_library(ARROW_COMPUTE ${ARROW_COMPUTE_SRCS})
arrow_add_object_library(ARROW_COMPUTE_CORE ${ARROW_COMPUTE_SRCS})
# TODO: Review whether the following (Boost, xsimd, opentelemetry, re2 and utf8proc) are required
# for the core compute library.
if(ARROW_USE_BOOST)
foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE Boost::headers)
foreach(ARROW_COMPUTE_CORE_TARGET ${ARROW_COMPUTE_CORE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_CORE_TARGET} PRIVATE Boost::headers)
endforeach()
endif()
if(ARROW_USE_XSIMD)
foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE ${ARROW_XSIMD})
foreach(ARROW_COMPUTE_CORE_TARGET ${ARROW_COMPUTE_CORE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_CORE_TARGET} PRIVATE ${ARROW_XSIMD})
endforeach()
endif()
if(ARROW_WITH_OPENTELEMETRY)
foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE ${ARROW_OPENTELEMETRY_LIBS})
foreach(ARROW_COMPUTE_CORE_TARGET ${ARROW_COMPUTE_CORE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_CORE_TARGET}
PRIVATE ${ARROW_OPENTELEMETRY_LIBS})
endforeach()
endif()
if(ARROW_WITH_RE2)
foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE re2::re2)
foreach(ARROW_COMPUTE_CORE_TARGET ${ARROW_COMPUTE_CORE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_CORE_TARGET} PRIVATE re2::re2)
endforeach()
endif()
if(ARROW_WITH_UTF8PROC)
foreach(ARROW_COMPUTE_TARGET ${ARROW_COMPUTE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_TARGET} PRIVATE utf8proc::utf8proc)
foreach(ARROW_COMPUTE_CORE_TARGET ${ARROW_COMPUTE_CORE_TARGETS})
target_link_libraries(${ARROW_COMPUTE_CORE_TARGET} PRIVATE utf8proc::utf8proc)
endforeach()
endif()

Expand Down Expand Up @@ -1026,7 +1098,7 @@ add_arrow_lib(arrow
${ARROW_SHARED_LINK_FLAGS}
SHARED_PRIVATE_LINK_LIBS
${ARROW_ARRAY_TARGET_SHARED}
${ARROW_COMPUTE_TARGET_SHARED}
${ARROW_COMPUTE_CORE_TARGET_SHARED}
${ARROW_CSV_TARGET_SHARED}
${ARROW_FILESYSTEM_TARGET_SHARED}
${ARROW_INTEGRATION_TARGET_SHARED}
Expand All @@ -1042,7 +1114,7 @@ add_arrow_lib(arrow
${ARROW_SYSTEM_LINK_LIBS}
STATIC_LINK_LIBS
${ARROW_ARRAY_TARGET_STATIC}
${ARROW_COMPUTE_TARGET_STATIC}
${ARROW_COMPUTE_CORE_TARGET_STATIC}
${ARROW_CSV_TARGET_STATIC}
${ARROW_FILESYSTEM_TARGET_STATIC}
${ARROW_INTEGRATION_TARGET_STATIC}
Expand Down
1 change: 1 addition & 0 deletions cpp/src/arrow/acero/ArrowAceroConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

include(CMakeFindDependencyMacro)
find_dependency(Arrow)
find_dependency(ArrowCompute)

include("${CMAKE_CURRENT_LIST_DIR}/ArrowAceroTargets.cmake")

Expand Down
10 changes: 6 additions & 4 deletions cpp/src/arrow/acero/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ if(ARROW_WITH_OPENTELEMETRY)
list(APPEND ARROW_ACERO_STATIC_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS})
endif()

list(APPEND ARROW_ACERO_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static)
list(APPEND ARROW_ACERO_SHARED_INSTALL_INTERFACE_LIBS Arrow::arrow_shared)
list(APPEND ARROW_ACERO_STATIC_LINK_LIBS arrow_static)
list(APPEND ARROW_ACERO_SHARED_LINK_LIBS arrow_shared)
list(APPEND ARROW_ACERO_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static
ArrowCompute::arrow_compute_static)
list(APPEND ARROW_ACERO_SHARED_INSTALL_INTERFACE_LIBS Arrow::arrow_shared
ArrowCompute::arrow_compute_shared)
list(APPEND ARROW_ACERO_STATIC_LINK_LIBS arrow_static arrow_compute_static)
list(APPEND ARROW_ACERO_SHARED_LINK_LIBS arrow_shared arrow_compute_shared)
Comment thread
raulcd marked this conversation as resolved.
Resolved

add_arrow_lib(arrow_acero
CMAKE_PACKAGE_NAME
Expand Down
Loading