diff --git tests/meson.build tests/meson.build index 7e01595..813a1d1 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -45,13 +45,24 @@ test_install_dir = join_paths(get_option('datadir'), 'gobject-introspection-1.0' install_data(installed_sources, install_dir: test_install_dir) +if get_option('enable-host-gi') + ev_scanner_command = [ + 'g-ir-scanner', + ] +else + ev_scanner_command = [ + python, + girscanner, + ] +endif + + # Generate everything.h and everything.c: test_everything_files = custom_target('everything', output: ['everything.h', 'everything.c'], depends: typelibs, command: [ - python, - girscanner, + ev_scanner_command, '--generate-typelib-tests=Everything,@OUTPUT0@,@OUTPUT1@', '--function-decoration=_GI_TEST_EXTERN', '--include-first-in-src=config.h', @@ -101,13 +112,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Everything-1.0.gir', depends: [everything_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--warn-all', '--warn-error', '--namespace=Everything', @@ -125,13 +130,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'GIMarshallingTests-1.0.gir', depends: [gimarshallingtests_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--warn-all', '--warn-error', '--namespace=GIMarshallingTests', @@ -145,15 +144,25 @@ if glib_dep.type_name() == 'pkgconfig' ] ) +if get_option('enable-gi-cross-wrapper') != '' + gircompiler_command = [get_option('enable-gi-cross-wrapper'), gircompiler.full_path(), '-o', '@OUTPUT@', '@INPUT@', + '--includedir', meson.current_build_dir(), + '--includedir', meson.current_source_dir(), + ] +else + gircompiler_command = [gircompiler, '-o', '@OUTPUT@', '@INPUT@', + '--includedir', meson.current_build_dir(), + '--includedir', join_paths(meson.build_root(), 'gir'), + ] +endif + + foreach gir : test_gir_files test_typelibs += custom_target('generate-typelib-@0@'.format(gir).underscorify(), input: gir, output: '@BASENAME@.typelib', depends: [gobject_gir, ], - command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@', - '--includedir', join_paths(meson.build_root(), 'gir'), - '--includedir', meson.current_build_dir() - ], + command: gircompiler_command, ) endforeach diff --git tests/offsets/meson.build tests/offsets/meson.build index ca1471f..3a86fb3 100644 --- a/tests/offsets/meson.build +++ b/tests/offsets/meson.build @@ -18,13 +18,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Offsets-1.0.gir', depends: [test_offsets_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--warn-all', '--warn-error', '--namespace=Offsets', @@ -43,10 +37,7 @@ if glib_dep.type_name() == 'pkgconfig' input: test_offsets_gir, output: '@BASENAME@.typelib', depends: [gobject_gir, ], - command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@', - '--includedir', join_paths(meson.build_root(), 'gir'), - '--includedir', meson.current_build_dir() - ], + command: gircompiler_command, ) gitestoffsets_exe = executable('gitestoffsets', diff --git tests/scanner/meson.build tests/scanner/meson.build index 4210488..b311cfd 100644 --- a/tests/scanner/meson.build +++ b/tests/scanner/meson.build @@ -99,25 +99,13 @@ regress_lib = shared_library('regress-1.0', python_path = run_command(python, ['-c', 'import sys; sys.stdout.write(sys.executable)']).stdout() -gircompiler_command = [ - gircompiler, '-o', '@OUTPUT@', '@INPUT@', - '--includedir', join_paths(meson.build_root(), 'gir'), - '--includedir', meson.current_build_dir(), -] - if glib_dep.type_name() == 'pkgconfig' typedef_gir = custom_target('gir-typedef', input: ['typedefs.c', 'typedefs.h'], output: 'Typedefs-1.0.gir', depends: [typedef_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--warn-all', '--warn-error', '--namespace=Typedefs', @@ -149,13 +137,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Bar-1.0.gir', depends: [barapp_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--warn-all', '--warn-error', '--namespace=Bar', @@ -186,13 +168,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'SLetter-1.0.gir', depends: [sletter_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--warn-all', '--warn-error', '--namespace=SLetter', @@ -222,13 +198,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'WarnLib-1.0.gir', depends: [warnlib_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--namespace=WarnLib', '--nsversion=1.0', '--include=Gio-2.0', @@ -256,13 +226,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Utility-1.0.gir', depends: [utility_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--warn-all', '--warn-error', '--namespace=Utility', @@ -292,13 +256,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'GtkFrob-1.0.gir', depends: [gtkfrob_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--warn-all', '--warn-error', '--namespace=GtkFrob', @@ -329,13 +287,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'GetType-1.0.gir', depends: [gettype_lib] + typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--namespace=GetType', '--nsversion=1.0', '--identifier-prefix=GetType', @@ -365,10 +317,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Symbolfilter-1.0.gir', depends: typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', + scanner_command, '--reparse-validate', '--namespace=Symbolfilter', '--nsversion=1.0', @@ -391,12 +340,8 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Identfilter-1.0.gir', depends: typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', + scanner_command, '--accept-unprefixed', - '--reparse-validate', '--namespace=Identfilter', '--nsversion=1.0', '--header-only', @@ -418,13 +363,9 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Headeronly-1.0.gir', depends: typelibs, command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', + scanner_command, '--warn-all', '--warn-error', - '--reparse-validate', '--namespace=Headeronly', '--nsversion=1.0', '--header-only', @@ -452,13 +393,7 @@ if glib_dep.type_name() == 'pkgconfig' output: 'Regress-1.0.gir', depends: [regress_lib] + typelibs + [utility_gir], command: [ - python, - girscanner, - '--output=@OUTPUT@', - '--no-libtool', - '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + scanner_command, '--add-include-path', meson.current_build_dir(), '--namespace=Regress', '--nsversion=1.0', @@ -484,7 +419,10 @@ if glib_dep.type_name() == 'pkgconfig' 'generate-typelib-regress', input: regress_gir, output: '@BASENAME@.typelib', - command: gircompiler_command, + command: [ + gircompiler_command, + '--includedir', meson.current_build_dir(), + ] ) test_typelibs += regress_typelib endif