aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/windows.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-08-21 00:56:10 +0300
committerGitHub <noreply@github.com>2018-08-21 00:56:10 +0300
commit19617f8661fbe012d8f01bb76b2b9f5e23cffe37 (patch)
tree9f2db5dbfc8640c219aab585bbc25f7894138fad /mesonbuild/modules/windows.py
parent6e00ab6236e9d65376ac8c603e1321a6a0af6b57 (diff)
parentc2f3785383f3083de57930246e47d65d9bda77b9 (diff)
downloadmeson-19617f8661fbe012d8f01bb76b2b9f5e23cffe37.zip
meson-19617f8661fbe012d8f01bb76b2b9f5e23cffe37.tar.gz
meson-19617f8661fbe012d8f01bb76b2b9f5e23cffe37.tar.bz2
Merge pull request #4036 from jon-turney/fix_issue_3999
Fix compiling multiple Windows resources using pathnames with non-unique basenames
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)