From 9a6db2eb2f1acf3111371516c56eae0e7a69de13 Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Sun, 20 Nov 2016 17:35:47 -0500 Subject: [PATCH] gnome.compile_resources(): Add export and install_header kwargs This defaults to not exporting resources as that is generally what you want but that does make this a breaking change. Along with that if you export your resources you would want to install the header. --- mesonbuild/modules/gnome.py | 16 +++++++++++++++- .../frameworks/7 gnome/installed_files.txt | 1 + .../frameworks/7 gnome/resources/meson.build | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 4f9db48a0..fedf95cbc 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -104,6 +104,10 @@ can not be used with the current version of glib-compiled-resources, due to if 'c_name' in kwargs: cmd += ['--c-name', kwargs.pop('c_name')] + export = kwargs.pop('export', False) + if not export: + cmd += ['--internal'] + cmd += ['--generate', '--target', '@OUTPUT@'] cmd += mesonlib.stringlistify(kwargs.pop('extra_args', [])) @@ -117,7 +121,13 @@ can not be used with the current version of glib-compiled-resources, due to name = args[0] + '_c' if kwargs.get('install', False) and not gresource: - raise MesonException('Only gresource files can be installed') + raise MesonException('The install kwarg only applies to gresource bundles, see install_header') + + install_header = kwargs.pop('install_header', False) + if install_header and gresource: + raise MesonException('The install_header kwarg does not apply to gresource bundles') + if install_header and not export: + raise MesonException('GResource header is installed yet export is not enabled') kwargs['input'] = args[1] kwargs['output'] = output @@ -142,6 +152,10 @@ can not be used with the current version of glib-compiled-resources, due to # The header doesn't actually care about the files yet it errors if missing 'depends': depends } + if install_header: + h_kwargs['install'] = install_header + h_kwargs['install_dir'] = kwargs.get('install_dir', + state.environment.coredata.get_builtin_option('includedir')) target_h = build.CustomTarget(args[0] + '_h', state.subdir, h_kwargs) return [target_c, target_h] diff --git a/test cases/frameworks/7 gnome/installed_files.txt b/test cases/frameworks/7 gnome/installed_files.txt index 2f18cb1b0..d0d51d51b 100644 --- a/test cases/frameworks/7 gnome/installed_files.txt +++ b/test cases/frameworks/7 gnome/installed_files.txt @@ -13,3 +13,4 @@ usr/share/gir-1.0/MesonDep1-1.0.gir usr/share/gir-1.0/MesonDep2-1.0.gir usr/share/glib-2.0/schemas/com.github.meson.gschema.xml usr/share/simple-resources.gresource +usr/include/simple-resources.h diff --git a/test cases/frameworks/7 gnome/resources/meson.build b/test cases/frameworks/7 gnome/resources/meson.build index bee99f027..2e7250134 100644 --- a/test cases/frameworks/7 gnome/resources/meson.build +++ b/test cases/frameworks/7 gnome/resources/meson.build @@ -3,6 +3,8 @@ simple_resources = gnome.compile_resources('simple-resources', 'simple.gresource.xml', + install_header : true, + export : true, source_dir : '../resources-data', c_name : 'simple_resources')