This is an automated email from the ASF dual-hosted git repository.

willayd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new b9d014d30f GH-45589: [C++] Enable singular test in Meson configuration 
(#45596)
b9d014d30f is described below

commit b9d014d30f6ea80e5ebd306b6af2fd23dbfea721
Author: William Ayd <[email protected]>
AuthorDate: Wed Mar 12 10:46:03 2025 -0400

    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 <[email protected]>
    Signed-off-by: Will Ayd <[email protected]>
---
 ci/scripts/cpp_build.sh                          |   9 ++
 cpp/.gitignore                                   |   6 +
 cpp/meson.build                                  |   6 +
 cpp/meson.options                                |  28 +++++
 cpp/src/arrow/meson.build                        | 138 +++++++++++++++++++++++
 cpp/{.gitignore => subprojects/boost.wrap}       |  36 ++----
 cpp/{.gitignore => subprojects/flatbuffers.wrap} |  40 +++----
 cpp/{.gitignore => subprojects/gtest.wrap}       |  42 +++----
 cpp/{.gitignore => subprojects/rapidjson.wrap}   |  39 ++-----
 9 files changed, 236 insertions(+), 108 deletions(-)

diff --git a/ci/scripts/cpp_build.sh b/ci/scripts/cpp_build.sh
index 9611f94d52..8f53a22536 100755
--- a/ci/scripts/cpp_build.sh
+++ b/ci/scripts/cpp_build.sh
@@ -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
diff --git a/cpp/.gitignore b/cpp/.gitignore
index e1e921762f..134bd4f3ee 100644
--- a/cpp/.gitignore
+++ b/cpp/.gitignore
@@ -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
diff --git a/cpp/meson.build b/cpp/meson.build
index 9eca739b82..f855f6218b 100644
--- a/cpp/meson.build
+++ b/cpp/meson.build
@@ -56,4 +56,10 @@ if git_description == ''
     git_description = run_command('git', 'describe', '--tags', check: 
false).stdout().strip()
 endif
 
+needs_integration = false
+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')
diff --git a/cpp/meson.options b/cpp/meson.options
index 1391cd361c..8c120b12ea 100644
--- a/cpp/meson.options
+++ b/cpp/meson.options
@@ -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',
@@ -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,
+)
diff --git a/cpp/src/arrow/meson.build b/cpp/src/arrow/meson.build
index 15aab62d7b..ca95236722 100644
--- a/cpp/src/arrow/meson.build
+++ b/cpp/src/arrow/meson.build
@@ -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]
@@ -289,6 +370,63 @@ install_headers(
     install_dir: 'arrow',
 )
 
+if needs_tests
+    filesystem_dep = dependency(
+        'boost',
+        modules: ['filesystem'],
+        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(
+    '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]
diff --git a/cpp/.gitignore b/cpp/subprojects/boost.wrap
similarity index 67%
copy from cpp/.gitignore
copy to cpp/subprojects/boost.wrap
index e1e921762f..8f94fe2ec9 100644
--- a/cpp/.gitignore
+++ b/cpp/subprojects/boost.wrap
@@ -15,31 +15,13 @@
 # specific language governing permissions and limitations
 # under the License.
 
-thirdparty/*.tar*
-CMakeFiles/
-CMakeCache.txt
-CMakeUserPresets.json
-CTestTestfile.cmake
-Makefile
-cmake_install.cmake
-build/
-*-build/
-Testing/
-build-support/boost_*
-vcpkg_installed/
+[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
 
-# Build directories created by Clion
-cmake-build-*/
-
-#########################################
-# Editor temporary/working/backup files #
-.#*
-*\#*\#
-[#]*#
-*~
-*$
-*.bak
-*flymake*
-*.kdev4
-*.log
-*.swp
+[provide]
+boost_filesystem = boost_filesystem_dep
+boost_system = boost_system_dep
diff --git a/cpp/.gitignore b/cpp/subprojects/flatbuffers.wrap
similarity index 54%
copy from cpp/.gitignore
copy to cpp/subprojects/flatbuffers.wrap
index e1e921762f..336344b4fd 100644
--- a/cpp/.gitignore
+++ b/cpp/subprojects/flatbuffers.wrap
@@ -15,31 +15,17 @@
 # specific language governing permissions and limitations
 # under the License.
 
-thirdparty/*.tar*
-CMakeFiles/
-CMakeCache.txt
-CMakeUserPresets.json
-CTestTestfile.cmake
-Makefile
-cmake_install.cmake
-build/
-*-build/
-Testing/
-build-support/boost_*
-vcpkg_installed/
+[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
 
-# Build directories created by Clion
-cmake-build-*/
-
-#########################################
-# Editor temporary/working/backup files #
-.#*
-*\#*\#
-[#]*#
-*~
-*$
-*.bak
-*flymake*
-*.kdev4
-*.log
-*.swp
+[provide]
+flatbuffers = flatbuffers_dep
+program_names = flatc, flathash
diff --git a/cpp/.gitignore b/cpp/subprojects/gtest.wrap
similarity index 53%
copy from cpp/.gitignore
copy to cpp/subprojects/gtest.wrap
index e1e921762f..ee7d0b9f36 100644
--- a/cpp/.gitignore
+++ b/cpp/subprojects/gtest.wrap
@@ -15,31 +15,19 @@
 # specific language governing permissions and limitations
 # under the License.
 
-thirdparty/*.tar*
-CMakeFiles/
-CMakeCache.txt
-CMakeUserPresets.json
-CTestTestfile.cmake
-Makefile
-cmake_install.cmake
-build/
-*-build/
-Testing/
-build-support/boost_*
-vcpkg_installed/
+[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
 
-# Build directories created by Clion
-cmake-build-*/
-
-#########################################
-# Editor temporary/working/backup files #
-.#*
-*\#*\#
-[#]*#
-*~
-*$
-*.bak
-*flymake*
-*.kdev4
-*.log
-*.swp
+[provide]
+gtest = gtest_dep
+gtest_main = gtest_main_dep
+gmock = gmock_dep
+gmock_main = gmock_main_dep
diff --git a/cpp/.gitignore b/cpp/subprojects/rapidjson.wrap
similarity index 56%
copy from cpp/.gitignore
copy to cpp/subprojects/rapidjson.wrap
index e1e921762f..8295f19852 100644
--- a/cpp/.gitignore
+++ b/cpp/subprojects/rapidjson.wrap
@@ -15,31 +15,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
-thirdparty/*.tar*
-CMakeFiles/
-CMakeCache.txt
-CMakeUserPresets.json
-CTestTestfile.cmake
-Makefile
-cmake_install.cmake
-build/
-*-build/
-Testing/
-build-support/boost_*
-vcpkg_installed/
+[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
 
-# Build directories created by Clion
-cmake-build-*/
-
-#########################################
-# Editor temporary/working/backup files #
-.#*
-*\#*\#
-[#]*#
-*~
-*$
-*.bak
-*flymake*
-*.kdev4
-*.log
-*.swp
+[provide]
+rapidjson = rapidjson_dep

Reply via email to