kou commented on code in PR #1904:
URL: https://github.com/apache/arrow-adbc/pull/1904#discussion_r1626843592
##########
.gitignore:
##########
@@ -121,3 +121,7 @@ target/
/ci/linux-packages/yum/merged/
/ci/linux-packages/yum/repositories/
/ci/linux-packages/yum/tmp/
+
+# Meson subproject support
+c/subprojects/*
+!c/subprojects/*.wrap
Review Comment:
```suggestion
/c/subprojects/*
!/c/subprojects/*.wrap
```
##########
.github/workflows/native-unix.yml:
##########
@@ -206,6 +206,38 @@ jobs:
run: |
./ci/scripts/cpp_test.sh "$(pwd)/build"
+ drivers-test-meson:
+ name: "Meson - C/C++ (Conda/${{ matrix.os }})"
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: ["ubuntu-latest"]
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
+ - name: Install Dependencies
+ run: |
+ sudo apt update
+ sudo apt install -y libpq-dev ninja-build
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.x'
+ - name: Install Meson via Python
+ run: pip install meson
+ - name: Build
+ run: |
+ cd c
+ meson setup -Dpostgresql=true -Dsqlite=true -Ddriver_manager=true
builddir
+ cd builddir
+ meson compile
+ - name: Test
+ run: |
+ cd c/builddir
+ meson test
Review Comment:
```suggestion
meson test -C c/build
```
##########
CONTRIBUTING.md:
##########
@@ -148,6 +148,43 @@ for details.
[cmake-prefix-path]:
https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html
[gtest]: https://github.com/google/googletest/
+### C/C++ with Meson
+
+While CMake is the officially supported build generator, there is limited,
+experimental support for the Meson build system. Meson offers arguably better
+dependency management than CMake, with a syntax that Python developers may
+find more readable.
+
+To use Meson, start at the c directory and run:
+
+```shell
+$ meson setup builddir && cd builddir
+```
+
+For a full list of options, ``meson configure`` will bring up a pager
+with sections that you can navigate. The "Project Options" section in
particular
+will show you what ADBC has to offer, and each option can be provided using
+the form ``-D_option_:_value_``. For example, to build the a debug version of
+the SQLite3 driver along with tests, you would run:
+
+```shell
+$ meson configure -Dbuildtype=debug -Dsqlite=true -Dtests=true
+```
+
+With the options set, you can then compile the project. For most dependencies,
+Meson will try to find them on your system and fall back to downloading a copy
+from its WrapDB for you:
+
+```shell
+$ meson compile
Review Comment:
```suggestion
$ meson compile -C build
```
##########
CONTRIBUTING.md:
##########
@@ -148,6 +148,43 @@ for details.
[cmake-prefix-path]:
https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html
[gtest]: https://github.com/google/googletest/
+### C/C++ with Meson
+
+While CMake is the officially supported build generator, there is limited,
+experimental support for the Meson build system. Meson offers arguably better
+dependency management than CMake, with a syntax that Python developers may
+find more readable.
+
+To use Meson, start at the c directory and run:
+
+```shell
+$ meson setup builddir && cd builddir
+```
+
+For a full list of options, ``meson configure`` will bring up a pager
+with sections that you can navigate. The "Project Options" section in
particular
+will show you what ADBC has to offer, and each option can be provided using
+the form ``-D_option_:_value_``. For example, to build the a debug version of
+the SQLite3 driver along with tests, you would run:
+
+```shell
+$ meson configure -Dbuildtype=debug -Dsqlite=true -Dtests=true
Review Comment:
```suggestion
$ meson configure -Dbuildtype=debug -Dsqlite=true -Dtests=true build
```
##########
.github/workflows/native-unix.yml:
##########
@@ -206,6 +206,38 @@ jobs:
run: |
./ci/scripts/cpp_test.sh "$(pwd)/build"
+ drivers-test-meson:
+ name: "Meson - C/C++ (Conda/${{ matrix.os }})"
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: ["ubuntu-latest"]
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
+ - name: Install Dependencies
+ run: |
+ sudo apt update
+ sudo apt install -y libpq-dev ninja-build
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.x'
+ - name: Install Meson via Python
+ run: pip install meson
+ - name: Build
+ run: |
+ cd c
+ meson setup -Dpostgresql=true -Dsqlite=true -Ddriver_manager=true
builddir
+ cd builddir
+ meson compile
Review Comment:
How about avoiding `cd`?
```suggestion
meson setup -Dpostgresql=true -Dsqlite=true -Ddriver_manager=true
c c/build
meson compile -C c/build
```
##########
c/meson.build:
##########
@@ -0,0 +1,106 @@
+# 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.
+
+project(
+ 'arrow-adbc',
+ 'c', 'cpp',
+ version: '0.6.0-SNAPSHOT', # TODO: can this be dynamic?
Review Comment:
We can use
https://github.com/apache/arrow-adbc/blob/main/dev/release/utils-prepare.sh .
##########
CONTRIBUTING.md:
##########
@@ -148,6 +148,43 @@ for details.
[cmake-prefix-path]:
https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html
[gtest]: https://github.com/google/googletest/
+### C/C++ with Meson
+
+While CMake is the officially supported build generator, there is limited,
+experimental support for the Meson build system. Meson offers arguably better
+dependency management than CMake, with a syntax that Python developers may
+find more readable.
+
+To use Meson, start at the c directory and run:
+
+```shell
+$ meson setup builddir && cd builddir
Review Comment:
```suggestion
$ meson setup build
```
##########
dev/release/rat_exclude_files.txt:
##########
@@ -1,6 +1,10 @@
*.json
*.Rproj
*.Rd
+c/subprojects/fmt*
+c/subprojects/gtest*
+c/subprojects/nanoarrow*
+c/subprojects/sqlite3*
Review Comment:
Can we set our license header to `c/subprojects/*.wrap` instead of excluding
them?
##########
c/meson.build:
##########
@@ -0,0 +1,106 @@
+# 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.
+
+project(
+ 'arrow-adbc',
+ 'c', 'cpp',
+ version: '0.6.0-SNAPSHOT', # TODO: can this be dynamic?
+ license: 'Apache 2.0',
+ meson_version: '>=1.3.0',
+ default_options: [
+ 'buildtype=release',
+ 'c_std=gnu99', # TODO: gmtime_r is gnu99 - likely unintentional std
+ 'warning_level=2',
+ 'cpp_std=c++17',
+ ]
+)
+
+root_dir = include_directories('..')
+driver_dir = include_directories('driver')
+nanoarrow_dep = dependency('nanoarrow')
+fmt_dep = dependency('fmt')
+
+if get_option('tests')
+ gtest_main_dep = dependency('gtest_main')
+ # Seems to be some kind of bug with meson test
+ # gtest-port.h:1770 pthread_key_delete(key_)failed with error 22
+ # https://github.com/google/googletest/pull/4536 ???
+ gtest_dep = dependency('gtest')
+ gmock_dep = dependency('gmock')
+else
+ gtest_dep = disabler()
+ gmock_dep = disabler()
+endif
+
+if get_option('duckdb')
Review Comment:
Can we drop support for DukcDB with Meson?
I think that we don't need to maintain this because it's just for an
integration test. Users don't need this and we can do it with CMake.
##########
CONTRIBUTING.md:
##########
@@ -148,6 +148,43 @@ for details.
[cmake-prefix-path]:
https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html
[gtest]: https://github.com/google/googletest/
+### C/C++ with Meson
+
+While CMake is the officially supported build generator, there is limited,
+experimental support for the Meson build system. Meson offers arguably better
+dependency management than CMake, with a syntax that Python developers may
+find more readable.
+
+To use Meson, start at the c directory and run:
+
+```shell
+$ meson setup builddir && cd builddir
+```
+
+For a full list of options, ``meson configure`` will bring up a pager
+with sections that you can navigate. The "Project Options" section in
particular
+will show you what ADBC has to offer, and each option can be provided using
+the form ``-D_option_:_value_``. For example, to build the a debug version of
+the SQLite3 driver along with tests, you would run:
+
+```shell
+$ meson configure -Dbuildtype=debug -Dsqlite=true -Dtests=true
+```
+
+With the options set, you can then compile the project. For most dependencies,
+Meson will try to find them on your system and fall back to downloading a copy
+from its WrapDB for you:
+
+```shell
+$ meson compile
+```
+
+To run the test suite, simply run:
+
+```shell
+$ meson test
Review Comment:
```suggestion
$ meson test -C build
```
--
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]