|
| 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(['api.h'], subdir: 'arrow/engine') |
| 19 | + |
| 20 | +arrow_substrait_protos_dir = meson.project_source_root() / 'proto' |
| 21 | +substrait_proto_gen = generator( |
| 22 | + protoc, |
| 23 | + output: ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'], |
| 24 | + arguments: [ |
| 25 | + '--proto_path=@0@'.format( |
| 26 | + subproject('substrait').get_variable('substrait_protos_dir'), |
| 27 | + ), |
| 28 | + '--proto_path=@0@'.format(arrow_substrait_protos_dir), |
| 29 | + '--cpp_out=@0@@1@'.format(proto_visibility, '@BUILD_DIR@'), |
| 30 | + '@INPUT@', |
| 31 | + ], |
| 32 | +) |
| 33 | +ext_proto_gen = substrait_proto_gen.process( |
| 34 | + meson.project_source_root() / 'proto' / 'substrait' / 'extension_rels.proto', |
| 35 | + preserve_path_from: meson.project_source_root() / 'proto', |
| 36 | +) |
| 37 | +substrait_ext_dep = declare_dependency(sources: ext_proto_gen) |
| 38 | + |
| 39 | +substrait_dep = dependency('substrait') |
| 40 | +arrow_substrait_srcs = files( |
| 41 | + 'substrait/expression_internal.cc', |
| 42 | + 'substrait/extended_expression_internal.cc', |
| 43 | + 'substrait/extension_set.cc', |
| 44 | + 'substrait/extension_types.cc', |
| 45 | + 'substrait/options.cc', |
| 46 | + 'substrait/plan_internal.cc', |
| 47 | + 'substrait/relation_internal.cc', |
| 48 | + 'substrait/serde.cc', |
| 49 | + 'substrait/test_plan_builder.cc', |
| 50 | + 'substrait/type_internal.cc', |
| 51 | + 'substrait/util.cc', |
| 52 | + 'substrait/util_internal.cc', |
| 53 | +) |
| 54 | +arrow_substrait_deps = [ |
| 55 | + substrait_dep, |
| 56 | + substrait_ext_dep, |
| 57 | + arrow_dataset_dep, |
| 58 | + protobuf_dep, |
| 59 | +] |
| 60 | +arrow_substrait_pkgconf_req = ['arrow-dataset'] |
| 61 | + |
| 62 | +arrow_substrait_lib = library( |
| 63 | + 'arrow_substrait', |
| 64 | + sources: arrow_substrait_srcs, |
| 65 | + dependencies: arrow_substrait_deps, |
| 66 | + cpp_static_args: ['-DARROW_ENGINE_STATIC'], |
| 67 | + cpp_shared_args: ['-DARROW_ENGINE_EXPORTING'], |
| 68 | + gnu_symbol_visibility: 'inlineshidden', |
| 69 | +) |
| 70 | + |
| 71 | +arrow_substrait_args = [] |
| 72 | +if get_option('default_library') == 'static' |
| 73 | + arrow_substrait_args += ['-DARROW_ENGINE_STATIC'] |
| 74 | +endif |
| 75 | +arrow_substrait_dep = declare_dependency( |
| 76 | + link_with: arrow_substrait_lib, |
| 77 | + dependencies: arrow_substrait_deps, |
| 78 | + compile_args: arrow_substrait_args, |
| 79 | +) |
| 80 | +meson.override_dependency('arrow-substrait', arrow_substrait_dep) |
| 81 | + |
| 82 | +pkg_config_cflags = get_option('default_library') == 'static' ? '-DARROW_ENGINE_STATIC' : '' |
| 83 | +pkg.generate( |
| 84 | + arrow_substrait_lib, |
| 85 | + filebase: 'arrow-substrait', |
| 86 | + name: 'Apache Arrow Substrait Consumer', |
| 87 | + description: 'Apache Arrow\'s Substrait Consumer.', |
| 88 | + extra_cflags: [pkg_config_cflags], |
| 89 | + requires: arrow_substrait_pkgconf_req, |
| 90 | + variables: {'Cflags.private': '-DARROW_ENGINE_STATIC'}, |
| 91 | +) |
| 92 | + |
| 93 | +arrow_substrait_test = executable( |
| 94 | + 'substrait-test', |
| 95 | + sources: files( |
| 96 | + 'substrait/ext_test.cc', |
| 97 | + 'substrait/function_test.cc', |
| 98 | + 'substrait/protobuf_test_util.cc', |
| 99 | + 'substrait/serde_test.cc', |
| 100 | + 'substrait/test_util.cc', |
| 101 | + ), |
| 102 | + dependencies: [arrow_substrait_dep, arrow_compute_test_dep], |
| 103 | +) |
| 104 | +test('substrait-test', arrow_substrait_test) |
| 105 | + |
| 106 | +subdir('substrait') |
0 commit comments