aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/windows.py
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-08-14 20:13:33 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2018-08-16 20:34:44 +0100
commitc2f3785383f3083de57930246e47d65d9bda77b9 (patch)
treea20a8398d45d952afbef0c5bc504a4e8b2c18390 /mesonbuild/modules/windows.py
parent2a3cd335fda59085868f1b390106f953990bde58 (diff)
downloadmeson-c2f3785383f3083de57930246e47d65d9bda77b9.zip
meson-c2f3785383f3083de57930246e47d65d9bda77b9.tar.gz
meson-c2f3785383f3083de57930246e47d65d9bda77b9.tar.bz2
Use unique output for windows.compile_resources()
Use a unique output filename for windows.compile_resources() even when input basename is not unique.
Diffstat (limited to 'mesonbuild/modules/windows.py')
-rw-r--r--mesonbuild/modules/windows.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py
index 19f3e2b..24bd750 100644
--- a/mesonbuild/modules/windows.py
+++ b/mesonbuild/modules/windows.py
@@ -88,35 +88,38 @@ class WindowsModule(ExtensionModule):
if hasattr(src, 'held_object'):
src = src.held_object
- res_kwargs = {
- 'output': '@BASENAME@.' + suffix,
- 'input': [src],
- 'command': [rescomp] + res_args,
- 'depend_files': wrc_depend_files,
- 'depends': wrc_depends,
- }
-
if isinstance(src, str):
- name = 'file {!r}'.format(os.path.join(state.subdir, src))
+ name_format = 'file {!r}'
+ name = format(os.path.join(state.subdir, src))
elif isinstance(src, mesonlib.File):
- name = 'file {!r}'.format(src.relative_name())
+ name_format = 'file {!r}'
+ name = format(src.relative_name())
elif isinstance(src, build.CustomTarget):
if len(src.get_outputs()) > 1:
raise MesonException('windows.compile_resources does not accept custom targets with more than 1 output.')
- name = 'target {!r}'.format(src.get_id())
+ name_format = 'target {!r}'
+ name = format(src.get_id())
else:
raise MesonException('Unexpected source type {!r}. windows.compile_resources accepts only strings, files, custom targets, and lists thereof.'.format(src))
# Path separators are not allowed in target names
name = name.replace('/', '_').replace('\\', '_')
+ res_kwargs = {
+ 'output': name + '_@BASENAME@.' + suffix,
+ 'input': [src],
+ 'command': [rescomp] + res_args,
+ 'depend_files': wrc_depend_files,
+ 'depends': wrc_depends,
+ }
+
# 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))
+ res_targets.append(build.CustomTarget('Windows resource for ' + name_format.format(name), state.subdir, state.subproject, res_kwargs))
add_target(args)