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

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


The following commit(s) were added to refs/heads/main by this push:
     new 5fed87f06 build(c): Use feature options in Meson (#2719)
5fed87f06 is described below

commit 5fed87f06d76a8f61537e114bff5d0792b2db067
Author: William Ayd <william....@icloud.com>
AuthorDate: Tue Apr 22 02:04:58 2025 -0400

    build(c): Use feature options in Meson (#2719)
    
    This is a minor change that converts the Meson configuration to using
    feature options instead of booleans. The feature option is documented
    here:
    
    https://mesonbuild.com/Build-options.html#features
    
    In short, the feature option makes it easier to switch between opting in
    and opting out of settings. By default, you are opted out of everything
    and need to explicitly opt in via:
    
    ```sh
    meson setup -Dpostgresql=enabled -Dsqlite=enabled
    ```
    
    However, with auto features, you can turn everything on and instead opt
    out of what you do not want to build:
    
    ```sh
    meson setup -Dauto_features=enabled -Dsnowflake=disabled -Dbigquery=disabled
    ```
---
 .github/workflows/native-unix.yml |  7 +-----
 CONTRIBUTING.md                   |  2 +-
 c/driver/bigquery/meson.build     |  4 ++--
 c/driver/common/meson.build       |  2 +-
 c/driver/flightsql/meson.build    |  2 +-
 c/driver/postgresql/meson.build   |  2 +-
 c/driver/snowflake/meson.build    |  2 +-
 c/driver/sqlite/meson.build       |  2 +-
 c/meson.build                     | 18 +++++++--------
 c/meson.options                   | 46 +++++++--------------------------------
 10 files changed, 26 insertions(+), 61 deletions(-)

diff --git a/.github/workflows/native-unix.yml 
b/.github/workflows/native-unix.yml
index 98dce45a2..0e3c6493a 100644
--- a/.github/workflows/native-unix.yml
+++ b/.github/workflows/native-unix.yml
@@ -251,12 +251,7 @@ jobs:
         run: |
           meson setup \
             -Db_sanitize=address,undefined \
-            -Ddriver_manager=true \
-            -Dflightsql=true \
-            -Dpostgresql=true \
-            -Dsnowflake=true \
-            -Dsqlite=true \
-            -Dtests=true \
+            -Dauto_features=enabled \
             c c/build
           meson compile -C c/build
       - name: Test
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7608a051d..f6e7d7229 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -168,7 +168,7 @@ 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 build
+$ meson configure -Dbuildtype=debug -Dsqlite=enabled -Dtests=enabled build
 ```
 
 With the options set, you can then compile the project. For most dependencies,
diff --git a/c/driver/bigquery/meson.build b/c/driver/bigquery/meson.build
index ca1d41904..c98327c9e 100644
--- a/c/driver/bigquery/meson.build
+++ b/c/driver/bigquery/meson.build
@@ -55,11 +55,11 @@ pkg.generate(
     filebase: 'adbc-driver-bigquery',
 )
 
-if get_option('tests')
+if get_option('tests').enabled()
     exc = executable(
         'adbc-driver-bigquery-test',
         'bigquery_test.cc',
-        include_directories: [root_dir, driver_dir],
+        include_directories: [c_dir, driver_dir],
         link_with: [adbc_common_lib, adbc_driver_bigquery_lib],
         dependencies: [adbc_validation_dep],
     )
diff --git a/c/driver/common/meson.build b/c/driver/common/meson.build
index b1423f0e5..0a6a4c5fe 100644
--- a/c/driver/common/meson.build
+++ b/c/driver/common/meson.build
@@ -23,7 +23,7 @@ adbc_common_lib = library(
     install: true,
 )
 
-if get_option('tests')
+if get_option('tests').enabled()
     exc = executable(
         'adbc-driver-common-test',
         'utils_test.cc',
diff --git a/c/driver/flightsql/meson.build b/c/driver/flightsql/meson.build
index bfdfe6165..7eff6dace 100644
--- a/c/driver/flightsql/meson.build
+++ b/c/driver/flightsql/meson.build
@@ -55,7 +55,7 @@ pkg.generate(
     filebase: 'adbc-driver-flightsql',
 )
 
-if get_option('tests')
+if get_option('tests').enabled()
     exc = executable(
         'adbc-driver-flightsql-test',
         'dremio_flightsql_test.cc',
diff --git a/c/driver/postgresql/meson.build b/c/driver/postgresql/meson.build
index bd7309f57..c2c4cd72c 100644
--- a/c/driver/postgresql/meson.build
+++ b/c/driver/postgresql/meson.build
@@ -41,7 +41,7 @@ pkg.generate(
     filebase: 'adbc-driver-postgresql',
 )
 
-if get_option('tests')
+if get_option('tests').enabled()
     postgres_tests = {
         'driver-postgresql': {
             'src_name': 'driver_postgresql',
diff --git a/c/driver/snowflake/meson.build b/c/driver/snowflake/meson.build
index 2904b92d5..d8a866c86 100644
--- a/c/driver/snowflake/meson.build
+++ b/c/driver/snowflake/meson.build
@@ -55,7 +55,7 @@ pkg.generate(
     filebase: 'adbc-driver-snowflake',
 )
 
-if get_option('tests')
+if get_option('tests').enabled()
     exc = executable(
         'adbc-driver-snowflake-test',
         'snowflake_test.cc',
diff --git a/c/driver/sqlite/meson.build b/c/driver/sqlite/meson.build
index 436f51b43..c50d610bd 100644
--- a/c/driver/sqlite/meson.build
+++ b/c/driver/sqlite/meson.build
@@ -39,7 +39,7 @@ pkg.generate(
     filebase: 'adbc-driver-sqlite',
 )
 
-if get_option('tests')
+if get_option('tests').enabled()
     exc = executable(
         'adbc-driver-sqlite-test',
         sources: ['sqlite_test.cc'],
diff --git a/c/meson.build b/c/meson.build
index b9411186c..7d6653bb0 100644
--- a/c/meson.build
+++ b/c/meson.build
@@ -45,7 +45,7 @@ driver_dir = include_directories('driver')
 nanoarrow_dep = dependency('nanoarrow')
 fmt_dep = dependency('fmt')
 
-if get_option('tests')
+if get_option('tests').enabled()
     gtest_main_dep = dependency('gtest_main')
     gmock_dep = dependency('gmock')
 else
@@ -53,8 +53,8 @@ else
     gmock_dep = disabler()
 endif
 
-needs_driver_manager = get_option('driver_manager') \
-    or get_option('tests')
+needs_driver_manager = get_option('driver_manager').enabled() \
+    or get_option('tests').enabled()
 
 pkg = import('pkgconfig')
 
@@ -70,26 +70,26 @@ endif
 subdir('driver/common')
 subdir('driver/framework')
 
-if get_option('tests')
+if get_option('tests').enabled()
     subdir('validation')
 endif
 
-if get_option('bigquery')
+if get_option('bigquery').enabled()
     subdir('driver/bigquery')
 endif
 
-if get_option('flightsql')
+if get_option('flightsql').enabled()
     subdir('driver/flightsql')
 endif
 
-if get_option('postgresql')
+if get_option('postgresql').enabled()
     subdir('driver/postgresql')
 endif
 
-if get_option('sqlite')
+if get_option('sqlite').enabled()
     subdir('driver/sqlite')
 endif
 
-if get_option('snowflake')
+if get_option('snowflake').enabled()
     subdir('driver/snowflake')
 endif
diff --git a/c/meson.options b/c/meson.options
index 87d553449..ffe5c4f5c 100644
--- a/c/meson.options
+++ b/c/meson.options
@@ -15,41 +15,11 @@
 # specific language governing permissions and limitations
 # under the License.
 
-option('tests', type: 'boolean', description: 'Build tests', value: false)
-option('benchmarks', type: 'boolean', description: 'Build benchmarks', value: 
false)
-option(
-  'bigquery',
-  type: 'boolean',
-  description: 'Build ADBC BigQuery driver',
-  value: false
-)
-option(
-  'flightsql',
-  type: 'boolean',
-  description: 'Build ADBC FlightSQL driver',
-  value: false
-)
-option(
-  'driver_manager',
-  type: 'boolean',
-  description: 'Build ADBC Driver Manager',
-  value: false
-)
-option(
-  'postgresql',
-  type: 'boolean',
-  description: 'Build ADBC PostgreSQL Driver',
-  value: false
-)
-option(
-  'sqlite',
-  type: 'boolean',
-  description: 'Build ADBC SQLite Driver',
-  value: false
-)
-option(
-  'snowflake',
-  type: 'boolean',
-  description: 'Build ADBC Snowflake Driver',
-  value: false
-)
+option('tests', type: 'feature', description: 'Build tests')
+option('benchmarks', type: 'feature', description: 'Build benchmarks')
+option('bigquery', type: 'feature', description: 'Build ADBC BigQuery driver')
+option('flightsql', type: 'feature', description: 'Build ADBC FlightSQL 
driver')
+option('driver_manager', type: 'feature', description: 'Build ADBC Driver 
Manager')
+option('postgresql', type: 'feature', description: 'Build ADBC PostgreSQL 
Driver')
+option('sqlite', type: 'feature', description: 'Build ADBC SQLite Driver')
+option('snowflake', type: 'feature', description: 'Build ADBC Snowflake 
Driver')

Reply via email to