paleolimbot commented on code in PR #413:
URL: https://github.com/apache/arrow-nanoarrow/pull/413#discussion_r1549667296


##########
.github/workflows/meson-build.yaml:
##########
@@ -0,0 +1,61 @@
+# 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.
+
+name: Meson Build Testing
+
+on:
+  schedule:
+    - cron: '5 0 * * 0'
+  pull_request:
+    branches:
+      - main
+    paths:
+      - 'meson.build'
+      - 'meson.options'
+      - 'src/nanoarrow/meson.build'
+      - 'dev/benchmarks/meson.build'
+      - 'dev/benchmarks/c/meson.build'

Review Comment:
   ```suggestion
         - '**meson.build'
         - '**meson.options'
   ```



##########
.github/workflows/meson-build.yaml:
##########
@@ -0,0 +1,61 @@
+# 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.
+
+name: Meson Build Testing
+
+on:
+  schedule:
+    - cron: '5 0 * * 0'
+  pull_request:
+    branches:
+      - main
+    paths:
+      - 'meson.build'
+      - 'meson.options'
+      - 'src/nanoarrow/meson.build'
+      - 'dev/benchmarks/meson.build'
+      - 'dev/benchmarks/c/meson.build'
+      - '.github/workflows/meson-build.yaml'
+      - 'ci/scripts/build-with-meson.sh'
+
+permissions:
+  contents: read
+
+jobs:
+  verify-meson:
+    name: meson-build
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+
+      - name: Install system dependencies
+        run: |
+          sudo apt-get update && sudo apt-get install -y lcov ninja-build 
valgrind
+
+      - name: Install meson
+        run: |
+          python3 -m pip install meson
+
+      - name: Build Arrow C++
+        if: steps.cache-arrow-build.outputs.cache-hit != 'true'

Review Comment:
   I think that the `uses: action/cache` step also needs to be copied over here 
for the cache to kick in



##########
README.md:
##########
@@ -95,3 +95,42 @@ int print_simple_array(struct ArrowArray* array, struct 
ArrowSchema* schema) {
   return NANOARROW_OK;
 }
 ```
+
+## Building with Meson
+
+CMake is the officially supported build system for nanoarrow. However, the 
Meson backend is an experimental feature you may also wish to try.
+
+To run the test suite with Meson, you will want to first install the testing 
dependencies via the wrap database (n.b. no wrap database entry exists for 
Arrow - that must be installed separately).
+
+```sh
+meson wrap install gtest
+meson wrap install google-benchmark
+meson wrap install nlohmann_json
+```
+
+You can then set up your build directory:
+
+```sh
+meson setup builddir
+cd builddir
+```
+
+And configure your project (this could have also been done inline with 
``setup``)
+
+```sh
+meson configure -DNANOARROW_BUILD_TESTS=true -DNANOARROW_BUILD_BENCHMARKS=true
+```
+
+From there the compilation command should take care of the rest:
+
+```sh
+meson compile
+```
+
+Upon a successful build you can execute the test suite and benchmarks with the 
following commands:
+
+```sh
+meson test   # default test run

Review Comment:
   ```suggestion
   meson test nanoarrow:  # default test run
   ```



##########
examples/meson-minimal/README.md:
##########
@@ -0,0 +1,43 @@
+<!---
+  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.
+-->
+
+# Minimal CMake Example
+
+This folder contains a meson project that links to its own copy of
+nanoarrow using a subproject.
+
+To build the project:
+
+```bash
+git clone https://github.com/apache/arrow-nanoarrow.git
+cd arrow-nanoarrow/examples/meson-minimal
+meson setup builddir && cd builddir
+meson compile
+```
+
+After building, you can run the app from the build directory. The app
+parses command line arguments into an int32 array and prints out the
+resulting length (or any error encountered whilst building the array).
+
+```bash
+./example_cmake_minimal_app

Review Comment:
   ```suggestion
   ./example_meson_minimal_app
   ```



##########
examples/meson-minimal/README.md:
##########
@@ -0,0 +1,43 @@
+<!---
+  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.
+-->
+
+# Minimal CMake Example

Review Comment:
   ```suggestion
   # Minimal Meson Example
   ```



##########
README.md:
##########
@@ -95,3 +95,42 @@ int print_simple_array(struct ArrowArray* array, struct 
ArrowSchema* schema) {
   return NANOARROW_OK;
 }
 ```
+
+## Building with Meson
+
+CMake is the officially supported build system for nanoarrow. However, the 
Meson backend is an experimental feature you may also wish to try.
+
+To run the test suite with Meson, you will want to first install the testing 
dependencies via the wrap database (n.b. no wrap database entry exists for 
Arrow - that must be installed separately).
+
+```sh
+meson wrap install gtest
+meson wrap install google-benchmark
+meson wrap install nlohmann_json
+```
+

Review Comment:
   It may be worth a note here that Arrow C++ must be discoverable via 
`pkg-config` to build tests (e.g., installed via `brew install apache-arrow` or 
via linux binary packages listed on the "Get Arrow" page)



##########
README.md:
##########
@@ -95,3 +95,42 @@ int print_simple_array(struct ArrowArray* array, struct 
ArrowSchema* schema) {
   return NANOARROW_OK;
 }
 ```
+
+## Building with Meson
+
+CMake is the officially supported build system for nanoarrow. However, the 
Meson backend is an experimental feature you may also wish to try.
+
+To run the test suite with Meson, you will want to first install the testing 
dependencies via the wrap database (n.b. no wrap database entry exists for 
Arrow - that must be installed separately).
+
+```sh
+meson wrap install gtest

Review Comment:
   ```suggestion
   mkdir subprojects
   meson wrap install gtest
   ```



##########
examples/meson-minimal/src/app.c:
##########


Review Comment:
   I still think that the minimal example could be smaller here:
   
   
https://github.com/apache/arrow-nanoarrow/blob/9935713a4a853e8cdcd32ec42b983df04093ae23/examples/cmake-scenarios/src/app.cpp#L18-L26



##########
README.md:
##########
@@ -95,3 +95,42 @@ int print_simple_array(struct ArrowArray* array, struct 
ArrowSchema* schema) {
   return NANOARROW_OK;
 }
 ```
+
+## Building with Meson
+
+CMake is the officially supported build system for nanoarrow. However, the 
Meson backend is an experimental feature you may also wish to try.
+
+To run the test suite with Meson, you will want to first install the testing 
dependencies via the wrap database (n.b. no wrap database entry exists for 
Arrow - that must be installed separately).
+
+```sh
+meson wrap install gtest
+meson wrap install google-benchmark
+meson wrap install nlohmann_json
+```
+
+You can then set up your build directory:
+
+```sh
+meson setup builddir
+cd builddir
+```
+
+And configure your project (this could have also been done inline with 
``setup``)
+
+```sh
+meson configure -DNANOARROW_BUILD_TESTS=true -DNANOARROW_BUILD_BENCHMARKS=true
+```
+
+From there the compilation command should take care of the rest:
+
+```sh
+meson compile
+```
+
+Upon a successful build you can execute the test suite and benchmarks with the 
following commands:
+
+```sh
+meson test   # default test run
+meson test --wrap valgrind  # run tests under valgrind
+meson test --benchmark # run benchmarks

Review Comment:
   ```suggestion
   meson test --benchmark --verbose # run benchmarks
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to