[libgda] Meson: remove global args allows use as subproject



commit 017abe2b37fa4664757d408eb79842baea123b66
Author: Daniel Espinosa <esodan gmail com>
Date:   Mon Apr 8 18:17:38 2019 -0500

    Meson: remove global args allows use as subproject

 libgda/meson.build                               |  1 +
 meson.build                                      |  2 -
 providers/mysql/meson.build                      |  4 +-
 providers/postgres/meson.build                   | 14 ++--
 providers/skel-implementation/capi/meson.build   | 12 ++--
 providers/skel-implementation/models/meson.build | 12 ++--
 providers/sqlcipher/meson.build                  |  4 +-
 providers/sqlite/meson.build                     | 14 ++--
 tests/data-models/meson.build                    | 80 ++++++----------------
 tests/meson.build                                | 85 ++++++------------------
 10 files changed, 80 insertions(+), 148 deletions(-)
---
diff --git a/libgda/meson.build b/libgda/meson.build
index 5fbe10225..314498ea1 100644
--- a/libgda/meson.build
+++ b/libgda/meson.build
@@ -310,6 +310,7 @@ libgda_cargs = [
 
 libgda_cargs += sqlite_cargs
 libgda_cargs += binreloc_cargs
+libgda_cargs += c_args
 
 libgda_dep += sqlite_deps
 
diff --git a/meson.build b/meson.build
index 725106450..fcf8d9641 100644
--- a/meson.build
+++ b/meson.build
@@ -256,8 +256,6 @@ if get_option('enable-debug')
   c_args += '-DGDA_DEBUG'
 endif
 
-add_global_arguments(c_args, language : 'c')
-
 # Files references by sqlite embedded and provider
 sqlite_xml_fnames = [
        'sqlite_specs_dsn',
diff --git a/providers/mysql/meson.build b/providers/mysql/meson.build
index 125ec3fc6..5b9f4e3db 100644
--- a/providers/mysql/meson.build
+++ b/providers/mysql/meson.build
@@ -129,6 +129,8 @@ mysql_args += [
        '-DCLASS_PREFIX="GdaMySQL"'
        ]
 
+mysql_args += c_args
+
 libgda_mysql_provider = library ('gda-mysql-'+project_api_version,
        libgda_mysql_sources,
        dependencies: [
@@ -154,4 +156,4 @@ libgda_mysql_providerpc = configure_file(
                        output: 'libgda-mysql-'+project_api_version+'.pc',
                        configuration : conf,
                        install_dir: join_paths(get_option('libdir'),'pkgconfig')
-                       )
\ No newline at end of file
+                       )
diff --git a/providers/postgres/meson.build b/providers/postgres/meson.build
index b5f1a5693..a91901f91 100644
--- a/providers/postgres/meson.build
+++ b/providers/postgres/meson.build
@@ -99,6 +99,13 @@ libgda_postgres_providerpc = configure_file(
 
 libgda_postgres_sources += libgda_pg_sources
 
+libgda_postgres_cargs = [
+               '-include',
+               meson.build_root() + '/config.h',
+               ]
+
+libgda_postgres_cargs += c_args
+
 libgda_postgres_provider = library ('gda-postgres-'+project_api_version,
        libgda_postgres_sources,
        dependencies: [
@@ -107,14 +114,11 @@ libgda_postgres_provider = library ('gda-postgres-'+project_api_version,
                pg_reusable_dep,
                inc_postgresh_dep
                ],
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               ],
+       c_args: libgda_postgres_cargs,
        link_args: [
                '-export-dynamic',
                ],
        link_with: libgda,
        install: true,
        install_dir: join_paths(get_option('libdir'), project_package, 'providers')
-       )
\ No newline at end of file
+       )
diff --git a/providers/skel-implementation/capi/meson.build b/providers/skel-implementation/capi/meson.build
index c2bc65d5b..c39c777ad 100644
--- a/providers/skel-implementation/capi/meson.build
+++ b/providers/skel-implementation/capi/meson.build
@@ -141,6 +141,13 @@ libgda_capi_sources += capi_lemon_parserc
 libgda_capi_sources += capi_lemon_parserh
 libgda_capi_sources += capi_token_types
 
+libgda_capi_provider_cargs = [
+               '-include',
+               meson.build_root() + '/config.h',
+               ]
+
+libgda_capi_provider_cargs += c_args
+
 libgda_capi_provider = library ('gda-capi',
        libgda_capi_sources,
        dependencies: [
@@ -150,10 +157,7 @@ libgda_capi_provider = library ('gda-capi',
                inc_libgda_capih_dep,
                inc_sqliteh_dep,
                ],
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               ],
+       c_args: libgda_capi_provider_cargs,
        link_args: [
                '-export-dynamic',
                ],
diff --git a/providers/skel-implementation/models/meson.build 
b/providers/skel-implementation/models/meson.build
index 6c8aab985..008940057 100644
--- a/providers/skel-implementation/models/meson.build
+++ b/providers/skel-implementation/models/meson.build
@@ -50,6 +50,13 @@ libgda_sqlite_providerpc = configure_file(
                        configuration : conf,
                        install_dir: join_paths(get_option('libdir'),'pkgconfig')
                        )
+
+libgda_models_provider_cargs = [
+               '-include',
+               meson.build_root() + '/config.h',
+               ]
+libgda_models_provider_cargs += c_args
+
 libgda_models_provider = library ('libgda-models',
        libgda_models_sources,
        dependencies: [
@@ -58,10 +65,7 @@ libgda_models_provider = library ('libgda-models',
                inc_libgda_modelsh_dep,
                inc_sqliteh_dep,
                ],
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               ],
+       c_args: libgda_models_provider_cargs,
        link_with: libgda,
        install: false,
        )
diff --git a/providers/sqlcipher/meson.build b/providers/sqlcipher/meson.build
index c1dd684bf..87ce1b0fe 100644
--- a/providers/sqlcipher/meson.build
+++ b/providers/sqlcipher/meson.build
@@ -94,6 +94,8 @@ sqlcipher_cargs += [
                '-DSQLITE_ENABLE_COLUMN_METADATA',
                '-DSQLITE_THREADSAFE=1'
                ]
+sqlcipher_cargs += c_args
+
 
 libgda_sqlcipher_providerpc = configure_file(output : 'libgda-sqlcipher-'+project_api_version+'.pc',
                        configuration : conf,
@@ -113,4 +115,4 @@ libgda_sqlcipher_provider = library ('gda-sqlcipher-'+project_api_version,
        link_with: libgda,
        install: true,
        install_dir: join_paths(get_option('libdir'), project_package, 'providers')
-       )
\ No newline at end of file
+       )
diff --git a/providers/sqlite/meson.build b/providers/sqlite/meson.build
index 058a21c53..66fe545c5 100644
--- a/providers/sqlite/meson.build
+++ b/providers/sqlite/meson.build
@@ -62,6 +62,14 @@ libgda_sqlite_providerpc = configure_file(output : 'libgda-sqlite-'+project_api_
                        configuration : conf,
                        install_dir: join_paths(get_option('libdir'),'pkgconfig')
                        )
+
+libgda_sqlite_provider_cargs = [
+               '-include',
+               meson.build_root() + '/config.h',
+               '-I'+join_paths(get_option ('prefix'), get_option('includedir'))
+               ]
+libgda_sqlite_provider_cargs += c_args
+
 libgda_sqlite_provider = library ('gda-sqlite-'+project_api_version,
        libgda_sqlite_sources,
        dependencies: [
@@ -71,11 +79,7 @@ libgda_sqlite_provider = library ('gda-sqlite-'+project_api_version,
                inc_sqliteh_dep,
                inc_libgdah_dep
                ],
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-I'+join_paths(get_option ('prefix'), get_option('includedir'))
-               ],
+       c_args: libgda_sqlite_provider_cargs,
        link_with: libgda,
        install: true,
        install_dir: join_paths(get_option('libdir'), project_package, 'providers')
diff --git a/tests/data-models/meson.build b/tests/data-models/meson.build
index 0386656b5..9b7967eae 100644
--- a/tests/data-models/meson.build
+++ b/tests/data-models/meson.build
@@ -16,12 +16,7 @@ testsf = files([
 
 tchki = executable('check_model_import',
        ['check_model_import.c'] + common_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -39,12 +34,7 @@ test('ModelImport', tchki,
 
 tchkv = executable('check_virtual',
        ['check_virtual.c'] + common_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -62,12 +52,7 @@ test('Virtual', tchkv,
 
 tchkdp = executable('check_data_proxy',
        ['check_data_proxy.c'] + common_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -87,12 +72,7 @@ test('DataProxy', tchkdp,
 
 tchkmc = executable('check_model_copy',
        ['check_model_copy.c'] + common_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -110,12 +90,7 @@ test('ModelCopy', tchkmc,
 
 tchkpm = executable('check_pmodel',
        ['check_pmodel.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -136,12 +111,7 @@ test('PModel', tchkpm,
 
 tchkemrs = executable('check_empty_rs',
        ['check_empty_rs.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -160,12 +130,7 @@ test('EmptyRS', tchkemrs,
 
 tchkmerr = executable('check_model_errors',
        ['check_model_errors.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -183,12 +148,7 @@ test('ModelErrors', tchkmerr,
        )
 tchkvcnc = executable('check_vcnc',
        ['check_vcnc.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -206,14 +166,14 @@ test('VirtualConnection', tchkvcnc,
                ]
        )
 
+tchkpivot_cargs = [
+       '-DROOT_DIR="'+meson.source_root()+'"'
+       ]
+tchkpivot_cargs += test_cargs
+
 tchkpivot = executable('check_pivot',
        ['check_pivot.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DROOT_DIR="'+meson.source_root()+'"'
-               ],
+       c_args: tchkpivot_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -230,14 +190,14 @@ test('Pivot', tchkpivot,
                ]
        )
 
+tchkdsi_cargs = [
+       '-DBUILD_DIR="'+meson.current_build_dir()+'"'
+       ]
+tchkdsi_cargs += test_cargs
 
 tchkdsi = executable('check_data_select_iter',
        ['check_data_select_iter.c'],
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DBUILD_DIR="'+meson.current_build_dir()+'"'
-               ],
+       c_args: tchkdsi_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -253,4 +213,4 @@ test('DataSelectIter', tchkdsi,
                'GDA_TOP_SRC_DIR='+meson.source_root(),
                'GDA_TOP_BUILD_DIR='+meson.build_root()
                ]
-       )
\ No newline at end of file
+       )
diff --git a/tests/meson.build b/tests/meson.build
index dede6ad79..37f7bd8e2 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,3 +1,10 @@
+test_cargs = [
+       '-include',
+       meson.build_root() + '/config.h',
+       '-DCHECK_FILES="'+meson.source_root()+'"',
+       '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
+       ]
+test_cargs += c_args
 
 test_headers = files([
        'raw-ddl-creator.h'
@@ -24,12 +31,7 @@ tests_sources += common_sources
 
 trddlc = executable('test-ddl-creator test',
        ['test-ddl-creator.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -45,15 +47,9 @@ test('RawDdlCreator', trddlc,
                ]
        )
 
-
 tbc = executable('test-bin-converter',
        ['test-bin-converter.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -69,14 +65,10 @@ test('BinConverter', tbc,
                ]
        )
 
+
 tsqli = executable('test-sql-identifier',
        ['test-sql-identifier.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -94,12 +86,7 @@ test('SqlIdentifier', tsqli,
 
 tiq = executable('test-identifiers-quotes',
        ['test-identifiers-quotes.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -117,12 +104,7 @@ test('IdentifiersQuotes', tiq,
 
 tsqlb = executable('test-sql-builder',
        ['test-sql-builder.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -140,12 +122,7 @@ test('SqlBuilder', tsqlb,
 
 tcstrs = executable('test-connection-string-split',
        ['test-connection-string-split.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -163,12 +140,7 @@ test('ConnectionStringSplit', tcstrs,
 
 tipar = executable('test-input-parsers',
        ['test-input-parsers.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -186,12 +158,7 @@ test('InputParsers', tipar,
 
 tqkl = executable('test-quark-list',
        ['test-quark-list.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -209,12 +176,7 @@ test('QuarkList', tqkl,
 
 tsqlr = executable('test-sql-renderer',
        ['test-sql-renderer.c'] + tests_sources,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -232,12 +194,7 @@ test('SqlRenderer', tsqlr,
 
 tso = executable('test-server-operation',
        ['test-server-operation.c'] ,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DCHECK_FILES="'+meson.source_root()+'"',
-               '-DTOP_BUILD_DIR="'+meson.build_root()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,
@@ -255,11 +212,7 @@ test('ServerOperation', tso,
 
 tmp = executable('test-provider-meta',
        ['test-provider-meta.c'] ,
-       c_args: [
-               '-include',
-               meson.build_root() + '/config.h',
-               '-DBUILD_DIR="'+meson.current_build_dir()+'"'
-               ],
+       c_args: test_cargs,
        link_with: libgda,
        dependencies: [
                libgda_dep,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]