Skip to content

Commit e6c435f

Browse files
committed
GH-46116: [C++] Implement IPC directory in Meson
1 parent 068416b commit e6c435f

File tree

5 files changed

+171
-2
lines changed

5 files changed

+171
-2
lines changed

ci/scripts/cpp_build.sh

+4
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

+19-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,25 @@ needs_filesystem = get_option('filesystem').enabled() or needs_azure or needs_gc
6767
needs_integration = get_option('integration').enabled()
6868
needs_tests = get_option('tests').enabled()
6969
needs_ipc = get_option('ipc').enabled() or needs_tests or needs_benchmarks
70-
needs_testing = get_option('testing').enabled() or needs_tests or needs_benchmarks or needs_integration
70+
needs_fuzzing = get_option('fuzzing').enabled()
71+
needs_testing = (get_option('testing').enabled()
72+
or needs_tests
73+
or needs_benchmarks
74+
or needs_fuzzing
75+
or needs_integration
76+
)
7177
needs_json = get_option('json').enabled() or needs_testing
78+
needs_brotli = get_option('brotli').enabled() or needs_fuzzing
79+
needs_lz4 = get_option('lz4').enabled()
80+
needs_zstd = get_option('zstd').enabled()
81+
needs_utilities = get_option('utilities').enabled()
82+
83+
if (get_option('brotli').enabled() or get_option('lz4').enabled() or get_option(
84+
'zstd',
85+
).enabled()
86+
)
87+
# See GH issue 46115
88+
error('Compression options (brotli, lz4, zstd) are not implemented in Meson')
89+
endif
7290

7391
subdir('src/arrow')

cpp/meson.options

+17-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ option(
2222
)
2323

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

2931
option(
3032
'gcs',
@@ -33,7 +35,12 @@ option(
3335
)
3436

3537
option('hdfs', type: 'feature', description: 'Build the Arrow HDFS bridge')
36-
option('integration', type: 'feature', description: 'Build the Arrow integration test executables')
38+
39+
option(
40+
'integration',
41+
type: 'feature',
42+
description: 'Build the Arrow integration test executables',
43+
)
3744

3845
option(
3946
'ipc',
@@ -46,6 +53,12 @@ option('json', type: 'feature', description: 'Build Arrow with JSON support')
4653
option('git_id', type: 'string')
4754
option('git_description', type: 'string')
4855

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

cpp/src/arrow/ipc/meson.build

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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+
74+
if needs_integration
75+
# TODO: The CMake configuration would add these executables
76+
# to an arrow-integration target, which is in turn
77+
# used by arrow-all. The targets are modified, but not
78+
# used within Arrow C++ (?) - do we need to replicate that here?
79+
endif
80+
endif
81+
82+
exc = executable(
83+
'arrow-ipc-read-write-benchmark',
84+
sources: ['read_write_benchmark.cc'],
85+
dependencies: [arrow_benchmark_dep],
86+
)
87+
benchmark('arrow-ipc-read-write-benchmark', exc)
88+
89+
if needs_fuzzing or (needs_utilities
90+
and needs_testing
91+
and needs_lz4
92+
and needs_zstd
93+
)
94+
fuzz_corpus_exc = executable(
95+
'arrow-ipc-generate-fuzz-corpus',
96+
sources: ['generate_fuzz_corpus.cc'],
97+
dependencies: [arrow_test_dep],
98+
)
99+
100+
tensor_fuzz_corpus_exc = executable(
101+
'arrow-ipc-generate-tensor-fuzz-corpus',
102+
sources: ['generate_tensor_fuzz_corpus.cc'],
103+
dependencies: [arrow_test_dep],
104+
)
105+
endif
106+
107+
ipc_fuzz_targets = ['file_fuzz', 'stream_fuzz', 'tensor_stream_fuzz']
108+
109+
if needs_fuzzing
110+
if meson.version() < '1.8.0'
111+
error(
112+
' Meson >= 1.8.0 is required for fuzzing support, found @0@'.format(
113+
meson.version(),
114+
),
115+
)
116+
endif
117+
118+
foreach ipc_fuzz_target : ipc_fuzz_targets
119+
target_name = 'arrow-ipc-@0@'.format(ipc_fuzz_target.replace('_', '-'))
120+
executable(
121+
target_name,
122+
sources: ['@[email protected]'.format(ipc_fuzz_target)],
123+
dependencies: [arrow_dep],
124+
override_options: ['-Db_sanitize=fuzzer'],
125+
)
126+
endforeach
127+
endif

cpp/src/arrow/meson.build

+4
Original file line numberDiff line numberDiff line change
@@ -681,3 +681,7 @@ endif
681681
if needs_json
682682
subdir('json')
683683
endif
684+
685+
if needs_ipc
686+
subdir('ipc')
687+
endif

0 commit comments

Comments
 (0)