aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/windows.py
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-05-15 15:13:06 +0100
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-06-03 21:06:23 +0000
commit7a15214a69891411df6f55a74851d502ef0b24c5 (patch)
treebd4952ff75aec26f2b5f6d05543e7f5d46a0b546 /mesonbuild/modules/windows.py
parent7e08e958c0e3cdf7e6769027d8eeff5925b69d73 (diff)
downloadmeson-7a15214a69891411df6f55a74851d502ef0b24c5.zip
meson-7a15214a69891411df6f55a74851d502ef0b24c5.tar.gz
meson-7a15214a69891411df6f55a74851d502ef0b24c5.tar.bz2
Have the windows.resource_compiler() preprocesor write a depfile
When using binutils's windres, we can instruct it to invoke the preprocessor in such a way that it writes a depfile, so that dependencies on #included files are automatically tracked. Not implemented for MSVC tools, so skip testing it in that case.
Diffstat (limited to 'mesonbuild/modules/windows.py')
-rw-r--r--mesonbuild/modules/windows.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py
index adb73d7..c6c9a64 100644
--- a/mesonbuild/modules/windows.py
+++ b/mesonbuild/modules/windows.py
@@ -100,6 +100,11 @@ class WindowsModule(ExtensionModule):
# Path separators are not allowed in target names
name = name.replace('/', '_').replace('\\', '_')
+ # instruct binutils windres to generate a preprocessor depfile
+ if comp.id != 'msvc':
+ res_kwargs['depfile'] = res_kwargs['output'] + '.d'
+ res_kwargs['command'] += ['--preprocessor-arg=-MD', '--preprocessor-arg=-MQ@OUTPUT@', '--preprocessor-arg=-MF@DEPFILE@']
+
res_targets.append(build.CustomTarget('Windows resource for ' + name, state.subdir, state.subproject, res_kwargs))
add_target(args)