diff options
author | Iñigo MartÃnez <inigomartinez@gmail.com> | 2018-01-16 10:41:47 +0100 |
---|---|---|
committer | Iñigo MartÃnez <inigomartinez@gmail.com> | 2018-04-11 17:22:12 +0200 |
commit | 351b59f03adcdbf5a4efbaba2446c0e40a456ef1 (patch) | |
tree | 4198249f98bf835f655a80fb254fe45f9f29c9d1 /mesonbuild | |
parent | e103675a3995f799d65a90595c62ad7f0ed4a088 (diff) | |
download | meson-351b59f03adcdbf5a4efbaba2446c0e40a456ef1.zip meson-351b59f03adcdbf5a4efbaba2446c0e40a456ef1.tar.gz meson-351b59f03adcdbf5a4efbaba2446c0e40a456ef1.tar.bz2 |
gnome: Split header and code targets in gdbus_codegen()
The development version of `glib` (2.55.2) has acquired support for
generating gdbus header and source code files separately. This
allows dependencies to be more fine grained on those targets
depending only on the header.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/modules/gnome.py | 71 |
1 files changed, 54 insertions, 17 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 9c73667..3e34e34 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -869,7 +869,7 @@ This will become a hard error in the future.''') return [] @permittedKwargs({'interface_prefix', 'namespace', 'object_manager', 'build_by_default', - 'annotations', 'docbook'}) + 'annotations', 'docbook', 'install', 'install_header'}) def gdbus_codegen(self, state, args, kwargs): if len(args) != 2: raise MesonException('Gdbus_codegen takes two arguments, name and xml file.') @@ -883,8 +883,7 @@ This will become a hard error in the future.''') cmd += ['--c-namespace', kwargs.pop('namespace')] if kwargs.get('object_manager', False): cmd += ['--c-generate-object-manager'] - if 'docbook' in kwargs: - cmd += ['--generate-docbook', kwargs.pop('docbook')] + build_by_default = kwargs.get('build_by_default', False) # Annotations are a bit ugly in that they are a list of lists of strings... annotations = kwargs.pop('annotations', []) @@ -898,21 +897,59 @@ This will become a hard error in the future.''') raise MesonException('Annotations must be made up of 3 strings for ELEMENT, KEY, and VALUE') cmd += ['--annotate'] + annotation - # https://git.gnome.org/browse/glib/commit/?id=ee09bb704fe9ccb24d92dd86696a0e6bb8f0dc1a - if mesonlib.version_compare(self._get_native_glib_version(state), '>= 2.51.3'): - cmd += ['--output-directory', '@OUTDIR@', '--generate-c-code', namebase, '@INPUT@'] + # https://git.gnome.org/browse/glib/commit/?id=e4d68c7b3e8b01ab1a4231bf6da21d045cb5a816 + if mesonlib.version_compare(self._get_native_glib_version(state), '>= 2.55.2'): + targets = [] + install_header = kwargs.get('install_header', False) + install_dir = kwargs.get('install_dir', state.environment.coredata.get_builtin_option('includedir')) + + output = namebase + '.c' + custom_kwargs = {'input': xml_file, + 'output': output, + 'command': cmd + ['--body', '--output', '@OUTDIR@/' + output, '@INPUT@'], + 'build_by_default': build_by_default + } + targets.append(build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs)) + + output = namebase + '.h' + custom_kwargs = {'input': xml_file, + 'output': output, + 'command': cmd + ['--header', '--output', '@OUTDIR@/' + output, '@INPUT@'], + 'build_by_default': build_by_default, + 'install': install_header, + 'install_dir': install_dir + } + targets.append(build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs)) + + if 'docbook' in kwargs: + docbook_cmd = cmd + ['--output-directory', '@OUTDIR@', '--generate-docbook', kwargs.pop('docbook'), '@INPUT@'] + + output = namebase + '-docbook' + custom_kwargs = {'input': xml_file, + 'output': output, + 'command': docbook_cmd, + 'build_by_default': build_by_default + } + targets.append(build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs)) else: - self._print_gdbus_warning() - cmd += ['--generate-c-code', '@OUTDIR@/' + namebase, '@INPUT@'] - outputs = [namebase + '.c', namebase + '.h'] - custom_kwargs = {'input': xml_file, - 'output': outputs, - 'command': cmd - } - if 'build_by_default' in kwargs: - custom_kwargs['build_by_default'] = kwargs['build_by_default'] - ct = build.CustomTarget(target_name, state.subdir, state.subproject, custom_kwargs) - return ModuleReturnValue(ct, [ct]) + if 'docbook' in kwargs: + cmd += ['--generate-docbook', kwargs.pop('docbook')] + + # https://git.gnome.org/browse/glib/commit/?id=ee09bb704fe9ccb24d92dd86696a0e6bb8f0dc1a + if mesonlib.version_compare(self._get_native_glib_version(state), '>= 2.51.3'): + cmd += ['--output-directory', '@OUTDIR@', '--generate-c-code', namebase, '@INPUT@'] + else: + self._print_gdbus_warning() + cmd += ['--generate-c-code', '@OUTDIR@/' + namebase, '@INPUT@'] + outputs = [namebase + '.c', namebase + '.h'] + custom_kwargs = {'input': xml_file, + 'output': outputs, + 'command': cmd, + 'build_by_default': build_by_default + } + ct = build.CustomTarget(target_name, state.subdir, state.subproject, custom_kwargs) + targets = [ct, ct, ct] + return ModuleReturnValue(targets, targets) @permittedKwargs({'sources', 'c_template', 'h_template', 'install_header', 'install_dir', 'comments', 'identifier_prefix', 'symbol_prefix', 'eprod', 'vprod', |