Skip to content

Commit 519e257

Browse files
committed
GH-46375: [C++] Add adapters/orc to Meson configuration
1 parent 88815a1 commit 519e257

File tree

7 files changed

+281
-4
lines changed

7 files changed

+281
-4
lines changed

cpp/meson.build

+5-4
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,13 @@ or needs_fuzzing
7676
or needs_integration
7777
)
7878
needs_json = get_option('json').enabled() or needs_testing
79+
needs_orc = get_option('orc').enabled()
7980
needs_brotli = get_option('brotli').enabled() or needs_fuzzing
8081
needs_bz2 = get_option('bz2').enabled()
81-
needs_lz4 = get_option('lz4').enabled()
82-
needs_snappy = get_option('snappy').enabled()
83-
needs_zlib = get_option('zlib').enabled()
84-
needs_zstd = get_option('zstd').enabled()
82+
needs_lz4 = get_option('lz4').enabled() or needs_orc
83+
needs_snappy = get_option('snappy').enabled() or needs_orc
84+
needs_zlib = get_option('zlib').enabled() or needs_orc
85+
needs_zstd = get_option('zstd').enabled() or needs_orc
8586
needs_utilities = get_option('utilities').enabled()
8687

8788
subdir('src/arrow')

cpp/meson.options

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ option(
6161
description: 'Build with lz4 compression',
6262
)
6363

64+
option('orc', type: 'feature', description: 'Build the Arrow ORC adapter')
6465
option(
6566
'package_kind',
6667
type: 'string',
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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(['adapter.h', 'options.h'], subdir: 'arrow/adapters/orc')
19+
20+
pkg.generate(
21+
filebase: 'arrow-orc',
22+
name: 'Apache Arrow ORC',
23+
description: 'ORC modules for Apache Arrow',
24+
requires: ['arrow'],
25+
)
26+
27+
exc = executable(
28+
'arrow-orc-adapter-test',
29+
sources: ['adapter_test.cc'],
30+
dependencies: [arrow_test_dep, orc_dep],
31+
)
32+
test('arrow-orc-adapter-test', exc)

cpp/src/arrow/meson.build

+58
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,60 @@ if needs_json
457457
}
458458
endif
459459

460+
if needs_orc
461+
absel_base_dep = dependency('absl_base')
462+
absel_strings_dep = dependency('absl_strings')
463+
absel_string_view_dep = dependency('absl_string_view')
464+
protobuf_proj = subproject('protobuf')
465+
protobuf_lib = protobuf_proj.get_variable('libprotobuf')
466+
protoc_lib = protobuf_proj.get_variable('libprotoc')
467+
protoc = find_program('protoc')
468+
protoc_path = protoc.full_path()
469+
# Internally we could use protobuf_proj.get_variable('incdir')
470+
# to get the include directory from protobuf, but Meson does
471+
# not allow you to convert that to a string, which CMake requires
472+
# As a workaround, we start with the protoc path and manipulate
473+
# the path strings as needed
474+
proto_root = meson.project_source_root() / 'subprojects' / 'protobuf-25.2'
475+
absl_root = meson.project_source_root() / 'subprojects' / 'abseil-cpp-20240722.0'
476+
477+
cmake = import('cmake')
478+
orc_opt = cmake.subproject_options()
479+
orc_opt.add_cmake_defines(
480+
{'STOP_BUILD_ON_WARNING': 'FALSE'},
481+
{'BUILD_LIBHDFSPP': 'FALSE'},
482+
{'BUILD_JAVA': 'FALSE'},
483+
{'BUILD_TOOLS': 'FALSE'},
484+
{'BUILD_CPP_TESTS': 'FALSE'},
485+
{'INSTALL_VENDORED_LIBS': 'FALSE'},
486+
{'PROTOBUF_HOME': proto_root / 'src'},
487+
{'PROTOBUF_EXECUTABLE': protoc_path},
488+
{'PROTOBUF_INCLUDE_DIR': proto_root / 'src'},
489+
{'PROTOBUF_LIBRARY': protobuf_lib.full_path()},
490+
{'PROTOC_LIBRARY': protoc_lib.full_path()},
491+
# There seems to be a bug (?) in Orc where when providing your own
492+
# protobuf library, the include directory is not propogated from protobuf
493+
# to the orc library being built. This workaround sets the include path
494+
# for proto globally, alongside abseil
495+
{'CMAKE_CXX_FLAGS': '-I@0@ -I@1@'.format(proto_root / 'src', absl_root)},
496+
)
497+
orc_opt.append_compile_args('cpp', '-fPIC')
498+
orc_proj = cmake.subproject('orc', options: orc_opt)
499+
orc_dep = orc_proj.dependency('orc')
500+
arrow_components += {
501+
'arrow_orc': {
502+
'sources': [
503+
'adapters/orc/adapter.cc',
504+
'adapters/orc/options.cc',
505+
'adapters/orc/util.cc',
506+
],
507+
'dependencies': [orc_dep],
508+
},
509+
}
510+
else
511+
orc_dep = disabler()
512+
endif
513+
460514
arrow_srcs = []
461515
include_dir = include_directories('..')
462516
arrow_includes = [include_dir]
@@ -725,6 +779,10 @@ if needs_json
725779
subdir('json')
726780
endif
727781

782+
if needs_orc
783+
subdir('adapters/orc')
784+
endif
785+
728786
if needs_ipc
729787
subdir('ipc')
730788
endif

cpp/subprojects/abseil-cpp.wrap

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

cpp/subprojects/orc.wrap

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
source_url = https://www.apache.org/dyn/closer.lua/orc/orc-1.9.6/orc-1.9.6.tar.gz?action=download
20+
source_fallback_url = https://dlcdn.apache.org/orc/orc-1.9.6/orc-1.9.6.tar.gz
21+
source_filename = orc-1.9.6.tar.gz
22+
source_hash = 4442944f53b6b4d48f0b6a1938a8f7d1233a92864d7d588201225c8977371754
23+
directory = orc-1.9.6
24+
method = cmake
25+
26+
[provide]
27+
orc = orc_dep

cpp/subprojects/protobuf.wrap

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 = protobuf-25.2
20+
source_url = https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protobuf-25.2.tar.gz
21+
source_filename = protobuf-25.2.tar.gz
22+
source_hash = 8ff511a64fc46ee792d3fe49a5a1bcad6f7dc50dfbba5a28b0e5b979c17f9871
23+
patch_filename = protobuf_25.2-2_patch.zip
24+
patch_url = https://wrapdb.mesonbuild.com/v2/protobuf_25.2-2/get_patch
25+
patch_hash = a2f5968097eb036c228b72258435d09e93dca4093d09acb5078a376d8155df46
26+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/protobuf_25.2-2/protobuf-25.2.tar.gz
27+
wrapdb_version = 25.2-2
28+
29+
[provide]
30+
protobuf = protobuf_dep
31+
protobuf-lite = protobuf_lite_dep
32+
protoc = protoc_dep
33+
program_names = protoc

0 commit comments

Comments
 (0)