Skip to content

Commit bb45b9b

Browse files
committed
GH-45767: [C++] Fix Meson compilation issue with non-system Boost
1 parent 2fe4da0 commit bb45b9b

File tree

3 files changed

+58
-11
lines changed

3 files changed

+58
-11
lines changed

cpp/src/arrow/meson.build

+50-6
Original file line numberDiff line numberDiff line change
@@ -356,38 +356,82 @@ install_headers(
356356
)
357357

358358
if needs_tests
359+
boost_dep = dependency('boost', include_type: 'system', required: false)
360+
361+
asio_dep = dependency(
362+
'boost',
363+
include_type: 'system',
364+
modules: 'asio',
365+
required: false,
366+
)
367+
359368
filesystem_dep = dependency(
360369
'boost',
361-
modules: ['filesystem'],
370+
include_type: 'system',
371+
modules: 'filesystem',
362372
required: false,
363373
)
364-
if not filesystem_dep.found()
374+
375+
process_dep = dependency(
376+
'boost',
377+
include_type: 'system',
378+
modules: 'process',
379+
required: false,
380+
)
381+
382+
if not (boost_dep.found()
383+
and asio_dep.found()
384+
and filesystem_dep.found()
385+
and process_dep.found()
386+
)
365387
cmake = import('cmake')
366388
boost_opt = cmake.subproject_options()
367389
boost_opt.add_cmake_defines(
368-
{'BOOST_INCLUDE_LIBRARIES': 'filesystem;system'},
390+
{'BOOST_INCLUDE_LIBRARIES': 'asio;filesystem;process'},
369391
)
370392
boost_proj = cmake.subproject('boost', options: boost_opt)
371-
filesystem_dep = boost_proj.dependency('boost_filesystem')
393+
boost_dep = boost_proj.dependency(
394+
'boost_headers',
395+
include_type: 'system',
396+
)
397+
asio_dep = boost_proj.dependency('boost_asio', include_type: 'system')
398+
filesystem_dep = boost_proj.dependency(
399+
'boost_filesystem',
400+
include_type: 'system',
401+
)
402+
process_dep = boost_proj.dependency(
403+
'boost_process',
404+
include_type: 'system',
405+
)
372406
endif
373407

374408
gtest_main_dep = dependency('gtest_main')
375409
gmock_dep = dependency('gmock')
376410
else
411+
boost_dep = disabler()
412+
asio_dep = disabler()
377413
filesystem_dep = disabler()
378414
gtest_main_dep = disabler()
379415
gmock_dep = disabler()
416+
process_dep = disabler()
380417
endif
381418

382419
arrow_test_lib = static_library(
383420
'arrow_testing',
384421
sources: arrow_testing_srcs,
385-
dependencies: [arrow_dep, filesystem_dep, gtest_main_dep],
422+
dependencies: [
423+
arrow_dep,
424+
asio_dep,
425+
boost_dep,
426+
filesystem_dep,
427+
gtest_main_dep,
428+
process_dep,
429+
],
386430
)
387431

388432
arrow_test_dep = declare_dependency(
389433
link_with: [arrow_test_lib],
390-
dependencies: [arrow_dep, filesystem_dep, gmock_dep, gtest_main_dep],
434+
dependencies: [arrow_dep, gmock_dep, gtest_main_dep],
391435
)
392436

393437
array_array_test = executable(

cpp/src/arrow/util/meson.build

+8-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ conf_data.set('ARROW_GCS', false)
5959
conf_data.set('ARROW_HDFS', false)
6060
conf_data.set('ARROW_S3', false)
6161
conf_data.set('ARROW_USE_GLOG', false)
62-
conf_data.set('ARROW_USE_NATIVE_INT128', false)
62+
63+
if cpp_compiler.has_define('__SIZEOF_INT128__')
64+
use_native_int128 = true
65+
else
66+
use_native_int128 = false
67+
endif
68+
conf_data.set('ARROW_USE_NATIVE_INT128', use_native_int128)
69+
6370
conf_data.set('ARROW_WITH_BROTLI', false)
6471
conf_data.set('ARROW_WITH_BZ2', false)
6572
conf_data.set('ARROW_WITH_LZ4', false)

cpp/subprojects/boost.wrap

-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@ source_filename = boost-1.87.0-cmake.tar.gz
2121
source_hash = 78fbf579e3caf0f47517d3fb4d9301852c3154bfecdc5eeebd9b2b0292366f5b
2222
directory = boost-1.87.0
2323
method = cmake
24-
25-
[provide]
26-
boost_filesystem = boost_filesystem_dep
27-
boost_system = boost_system_dep

0 commit comments

Comments
 (0)