From c0f59399e43bb83de4cf78e80034326ef381d9ac Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 4 Jun 2018 13:45:13 +0100 Subject: [PATCH] Add a depends: keyword to windows.compile_resources() Expose depends: from the custom_target this creates. --- docs/markdown/Windows-module.md | 2 ++ .../snippets/windows-resources-dependencies.md | 2 +- mesonbuild/modules/windows.py | 10 ++++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/markdown/Windows-module.md b/docs/markdown/Windows-module.md index 8098c1157..39f1ba6d8 100644 --- a/docs/markdown/Windows-module.md +++ b/docs/markdown/Windows-module.md @@ -16,6 +16,8 @@ has the following keyword argument. - `depend_files` lists resource files that the resource script depends on (e.g. bitmap, cursor, font, html, icon, message table, binary data or manifest files referenced by the resource script) (*since 0.47.0*) +- `depends` lists target(s) that this target depends on, even though it does not + take them as an argument (e.g. as above, but generated) (*since 0.47.0*) - `include_directories` lists directories to be both searched by the resource compiler for referenced resource files, and added to the preprocessor include search path. diff --git a/docs/markdown/snippets/windows-resources-dependencies.md b/docs/markdown/snippets/windows-resources-dependencies.md index e30e18c4a..e06177845 100644 --- a/docs/markdown/snippets/windows-resources-dependencies.md +++ b/docs/markdown/snippets/windows-resources-dependencies.md @@ -1,7 +1,7 @@ ## Windows resource files dependencies The `compile_resources()` function of the `windows` module now takes -the `depend_files:` keyword. +the `depend_files:` and `depends:` keywords. When using binutils's `windres`, dependencies on files `#include`'d by the preprocessor are now automatically tracked. diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index 7dd87f245..8a1fade0f 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -30,13 +30,14 @@ class WindowsModule(ExtensionModule): return compilers[l] raise MesonException('Resource compilation requires a C or C++ compiler.') - @FeatureNewKwargs('windows.compile_resources', '0.47.0', ['depend_files']) - @permittedKwargs({'args', 'include_directories', 'depend_files'}) + @FeatureNewKwargs('windows.compile_resources', '0.47.0', ['depend_files', 'depends']) + @permittedKwargs({'args', 'include_directories', 'depend_files', 'depends'}) def compile_resources(self, state, args, kwargs): comp = self.detect_compiler(state.compilers) extra_args = mesonlib.stringlistify(kwargs.get('args', [])) - wrc_deps = extract_as_list(kwargs, 'depend_files', pop = True) + wrc_depend_files = extract_as_list(kwargs, 'depend_files', pop = True) + wrc_depends = extract_as_list(kwargs, 'depends', pop = True) inc_dirs = extract_as_list(kwargs, 'include_directories', pop = True) for incd in inc_dirs: if not isinstance(incd.held_object, (str, build.IncludeDirs)): @@ -85,7 +86,8 @@ class WindowsModule(ExtensionModule): 'output': '@BASENAME@.' + suffix, 'input': [src], 'command': [rescomp] + res_args, - 'depend_files': wrc_deps, + 'depend_files': wrc_depend_files, + 'depends': wrc_depends, } if isinstance(src, str):