Add a depends: keyword to windows.compile_resources()

Expose depends: from the custom_target this creates.
pull/3752/head
Jon Turney 6 years ago committed by Nirbheek Chauhan
parent c9a89027ac
commit c0f59399e4
  1. 2
      docs/markdown/Windows-module.md
  2. 2
      docs/markdown/snippets/windows-resources-dependencies.md
  3. 10
      mesonbuild/modules/windows.py

@ -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.

@ -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.

@ -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):

Loading…
Cancel
Save