Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,18 @@ if [ "${ARROW_OFFLINE}" = "ON" ]; then
fi

if [ "${ARROW_USE_MESON:-OFF}" = "ON" ]; then
function meson_boolean() {
if [ "${1}" = "ON" ]; then
echo "true"
else
echo "false"
fi
}

meson setup \
--prefix=${MESON_PREFIX:-${ARROW_HOME}} \
--buildtype=${ARROW_BUILD_TYPE:-debug} \
-Dtests=$(meson_boolean ${ARROW_BUILD_TESTS:-OFF}) \
. \
${source_dir}
elif [ "${ARROW_EMSCRIPTEN:-OFF}" = "ON" ]; then
Expand Down
6 changes: 6 additions & 0 deletions cpp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ cmake-build-*/
*.kdev4
*.log
*.swp

# meson subprojects - wrap files need to be kept to let meson download
# dependencies as needed, but dependencies themselves should not be versioned
/subprojects/*
!/subprojects/packagefiles
!/subprojects/*.wrap
6 changes: 6 additions & 0 deletions cpp/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,10 @@ if git_description == ''
git_description = run_command('git', 'describe', '--tags', check: false).stdout().strip()
endif

needs_integration = false

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to follow along with the CMake configuration. The option doesn't yet exist in Meson so I've hard-coded for now

needs_tests = get_option('tests')
needs_ipc = get_option('ipc') or needs_tests
needs_testing = get_option('testing') or needs_tests
needs_json = get_option('json') or needs_testing

subdir('src/arrow')
28 changes: 28 additions & 0 deletions cpp/meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
# specific language governing permissions and limitations
# under the License.

option(
'ipc',
type: 'boolean',
description: 'Build the Arrow IPC extensions',
value: false,
)

option(
'json',
type: 'boolean',
description: 'Build Arrow with JSON support',
value: false,
)

option(
'git_id',
type: 'string',
Expand All @@ -30,3 +44,17 @@ option(
type: 'string',
description: 'Arbitrary string that identifies the kind of package (for informational purposes)',
)

option(
'testing',
type: 'boolean',
description: 'Build the Arrow testing libraries',
value: false,
)

option(
'tests',
type: 'boolean',
description: 'Build the Arrow googletest unit tests',
value: false,
)
138 changes: 138 additions & 0 deletions cpp/src/arrow/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,87 @@ arrow_components = {
},
}

arrow_testing_srcs = [
'io/test_common.cc',
'ipc/test_common.cc',
'testing/fixed_width_test_util.cc',
'testing/generator.cc',
'testing/gtest_util.cc',
'testing/math.cc',
'testing/process.cc',
'testing/random.cc',
'testing/util.cc',
]

if needs_integration or needs_tests
arrow_components += {
'arrow_integration': {
'sources': [
'integration/c_data_integration_internal.cc',
'integration/json_integration.cc',
'integration/json_internal.cc',
],
'include_dirs': [],
'dependencies': [],
},
}
endif

if needs_json
rapidjson_dep = dependency('rapidjson', include_type: 'system')
else
rapidjson_dep = disabler()
endif

if needs_ipc
arrow_ipc_srcs = [
'ipc/dictionary.cc',
'ipc/feather.cc',
'ipc/message.cc',
'ipc/metadata_internal.cc',
'ipc/options.cc',
'ipc/reader.cc',
'ipc/writer.cc',
]

flatbuffers_dep = dependency('flatbuffers')
arrow_ipc_deps = [flatbuffers_dep]

if needs_json
arrow_ipc_srcs += 'ipc/json_simple.cc'
arrow_ipc_deps += rapidjson_dep
endif

arrow_components += {
'arrow_ipc': {
'sources': arrow_ipc_srcs,
'include_dirs': [],
'dependencies': arrow_ipc_deps,
},
}
endif

if needs_json
arrow_components += {
'arrow_json': {
'sources': [
'extension/fixed_shape_tensor.cc',
'extension/opaque.cc',
'json/options.cc',
'json/chunked_builder.cc',
'json/chunker.cc',
'json/converter.cc',
'json/object_parser.cc',
'json/object_writer.cc',
'json/parser.cc',
'json/reader.cc',
],
'include_dirs': [],
'dependencies': [rapidjson_dep],
},
}
endif

arrow_srcs = []
include_dir = include_directories('..')
arrow_includes = [include_dir]
Expand Down Expand Up @@ -289,6 +370,63 @@ install_headers(
install_dir: 'arrow',
)

if needs_tests
filesystem_dep = dependency(
'boost',
modules: ['filesystem'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need system too?

Suggested change
modules: ['filesystem'],
modules: ['filesystem', 'system'],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we need that at the moment. If we do, I think we might need to also have filesystem_dep and system_dep be separate dependencies rather than included in one (unless we don't ever care to differentiate between them)

required: false,
)
if not filesystem_dep.found()
cmake = import('cmake')
boost_opt = cmake.subproject_options()
boost_opt.add_cmake_defines(
{'BOOST_INCLUDE_LIBRARIES': 'filesystem;system'},
)
boost_proj = cmake.subproject('boost', options: boost_opt)
filesystem_dep = boost_proj.dependency('boost_filesystem')
endif

gtest_main_dep = dependency('gtest_main')
gmock_dep = dependency('gmock')
else
filesystem_dep = disabler()
gtest_main_dep = disabler()
gmock_dep = disabler()
endif

arrow_test_lib = static_library(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static_library is required here because the Meson wrap dependency for gtest only provides consumers with the source files, and when using that in two different shared libraries then linking together you get an ODR violation.

See also mesonbuild/wrapdb#1937

'arrow_testing',
sources: arrow_testing_srcs,
include_directories: [include_dir],
link_with: [arrow_lib],
dependencies: [filesystem_dep, gtest_main_dep],
)

arrow_test_dep = declare_dependency(
link_with: [arrow_lib, arrow_test_lib],
include_directories: [include_dir],
dependencies: [filesystem_dep, gmock_dep, gtest_main_dep],
)

array_array_test = executable(
'arrow_array_test',
sources: [
'array/array_test.cc',
'array/array_binary_test.cc',
'array/array_dict_test.cc',
'array/array_list_test.cc',
'array/array_list_view_test.cc',
'array/array_run_end_test.cc',
'array/array_struct_test.cc',
'array/array_union_test.cc',
'array/array_view_test.cc',
'array/statistics_test.cc',
],
dependencies: [arrow_test_dep],
)

test('arrow_array_test', array_array_test)

version = meson.project_version()

version_no_snapshot = version.split('-SNAPSHOT')[0]
Expand Down
27 changes: 27 additions & 0 deletions cpp/subprojects/boost.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[wrap-file]
source_url = https://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-cmake.tar.gz
source_filename = boost-1.87.0-cmake.tar.gz
source_hash = 78fbf579e3caf0f47517d3fb4d9301852c3154bfecdc5eeebd9b2b0292366f5b
directory = boost-1.87.0
method = cmake

[provide]
boost_filesystem = boost_filesystem_dep
boost_system = boost_system_dep
31 changes: 31 additions & 0 deletions cpp/subprojects/flatbuffers.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[wrap-file]
directory = flatbuffers-24.3.6
source_url = https://github.com/google/flatbuffers/archive/v24.3.6.tar.gz
source_filename = flatbuffers-24.3.6.tar.gz
source_hash = 5d8bfbf5b1b4c47f516e7673677f0e8db0efd32f262f7a14c3fd5ff67e2bd8fc
patch_filename = flatbuffers_24.3.6-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/flatbuffers_24.3.6-1/get_patch
patch_hash = bc0e1035a67ae74b1f862491fe2b0fd49b2889d989508143fff0a45508421bd7
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/flatbuffers_24.3.6-1/flatbuffers-24.3.6.tar.gz
wrapdb_version = 24.3.6-1

[provide]
flatbuffers = flatbuffers_dep
program_names = flatc, flathash
33 changes: 33 additions & 0 deletions cpp/subprojects/gtest.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[wrap-file]
directory = googletest-1.15.2
source_url = https://github.com/google/googletest/archive/refs/tags/v1.15.2.tar.gz
source_filename = gtest-1.15.2.tar.gz
source_hash = 7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926
patch_filename = gtest_1.15.2-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.15.2-1/get_patch
patch_hash = b41cba05fc61d47b2ba5bf95732eb86ce2b67303f291b68a9587b7563c318141
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.15.2-1/gtest-1.15.2.tar.gz
wrapdb_version = 1.15.2-1

[provide]
gtest = gtest_dep
gtest_main = gtest_main_dep
gmock = gmock_dep
gmock_main = gmock_main_dep
30 changes: 30 additions & 0 deletions cpp/subprojects/rapidjson.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[wrap-file]
directory = rapidjson-1.1.0
source_url = https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz
source_filename = rapidjson-1.1.0.tar.gz
source_hash = bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e
patch_filename = rapidjson_1.1.0-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/rapidjson_1.1.0-2/get_patch
patch_hash = c1480d0ecef09dbaa4b4d85d86090205386fb2c7e87f4f158b20dbbda14c9afc
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/rapidjson_1.1.0-2/rapidjson-1.1.0.tar.gz
wrapdb_version = 1.1.0-2

[provide]
rapidjson = rapidjson_dep