Skip to content

Commit 1d169cc

Browse files
authored
GH-46141: [C++] Add flight directory to Meson configuration (#46142)
### Rationale for this change Continues building out support for Meson as a build system generator ### What changes are included in this PR? This adds the flight directory to the Meson configuration ### Are these changes tested? Locally ### Are there any user-facing changes? No * GitHub Issue: #46141 Authored-by: Will Ayd <william.ayd@icloud.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
1 parent 1969ae3 commit 1d169cc

8 files changed

Lines changed: 441 additions & 2 deletions

File tree

cpp/meson.build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ project(
2424
meson_version: '>=1.3.0',
2525
default_options: [
2626
'buildtype=release',
27-
'c_std=c99',
27+
'c_std=gnu11,c11',
2828
'warning_level=2',
2929
'cpp_std=c++17',
3030
],
@@ -67,7 +67,8 @@ 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_acero = get_option('acero').enabled()
70-
needs_ipc = get_option('ipc').enabled() or needs_tests or needs_acero or needs_benchmarks
70+
needs_flight = get_option('flight').enabled()
71+
needs_ipc = get_option('ipc').enabled() or needs_tests or needs_acero or needs_benchmarks or needs_flight
7172
needs_fuzzing = get_option('fuzzing').enabled()
7273
needs_testing = (get_option('testing').enabled()
7374
or needs_tests

cpp/meson.options

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ option(
5252
)
5353

5454
option('json', type: 'feature', description: 'Build Arrow with JSON support')
55+
56+
option(
57+
'flight',
58+
type: 'feature',
59+
description: 'Build the Arrow Flight RPC System (requires GRPC, Protocol Buffers)',
60+
)
61+
5562
option('git_id', type: 'string')
5663
option('git_description', type: 'string')
5764

cpp/src/arrow/flight/meson.build

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
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+
install_headers(
19+
[
20+
'api.h',
21+
'client_auth.h',
22+
'client_cookie_middleware.h',
23+
'client.h',
24+
'client_middleware.h',
25+
'client_tracing_middleware.h',
26+
'middleware.h',
27+
'otel_logging.h',
28+
'platform.h',
29+
'server_auth.h',
30+
'server.h',
31+
'server_middleware.h',
32+
'server_tracing_middleware.h',
33+
'test_auth_handlers.h',
34+
'test_definitions.h',
35+
'test_flight_server.h',
36+
'test_util.h',
37+
'transport.h',
38+
'transport_server.h',
39+
'type_fwd.h',
40+
'types_async.h',
41+
'types.h',
42+
'visibility.h',
43+
],
44+
subdir: 'arrow/flight',
45+
)
46+
47+
grpc_dep = dependency('grpc++')
48+
protobuf_dep = dependency('protobuf')
49+
abseil_sync_dep = dependency('absl_synchronization')
50+
51+
fs = import('fs')
52+
protoc = find_program('protoc')
53+
54+
flight_proto_path = fs.parent(meson.project_source_root()) / 'format'
55+
flight_proto_files = custom_target(
56+
'arrow-flight-proto-files',
57+
input: [flight_proto_path / 'Flight.proto'],
58+
output: ['Flight.pb.cc', 'Flight.pb.h'],
59+
command: [
60+
protoc,
61+
'--proto_path=' + flight_proto_path,
62+
'--cpp_out=' + meson.current_build_dir(),
63+
'@INPUT@',
64+
],
65+
)
66+
67+
grpc_cpp_plugin = find_program('grpc_cpp_plugin')
68+
flight_proto_grpc_files = custom_target(
69+
'arrow-flight-proto-grpc-files',
70+
input: [flight_proto_path / 'Flight.proto'],
71+
output: ['Flight.grpc.pb.cc', 'Flight.grpc.pb.h'],
72+
command: [
73+
protoc,
74+
'--proto_path=' + flight_proto_path,
75+
'--grpc_out=' + meson.current_build_dir(),
76+
'--plugin=protoc-gen-grpc=' + grpc_cpp_plugin.full_path(),
77+
'@INPUT@',
78+
],
79+
)
80+
81+
arrow_flight_srcs = [
82+
'client.cc',
83+
'client_cookie_middleware.cc',
84+
'client_tracing_middleware.cc',
85+
'cookie_internal.cc',
86+
'middleware.cc',
87+
'serialization_internal.cc',
88+
'server.cc',
89+
'server_auth.cc',
90+
'server_tracing_middleware.cc',
91+
'transport.cc',
92+
'transport_server.cc',
93+
'transport/grpc/grpc_client.cc',
94+
'transport/grpc/grpc_server.cc',
95+
'transport/grpc/serialization_internal.cc',
96+
'transport/grpc/protocol_grpc_internal.cc',
97+
'transport/grpc/util_internal.cc',
98+
'types.cc',
99+
]
100+
101+
thread_dep = dependency('threads')
102+
103+
arrow_flight = library(
104+
'arrow-flight',
105+
# We intentionally index flight_proto_grpc_files[1] so as to avoid
106+
# adding 'Flight.grpc.pb.cc' to the sources. This is required
107+
# because protocol_grpc_internal.cc includes the source file
108+
# directly; using as a source here will cause a ODR violation
109+
sources: arrow_flight_srcs + [
110+
flight_proto_files,
111+
flight_proto_grpc_files[1],
112+
],
113+
dependencies: [
114+
arrow_dep,
115+
grpc_dep,
116+
protobuf_dep,
117+
abseil_sync_dep,
118+
thread_dep,
119+
],
120+
cpp_args: '-DARROW_FLIGHT_EXPORTING',
121+
)
122+
123+
arrow_flight_dep = declare_dependency(
124+
link_with: arrow_flight,
125+
dependencies: [grpc_dep, protobuf_dep, abseil_sync_dep],
126+
)
127+
128+
if needs_testing
129+
arrow_flight_testing_lib = library(
130+
'arrow-flight-testing',
131+
sources: [
132+
'test_auth_handlers.cc',
133+
'test_definitions.cc',
134+
'test_flight_server.cc',
135+
'test_util.cc',
136+
],
137+
dependencies: [arrow_test_dep, arrow_flight_dep, thread_dep],
138+
)
139+
140+
arrow_flight_test_dep = declare_dependency(
141+
link_with: arrow_flight_testing_lib,
142+
dependencies: [arrow_flight_dep],
143+
)
144+
else
145+
arrow_flight_test_dep = disabler()
146+
endif
147+
148+
flight_tests = ['flight_internals_test', 'flight_test']
149+
foreach flight_test : flight_tests
150+
test_name = '@0@'.format(flight_test.replace('_', '-'))
151+
exc = executable(
152+
test_name,
153+
sources: [
154+
'@0@.cc'.format(flight_test),
155+
# flight_internals_test.cc transitively includes Flight.grpc.pb.h
156+
# so we must declare that here to avoid a race condition
157+
flight_proto_grpc_files[1],
158+
],
159+
dependencies: [arrow_test_dep, arrow_flight_test_dep],
160+
)
161+
test(test_name, exc)
162+
endforeach
163+
164+
flight_test_dep_no_main = [
165+
arrow_dep,
166+
arrow_flight_test_dep,
167+
gtest_dep,
168+
gmock_dep,
169+
gflags_dep,
170+
]
171+
172+
if needs_tests or needs_benchmarks
173+
executable(
174+
'flight-test-server',
175+
sources: ['test_server.cc'],
176+
dependencies: flight_test_dep_no_main,
177+
)
178+
endif
179+
180+
if needs_benchmarks
181+
server_proto_path = meson.project_source_root() / 'src' / 'arrow' / 'flight'
182+
flight_proto_files = custom_target(
183+
'arrow-flight-benchmark-perf-proto-files',
184+
input: [server_proto_path / 'perf.proto'],
185+
output: ['perf.pb.cc', 'perf.pb.h'],
186+
command: [
187+
protoc,
188+
'--proto_path=' + meson.current_source_dir(),
189+
'--cpp_out=' + meson.current_build_dir(),
190+
'@INPUT@',
191+
],
192+
)
193+
194+
executable(
195+
'arrow-flight-perf-server',
196+
sources: ['perf_server.cc'] + flight_proto_files,
197+
dependencies: flight_test_dep_no_main,
198+
)
199+
200+
executable(
201+
'arrow-flight-benchmark',
202+
sources: ['flight_benchmark.cc'] + flight_proto_files,
203+
dependencies: flight_test_dep_no_main,
204+
)
205+
endif

cpp/src/arrow/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,10 @@ if needs_filesystem
720720
subdir('filesystem')
721721
endif
722722

723+
if needs_flight
724+
subdir('flight')
725+
endif
726+
723727
if needs_json
724728
subdir('json')
725729
endif

cpp/subprojects/abseil-cpp.wrap

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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+
[wrap-file]
19+
directory = abseil-cpp-20240722.0
20+
source_url = https://github.com/abseil/abseil-cpp/releases/download/20240722.0/abseil-cpp-20240722.0.tar.gz
21+
source_filename = abseil-cpp-20240722.0.tar.gz
22+
source_hash = f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3
23+
patch_filename = abseil-cpp_20240722.0-3_patch.zip
24+
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20240722.0-3/get_patch
25+
patch_hash = 12dd8df1488a314c53e3751abd2750cf233b830651d168b6a9f15e7d0cf71f7b
26+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/abseil-cpp_20240722.0-3/abseil-cpp-20240722.0.tar.gz
27+
wrapdb_version = 20240722.0-3
28+
29+
[provide]
30+
absl_base = absl_base_dep
31+
absl_container = absl_container_dep
32+
absl_debugging = absl_debugging_dep
33+
absl_log = absl_log_dep
34+
absl_flags = absl_flags_dep
35+
absl_hash = absl_hash_dep
36+
absl_crc = absl_crc_dep
37+
absl_numeric = absl_numeric_dep
38+
absl_profiling = absl_profiling_dep
39+
absl_random = absl_random_dep
40+
absl_status = absl_status_dep
41+
absl_strings = absl_strings_dep
42+
absl_synchronization = absl_synchronization_dep
43+
absl_time = absl_time_dep
44+
absl_types = absl_types_dep
45+
absl_algorithm_container = absl_base_dep
46+
absl_any_invocable = absl_base_dep
47+
absl_bad_any_cast_impl = absl_types_dep
48+
absl_bad_optional_access = absl_types_dep
49+
absl_bad_variant_access = absl_types_dep
50+
absl_bind_front = absl_base_dep
51+
absl_city = absl_hash_dep
52+
absl_civil_time = absl_time_dep
53+
absl_cleanup = absl_base_dep
54+
absl_cord = absl_strings_dep
55+
absl_cord_internal = absl_strings_dep
56+
absl_cordz_functions = absl_strings_dep
57+
absl_cordz_handle = absl_strings_dep
58+
absl_cordz_info = absl_strings_dep
59+
absl_cordz_sample_token = absl_strings_dep
60+
absl_core_headers = absl_base_dep
61+
absl_crc32c = absl_crc_dep
62+
absl_debugging_internal = absl_debugging_dep
63+
absl_demangle_internal = absl_debugging_dep
64+
absl_die_if_null = absl_log_dep
65+
absl_examine_stack = absl_debugging_dep
66+
absl_exponential_biased = absl_profiling_dep
67+
absl_failure_signal_handler = absl_debugging_dep
68+
absl_flags_commandlineflag = absl_flags_dep
69+
absl_flags_commandlineflag_internal = absl_flags_dep
70+
absl_flags_config = absl_flags_dep
71+
absl_flags_internal = absl_flags_dep
72+
absl_flags_marshalling = absl_flags_dep
73+
absl_flags_parse = absl_flags_dep
74+
absl_flags_private_handle_accessor = absl_flags_dep
75+
absl_flags_program_name = absl_flags_dep
76+
absl_flags_reflection = absl_flags_dep
77+
absl_flags_usage = absl_flags_dep
78+
absl_flags_usage_internal = absl_flags_dep
79+
absl_flat_hash_map = absl_container_dep
80+
absl_flat_hash_set = absl_container_dep
81+
absl_function_ref = absl_base_dep
82+
absl_graphcycles_internal = absl_synchronization_dep
83+
absl_hashtablez_sampler = absl_container_dep
84+
absl_inlined_vector = absl_container_dep
85+
absl_int128 = absl_numeric_dep
86+
absl_leak_check = absl_debugging_dep
87+
absl_log_initialize = absl_log_dep
88+
absl_log_internal_check_op = absl_log_dep
89+
absl_log_internal_message = absl_log_dep
90+
absl_log_severity = absl_base_dep
91+
absl_low_level_hash = absl_hash_dep
92+
absl_memory = absl_base_dep
93+
absl_optional = absl_types_dep
94+
absl_periodic_sampler = absl_profiling_dep
95+
absl_random_bit_gen_ref = absl_random_dep
96+
absl_random_distributions = absl_random_dep
97+
absl_random_internal_distribution_test_util = absl_random_dep
98+
absl_random_internal_platform = absl_random_dep
99+
absl_random_internal_pool_urbg = absl_random_dep
100+
absl_random_internal_randen = absl_random_dep
101+
absl_random_internal_randen_hwaes = absl_random_dep
102+
absl_random_internal_randen_hwaes_impl = absl_random_dep
103+
absl_random_internal_randen_slow = absl_random_dep
104+
absl_random_internal_seed_material = absl_random_dep
105+
absl_random_random = absl_random_dep
106+
absl_random_seed_gen_exception = absl_random_dep
107+
absl_random_seed_sequences = absl_random_dep
108+
absl_raw_hash_set = absl_container_dep
109+
absl_raw_logging_internal = absl_base_dep
110+
absl_scoped_set_env = absl_base_dep
111+
absl_span = absl_types_dep
112+
absl_spinlock_wait = absl_base_dep
113+
absl_stacktrace = absl_debugging_dep
114+
absl_statusor = absl_status_dep
115+
absl_str_format = absl_strings_dep
116+
absl_str_format_internal = absl_strings_dep
117+
absl_strerror = absl_base_dep
118+
absl_string_view = absl_strings_dep
119+
absl_strings_internal = absl_strings_dep
120+
absl_symbolize = absl_debugging_dep
121+
absl_throw_delegate = absl_base_dep
122+
absl_time_zone = absl_time_dep
123+
absl_type_traits = absl_base_dep
124+
absl_utility = absl_base_dep
125+
absl_variant = absl_types_dep

0 commit comments

Comments
 (0)