Skip to content

Commit d40cf91

Browse files
committed
GH-46116: [C++] Implement IPC directory in Meson
1 parent 327aca6 commit d40cf91

File tree

4 files changed

+182
-1
lines changed

4 files changed

+182
-1
lines changed

cpp/meson.build

+16-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,22 @@ needs_filesystem = false or needs_hdfs
6363
needs_integration = get_option('integration')
6464
needs_tests = get_option('tests')
6565
needs_ipc = get_option('ipc') or needs_tests or needs_benchmarks
66-
needs_testing = get_option('testing') or needs_tests or needs_benchmarks or needs_integration
66+
needs_fuzzing = get_option('fuzzing')
67+
needs_testing = (get_option('testing')
68+
or needs_tests
69+
or needs_benchmarks
70+
or needs_fuzzing
71+
or needs_integration
72+
)
6773
needs_json = get_option('json') or needs_testing
74+
needs_brotli = get_option('brotli') or needs_fuzzing
75+
needs_lz4 = get_option('lz4')
76+
needs_zstd = get_option('zstd')
77+
needs_utilities = get_option('utilities')
78+
79+
if get_option('brotli') or get_option('lz4') or get_option('zstd')
80+
# See GH issue 46115
81+
error('Compression options (brotli, lz4, zstd) are not implemented in Meson')
82+
endif
6883

6984
subdir('src/arrow')

cpp/meson.options

+35
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,27 @@ option(
2222
value: false,
2323
)
2424

25+
option(
26+
'brotli',
27+
type: 'boolean',
28+
description: 'Build with Brotli compression',
29+
value: false,
30+
)
31+
2532
option(
2633
'csv',
2734
type: 'boolean',
2835
description: 'Build the Arrow CSV Parser Module',
2936
value: false,
3037
)
3138

39+
option(
40+
'fuzzing',
41+
type: 'boolean',
42+
description: 'Build Arrow Fuzzing executables',
43+
value: false,
44+
)
45+
3246
option(
3347
'hdfs',
3448
type: 'boolean',
@@ -67,6 +81,13 @@ option(
6781
type: 'string',
6882
)
6983

84+
option(
85+
'lz4',
86+
type: 'boolean',
87+
description: 'Build with lz4 compression',
88+
value: false,
89+
)
90+
7091
option(
7192
'package_kind',
7293
type: 'string',
@@ -86,3 +107,17 @@ option(
86107
description: 'Build the Arrow googletest unit tests',
87108
value: false,
88109
)
110+
111+
option(
112+
'utilities',
113+
type: 'boolean',
114+
description: 'Build Arrow commandline utilities',
115+
value: false,
116+
)
117+
118+
option(
119+
'zstd',
120+
type: 'boolean',
121+
description: 'Build with zstd compression',
122+
value: false,
123+
)

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_test_dep, arrow_ipc_deps],
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_test_dep, arrow_ipc_deps],
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
@@ -554,3 +554,7 @@ endif
554554
if needs_csv
555555
subdir('csv')
556556
endif
557+
558+
if needs_ipc
559+
subdir('ipc')
560+
endif

0 commit comments

Comments
 (0)