gnome: Add header kwarg to generate_gir()

This is a commonly used flag so lets make it more obvious.
pull/2414/head
Patrick Griffis 7 years ago committed by Jussi Pakkanen
parent a9258923fa
commit 893d101fff
  1. 4
      docs/markdown/Gnome-module.md
  2. 8
      mesonbuild/modules/gnome.py
  3. 1
      test cases/frameworks/7 gnome/gir/dep1/meson.build

@ -81,6 +81,10 @@ tool so see its documentation for more information.
* `includes`: list of gir names to be included, can also be a GirTarget
* `header`: *(Added 0.43.0)* name of main c header to include for the library, e.g. `glib.h`
* `dependencies`: deps to use during introspection scanning
* `include_directories`: extra include paths to look for gir files
* `install`: if true, install the generated files

@ -394,7 +394,7 @@ class GnomeModule(ExtensionModule):
@permittedKwargs({'sources', 'nsversion', 'namespace', 'symbol_prefix', 'identifier_prefix',
'export_packages', 'includes', 'dependencies', 'link_with', 'include_directories',
'install', 'install_dir_gir', 'install_dir_typelib', 'extra_args',
'packages', 'build_by_default'})
'packages', 'header', 'build_by_default'})
def generate_gir(self, state, args, kwargs):
if len(args) != 1:
raise MesonException('Gir takes one argument')
@ -429,6 +429,12 @@ class GnomeModule(ExtensionModule):
scan_command += ['--no-libtool', '--namespace=' + ns, '--nsversion=' + nsversion, '--warn-all',
'--output', '@OUTPUT@']
header = kwargs.pop('header', None)
if header:
if not isinstance(header, str):
raise MesonException('header must be a string')
scan_command += ['--c-include=' + header]
extra_args = mesonlib.stringlistify(kwargs.pop('extra_args', []))
scan_command += extra_args
scan_command += ['-I' + srcdir,

@ -19,6 +19,7 @@ dep1gir = gnome.generate_gir(
namespace : 'MesonDep1',
symbol_prefix : 'meson',
identifier_prefix : 'Meson',
header: 'dep1.h',
includes : ['GObject-2.0', 'MesonDep2-1.0'],
dependencies : [dep2_dep],
install : true

Loading…
Cancel
Save