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