Skip to content

Commit 4bbc851

Browse files
authored
GH-46116: [C++] Implement IPC directory in Meson (#46117)
### Rationale for this change Continues adding support for the Meson build system ### What changes are included in this PR? This adds the ipc directory and adds options for different compression algorithms. The algorithms themselves will raise an error if turned on however, as they need to be enabled in subsequent PRs ### Are these changes tested? Yes ### Are there any user-facing changes? No * GitHub Issue: #46116 Authored-by: Will Ayd <[email protected]> Signed-off-by: Will Ayd <[email protected]>
1 parent 37fbdbc commit 4bbc851

File tree

5 files changed

+164
-2
lines changed

5 files changed

+164
-2
lines changed

ci/scripts/cpp_build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,12 @@ if [ "${ARROW_USE_MESON:-OFF}" = "ON" ]; then
143143
--prefix=${MESON_PREFIX:-${ARROW_HOME}} \
144144
--buildtype=${ARROW_BUILD_TYPE:-debug} \
145145
-Dauto_features=enabled \
146+
-Dbrotli=disabled \
147+
-Dfuzzing=disabled \
146148
-Dgcs=disabled \
149+
-Dlz4=disabled \
147150
-Ds3=disabled \
151+
-Dzstd=disabled \
148152
. \
149153
${source_dir}
150154

cpp/meson.build

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,25 @@ needs_integration = get_option('integration').enabled()
6868
needs_tests = get_option('tests').enabled()
6969
needs_acero = get_option('acero').enabled()
7070
needs_ipc = get_option('ipc').enabled() or needs_tests or needs_acero or needs_benchmarks
71-
needs_testing = get_option('testing').enabled() or needs_tests or needs_benchmarks or needs_integration
71+
needs_fuzzing = get_option('fuzzing').enabled()
72+
needs_testing = (get_option('testing').enabled()
73+
or needs_tests
74+
or needs_benchmarks
75+
or needs_fuzzing
76+
or needs_integration
77+
)
7278
needs_json = get_option('json').enabled() or needs_testing
79+
needs_brotli = get_option('brotli').enabled() or needs_fuzzing
80+
needs_lz4 = get_option('lz4').enabled()
81+
needs_zstd = get_option('zstd').enabled()
82+
needs_utilities = get_option('utilities').enabled()
83+
84+
if (get_option('brotli').enabled() or get_option('lz4').enabled() or get_option(
85+
'zstd',
86+
).enabled()
87+
)
88+
# See GH issue 46115
89+
error('Compression options (brotli, lz4, zstd) are not implemented in Meson')
90+
endif
7391

7492
subdir('src/arrow')

cpp/meson.options

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ option(
2323
)
2424

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

3032
option(
3133
'gcs',
@@ -34,7 +36,12 @@ option(
3436
)
3537

3638
option('hdfs', type: 'feature', description: 'Build the Arrow HDFS bridge')
37-
option('integration', type: 'feature', description: 'Build the Arrow integration test executables')
39+
40+
option(
41+
'integration',
42+
type: 'feature',
43+
description: 'Build the Arrow integration test executables',
44+
)
3845

3946
option(
4047
'ipc',
@@ -47,6 +54,12 @@ option('json', type: 'feature', description: 'Build Arrow with JSON support')
4754
option('git_id', type: 'string')
4855
option('git_description', type: 'string')
4956

57+
option(
58+
'lz4',
59+
type: 'feature',
60+
description: 'Build with lz4 compression',
61+
)
62+
5063
option(
5164
'package_kind',
5265
type: 'string',
@@ -60,3 +73,6 @@ option(
6073
)
6174
option('testing', type: 'feature', description: 'Build the Arrow testing libraries')
6275
option('tests', type: 'feature', description: 'Build the Arrow googletest unit tests')
76+
77+
option('utilities', type: 'feature', description: 'Build Arrow commandline utilities')
78+
option('zstd', type: 'feature', description: 'Build with zstd compression')

cpp/src/arrow/ipc/meson.build

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
exc = executable(
19+
'arrow-feather-test',
20+
sources: ['feather_test.cc'],
21+
dependencies: [arrow_ipc_deps, arrow_test_dep],
22+
)
23+
test('arrow-feather-test', exc)
24+
25+
ipc_tests = [
26+
'json_simple_test',
27+
'message_internal_test',
28+
'read_write_test',
29+
'tensor_test',
30+
]
31+
32+
foreach ipc_test : ipc_tests
33+
test_name = 'arrow-ipc-@0@'.format(ipc_test.replace('_', '-'))
34+
exc = executable(
35+
test_name,
36+
sources: ['@[email protected]'.format(ipc_test)],
37+
dependencies: [arrow_ipc_deps, arrow_test_dep],
38+
)
39+
test(test_name, exc)
40+
endforeach
41+
42+
install_headers(
43+
[
44+
'api.h',
45+
'dictionary.h',
46+
'feather.h',
47+
'json_simple.h',
48+
'message.h',
49+
'options.h',
50+
'reader.h',
51+
'test_common.h',
52+
'type_fwd.h',
53+
'util.h',
54+
'writer.h',
55+
],
56+
subdir: 'arrow/ipc',
57+
)
58+
59+
if needs_utilities or needs_integration
60+
file_to_stream_exc = executable(
61+
'arrow-file-to-stream',
62+
sources: ['file_to_stream.cc'],
63+
dependencies: [arrow_dep],
64+
install: needs_utilities,
65+
)
66+
67+
stream_to_file_exc = executable(
68+
'arrow-stream-to-file',
69+
sources: ['stream_to_file.cc'],
70+
dependencies: [arrow_dep],
71+
install: needs_utilities,
72+
)
73+
endif
74+
75+
exc = executable(
76+
'arrow-ipc-read-write-benchmark',
77+
sources: ['read_write_benchmark.cc'],
78+
dependencies: [arrow_benchmark_dep],
79+
)
80+
benchmark('arrow-ipc-read-write-benchmark', exc)
81+
82+
if needs_fuzzing or (needs_utilities
83+
and needs_testing
84+
and needs_lz4
85+
and needs_zstd
86+
)
87+
fuzz_corpus_exc = executable(
88+
'arrow-ipc-generate-fuzz-corpus',
89+
sources: ['generate_fuzz_corpus.cc'],
90+
dependencies: [arrow_test_dep],
91+
)
92+
93+
tensor_fuzz_corpus_exc = executable(
94+
'arrow-ipc-generate-tensor-fuzz-corpus',
95+
sources: ['generate_tensor_fuzz_corpus.cc'],
96+
dependencies: [arrow_test_dep],
97+
)
98+
endif
99+
100+
ipc_fuzz_targets = ['file_fuzz', 'stream_fuzz', 'tensor_stream_fuzz']
101+
102+
if needs_fuzzing
103+
if meson.version() < '1.8.0'
104+
error(
105+
' Meson >= 1.8.0 is required for fuzzing support, found @0@'.format(
106+
meson.version(),
107+
),
108+
)
109+
endif
110+
111+
foreach ipc_fuzz_target : ipc_fuzz_targets
112+
target_name = 'arrow-ipc-@0@'.format(ipc_fuzz_target.replace('_', '-'))
113+
executable(
114+
target_name,
115+
sources: ['@[email protected]'.format(ipc_fuzz_target)],
116+
dependencies: [arrow_dep],
117+
override_options: ['-Db_sanitize=fuzzer'],
118+
)
119+
endforeach
120+
endif

cpp/src/arrow/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,3 +685,7 @@ endif
685685
if needs_json
686686
subdir('json')
687687
endif
688+
689+
if needs_ipc
690+
subdir('ipc')
691+
endif

0 commit comments

Comments
 (0)