Skip to content

Commit b9d014d

Browse files
authored
GH-45589: [C++] Enable singular test in Meson configuration (#45596)
### Rationale for this change Adding this singular test helps us make incremental progress on Meson as a build system generator ### What changes are included in this PR? A single array-test for libarrow is being added ### Are these changes tested? Yes - see CI ### Are there any user-facing changes? No - this is only for developers * GitHub Issue: #45589 Authored-by: Will Ayd <william.ayd@icloud.com> Signed-off-by: Will Ayd <william.ayd@icloud.com>
1 parent 9b36c70 commit b9d014d

File tree

9 files changed

+308
-0
lines changed

9 files changed

+308
-0
lines changed

ci/scripts/cpp_build.sh

+9
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,18 @@ if [ "${ARROW_OFFLINE}" = "ON" ]; then
110110
fi
111111

112112
if [ "${ARROW_USE_MESON:-OFF}" = "ON" ]; then
113+
function meson_boolean() {
114+
if [ "${1}" = "ON" ]; then
115+
echo "true"
116+
else
117+
echo "false"
118+
fi
119+
}
120+
113121
meson setup \
114122
--prefix=${MESON_PREFIX:-${ARROW_HOME}} \
115123
--buildtype=${ARROW_BUILD_TYPE:-debug} \
124+
-Dtests=$(meson_boolean ${ARROW_BUILD_TESTS:-OFF}) \
116125
. \
117126
${source_dir}
118127
elif [ "${ARROW_EMSCRIPTEN:-OFF}" = "ON" ]; then

cpp/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@ cmake-build-*/
4343
*.kdev4
4444
*.log
4545
*.swp
46+
47+
# meson subprojects - wrap files need to be kept to let meson download
48+
# dependencies as needed, but dependencies themselves should not be versioned
49+
/subprojects/*
50+
!/subprojects/packagefiles
51+
!/subprojects/*.wrap

cpp/meson.build

+6
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,10 @@ if git_description == ''
5656
git_description = run_command('git', 'describe', '--tags', check: false).stdout().strip()
5757
endif
5858

59+
needs_integration = false
60+
needs_tests = get_option('tests')
61+
needs_ipc = get_option('ipc') or needs_tests
62+
needs_testing = get_option('testing') or needs_tests
63+
needs_json = get_option('json') or needs_testing
64+
5965
subdir('src/arrow')

cpp/meson.options

+28
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
option(
19+
'ipc',
20+
type: 'boolean',
21+
description: 'Build the Arrow IPC extensions',
22+
value: false,
23+
)
24+
25+
option(
26+
'json',
27+
type: 'boolean',
28+
description: 'Build Arrow with JSON support',
29+
value: false,
30+
)
31+
1832
option(
1933
'git_id',
2034
type: 'string',
@@ -30,3 +44,17 @@ option(
3044
type: 'string',
3145
description: 'Arbitrary string that identifies the kind of package (for informational purposes)',
3246
)
47+
48+
option(
49+
'testing',
50+
type: 'boolean',
51+
description: 'Build the Arrow testing libraries',
52+
value: false,
53+
)
54+
55+
option(
56+
'tests',
57+
type: 'boolean',
58+
description: 'Build the Arrow googletest unit tests',
59+
value: false,
60+
)

cpp/src/arrow/meson.build

+138
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,87 @@ arrow_components = {
227227
},
228228
}
229229

230+
arrow_testing_srcs = [
231+
'io/test_common.cc',
232+
'ipc/test_common.cc',
233+
'testing/fixed_width_test_util.cc',
234+
'testing/generator.cc',
235+
'testing/gtest_util.cc',
236+
'testing/math.cc',
237+
'testing/process.cc',
238+
'testing/random.cc',
239+
'testing/util.cc',
240+
]
241+
242+
if needs_integration or needs_tests
243+
arrow_components += {
244+
'arrow_integration': {
245+
'sources': [
246+
'integration/c_data_integration_internal.cc',
247+
'integration/json_integration.cc',
248+
'integration/json_internal.cc',
249+
],
250+
'include_dirs': [],
251+
'dependencies': [],
252+
},
253+
}
254+
endif
255+
256+
if needs_json
257+
rapidjson_dep = dependency('rapidjson', include_type: 'system')
258+
else
259+
rapidjson_dep = disabler()
260+
endif
261+
262+
if needs_ipc
263+
arrow_ipc_srcs = [
264+
'ipc/dictionary.cc',
265+
'ipc/feather.cc',
266+
'ipc/message.cc',
267+
'ipc/metadata_internal.cc',
268+
'ipc/options.cc',
269+
'ipc/reader.cc',
270+
'ipc/writer.cc',
271+
]
272+
273+
flatbuffers_dep = dependency('flatbuffers')
274+
arrow_ipc_deps = [flatbuffers_dep]
275+
276+
if needs_json
277+
arrow_ipc_srcs += 'ipc/json_simple.cc'
278+
arrow_ipc_deps += rapidjson_dep
279+
endif
280+
281+
arrow_components += {
282+
'arrow_ipc': {
283+
'sources': arrow_ipc_srcs,
284+
'include_dirs': [],
285+
'dependencies': arrow_ipc_deps,
286+
},
287+
}
288+
endif
289+
290+
if needs_json
291+
arrow_components += {
292+
'arrow_json': {
293+
'sources': [
294+
'extension/fixed_shape_tensor.cc',
295+
'extension/opaque.cc',
296+
'json/options.cc',
297+
'json/chunked_builder.cc',
298+
'json/chunker.cc',
299+
'json/converter.cc',
300+
'json/object_parser.cc',
301+
'json/object_writer.cc',
302+
'json/parser.cc',
303+
'json/reader.cc',
304+
],
305+
'include_dirs': [],
306+
'dependencies': [rapidjson_dep],
307+
},
308+
}
309+
endif
310+
230311
arrow_srcs = []
231312
include_dir = include_directories('..')
232313
arrow_includes = [include_dir]
@@ -289,6 +370,63 @@ install_headers(
289370
install_dir: 'arrow',
290371
)
291372

373+
if needs_tests
374+
filesystem_dep = dependency(
375+
'boost',
376+
modules: ['filesystem'],
377+
required: false,
378+
)
379+
if not filesystem_dep.found()
380+
cmake = import('cmake')
381+
boost_opt = cmake.subproject_options()
382+
boost_opt.add_cmake_defines(
383+
{'BOOST_INCLUDE_LIBRARIES': 'filesystem;system'},
384+
)
385+
boost_proj = cmake.subproject('boost', options: boost_opt)
386+
filesystem_dep = boost_proj.dependency('boost_filesystem')
387+
endif
388+
389+
gtest_main_dep = dependency('gtest_main')
390+
gmock_dep = dependency('gmock')
391+
else
392+
filesystem_dep = disabler()
393+
gtest_main_dep = disabler()
394+
gmock_dep = disabler()
395+
endif
396+
397+
arrow_test_lib = static_library(
398+
'arrow_testing',
399+
sources: arrow_testing_srcs,
400+
include_directories: [include_dir],
401+
link_with: [arrow_lib],
402+
dependencies: [filesystem_dep, gtest_main_dep],
403+
)
404+
405+
arrow_test_dep = declare_dependency(
406+
link_with: [arrow_lib, arrow_test_lib],
407+
include_directories: [include_dir],
408+
dependencies: [filesystem_dep, gmock_dep, gtest_main_dep],
409+
)
410+
411+
array_array_test = executable(
412+
'arrow_array_test',
413+
sources: [
414+
'array/array_test.cc',
415+
'array/array_binary_test.cc',
416+
'array/array_dict_test.cc',
417+
'array/array_list_test.cc',
418+
'array/array_list_view_test.cc',
419+
'array/array_run_end_test.cc',
420+
'array/array_struct_test.cc',
421+
'array/array_union_test.cc',
422+
'array/array_view_test.cc',
423+
'array/statistics_test.cc',
424+
],
425+
dependencies: [arrow_test_dep],
426+
)
427+
428+
test('arrow_array_test', array_array_test)
429+
292430
version = meson.project_version()
293431

294432
version_no_snapshot = version.split('-SNAPSHOT')[0]

cpp/subprojects/boost.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://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-cmake.tar.gz
20+
source_filename = boost-1.87.0-cmake.tar.gz
21+
source_hash = 78fbf579e3caf0f47517d3fb4d9301852c3154bfecdc5eeebd9b2b0292366f5b
22+
directory = boost-1.87.0
23+
method = cmake
24+
25+
[provide]
26+
boost_filesystem = boost_filesystem_dep
27+
boost_system = boost_system_dep

cpp/subprojects/flatbuffers.wrap

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 = flatbuffers-24.3.6
20+
source_url = https://github.com/google/flatbuffers/archive/v24.3.6.tar.gz
21+
source_filename = flatbuffers-24.3.6.tar.gz
22+
source_hash = 5d8bfbf5b1b4c47f516e7673677f0e8db0efd32f262f7a14c3fd5ff67e2bd8fc
23+
patch_filename = flatbuffers_24.3.6-1_patch.zip
24+
patch_url = https://wrapdb.mesonbuild.com/v2/flatbuffers_24.3.6-1/get_patch
25+
patch_hash = bc0e1035a67ae74b1f862491fe2b0fd49b2889d989508143fff0a45508421bd7
26+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/flatbuffers_24.3.6-1/flatbuffers-24.3.6.tar.gz
27+
wrapdb_version = 24.3.6-1
28+
29+
[provide]
30+
flatbuffers = flatbuffers_dep
31+
program_names = flatc, flathash

cpp/subprojects/gtest.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 = googletest-1.15.2
20+
source_url = https://github.com/google/googletest/archive/refs/tags/v1.15.2.tar.gz
21+
source_filename = gtest-1.15.2.tar.gz
22+
source_hash = 7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926
23+
patch_filename = gtest_1.15.2-1_patch.zip
24+
patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.15.2-1/get_patch
25+
patch_hash = b41cba05fc61d47b2ba5bf95732eb86ce2b67303f291b68a9587b7563c318141
26+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.15.2-1/gtest-1.15.2.tar.gz
27+
wrapdb_version = 1.15.2-1
28+
29+
[provide]
30+
gtest = gtest_dep
31+
gtest_main = gtest_main_dep
32+
gmock = gmock_dep
33+
gmock_main = gmock_main_dep

cpp/subprojects/rapidjson.wrap

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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 = rapidjson-1.1.0
20+
source_url = https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz
21+
source_filename = rapidjson-1.1.0.tar.gz
22+
source_hash = bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e
23+
patch_filename = rapidjson_1.1.0-2_patch.zip
24+
patch_url = https://wrapdb.mesonbuild.com/v2/rapidjson_1.1.0-2/get_patch
25+
patch_hash = c1480d0ecef09dbaa4b4d85d86090205386fb2c7e87f4f158b20dbbda14c9afc
26+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/rapidjson_1.1.0-2/rapidjson-1.1.0.tar.gz
27+
wrapdb_version = 1.1.0-2
28+
29+
[provide]
30+
rapidjson = rapidjson_dep

0 commit comments

Comments
 (0)