Skip to content

GH-46116: [C++] Implement IPC directory in Meson #46117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2025
Merged
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
4 changes: 4 additions & 0 deletions ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,12 @@ if [ "${ARROW_USE_MESON:-OFF}" = "ON" ]; then
--prefix=${MESON_PREFIX:-${ARROW_HOME}} \
--buildtype=${ARROW_BUILD_TYPE:-debug} \
-Dauto_features=enabled \
-Dbrotli=disabled \
-Dfuzzing=disabled \
-Dgcs=disabled \
-Dlz4=disabled \
-Ds3=disabled \
-Dzstd=disabled \
. \
${source_dir}

Expand Down
20 changes: 19 additions & 1 deletion cpp/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,25 @@ needs_integration = get_option('integration').enabled()
needs_tests = get_option('tests').enabled()
needs_acero = get_option('acero').enabled()
needs_ipc = get_option('ipc').enabled() or needs_tests or needs_acero or needs_benchmarks
needs_testing = get_option('testing').enabled() or needs_tests or needs_benchmarks or needs_integration
needs_fuzzing = get_option('fuzzing').enabled()
needs_testing = (get_option('testing').enabled()
or needs_tests
or needs_benchmarks
or needs_fuzzing
or needs_integration
)
needs_json = get_option('json').enabled() or needs_testing
needs_brotli = get_option('brotli').enabled() or needs_fuzzing
needs_lz4 = get_option('lz4').enabled()
needs_zstd = get_option('zstd').enabled()
needs_utilities = get_option('utilities').enabled()

if (get_option('brotli').enabled() or get_option('lz4').enabled() or get_option(
'zstd',
).enabled()
)
# See GH issue 46115
error('Compression options (brotli, lz4, zstd) are not implemented in Meson')
endif

subdir('src/arrow')
18 changes: 17 additions & 1 deletion cpp/meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ option(
)

option('benchmarks', type: 'feature', description: 'Build the Arrow micro benchmarks')
option('brotli', type: 'feature', description: 'Build with Brotli compression')
option('compute', type: 'feature', description: 'Build all Arrow Compute kernels')
option('csv', type: 'feature', description: 'Build the Arrow CSV Parser Module')
option('filesystem', type: 'feature', description: 'Build the Arrow Filesystem Layer')
option('fuzzing', type: 'feature', description: 'Build Arrow Fuzzing executables')

option(
'gcs',
Expand All @@ -34,7 +36,12 @@ option(
)

option('hdfs', type: 'feature', description: 'Build the Arrow HDFS bridge')
option('integration', type: 'feature', description: 'Build the Arrow integration test executables')

option(
'integration',
type: 'feature',
description: 'Build the Arrow integration test executables',
)

option(
'ipc',
Expand All @@ -47,6 +54,12 @@ option('json', type: 'feature', description: 'Build Arrow with JSON support')
option('git_id', type: 'string')
option('git_description', type: 'string')

option(
'lz4',
type: 'feature',
description: 'Build with lz4 compression',
)

option(
'package_kind',
type: 'string',
Expand All @@ -60,3 +73,6 @@ option(
)
option('testing', type: 'feature', description: 'Build the Arrow testing libraries')
option('tests', type: 'feature', description: 'Build the Arrow googletest unit tests')

option('utilities', type: 'feature', description: 'Build Arrow commandline utilities')
option('zstd', type: 'feature', description: 'Build with zstd compression')
120 changes: 120 additions & 0 deletions cpp/src/arrow/ipc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# 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.

exc = executable(
'arrow-feather-test',
sources: ['feather_test.cc'],
dependencies: [arrow_ipc_deps, arrow_test_dep],
)
test('arrow-feather-test', exc)

ipc_tests = [
'json_simple_test',
'message_internal_test',
'read_write_test',
'tensor_test',
]

foreach ipc_test : ipc_tests
test_name = 'arrow-ipc-@0@'.format(ipc_test.replace('_', '-'))
exc = executable(
test_name,
sources: ['@[email protected]'.format(ipc_test)],
dependencies: [arrow_ipc_deps, arrow_test_dep],
)
test(test_name, exc)
endforeach

install_headers(
[
'api.h',
'dictionary.h',
'feather.h',
'json_simple.h',
'message.h',
'options.h',
'reader.h',
'test_common.h',
'type_fwd.h',
'util.h',
'writer.h',
],
subdir: 'arrow/ipc',
)

if needs_utilities or needs_integration
file_to_stream_exc = executable(
'arrow-file-to-stream',
sources: ['file_to_stream.cc'],
dependencies: [arrow_dep],
install: needs_utilities,
)

stream_to_file_exc = executable(
'arrow-stream-to-file',
sources: ['stream_to_file.cc'],
dependencies: [arrow_dep],
install: needs_utilities,
)
endif

exc = executable(
'arrow-ipc-read-write-benchmark',
sources: ['read_write_benchmark.cc'],
dependencies: [arrow_benchmark_dep],
)
benchmark('arrow-ipc-read-write-benchmark', exc)

if needs_fuzzing or (needs_utilities
and needs_testing
and needs_lz4
and needs_zstd
)
fuzz_corpus_exc = executable(
'arrow-ipc-generate-fuzz-corpus',
sources: ['generate_fuzz_corpus.cc'],
dependencies: [arrow_test_dep],
)

tensor_fuzz_corpus_exc = executable(
'arrow-ipc-generate-tensor-fuzz-corpus',
sources: ['generate_tensor_fuzz_corpus.cc'],
dependencies: [arrow_test_dep],
)
endif

ipc_fuzz_targets = ['file_fuzz', 'stream_fuzz', 'tensor_stream_fuzz']

if needs_fuzzing
if meson.version() < '1.8.0'
error(
' Meson >= 1.8.0 is required for fuzzing support, found @0@'.format(
meson.version(),
),
)
endif
Comment on lines +103 to +109
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need Meson 1.8.0 or later for -Db_sanitize=fuzzer, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. 1.8 introduced changes to what b_sanitize accepts as arguments

https://mesonbuild.com/Release-notes-for-1-8-0.html#changes-to-the-b_sanitize-option


foreach ipc_fuzz_target : ipc_fuzz_targets
target_name = 'arrow-ipc-@0@'.format(ipc_fuzz_target.replace('_', '-'))
executable(
target_name,
sources: ['@[email protected]'.format(ipc_fuzz_target)],
dependencies: [arrow_dep],
override_options: ['-Db_sanitize=fuzzer'],
)
endforeach
endif
4 changes: 4 additions & 0 deletions cpp/src/arrow/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -685,3 +685,7 @@ endif
if needs_json
subdir('json')
endif

if needs_ipc
subdir('ipc')
endif
Loading