Merge pull request #4036 from jon-turney/fix_issue_3999

Fix compiling multiple Windows resources using pathnames with non-unique basenames
pull/4068/head
Jussi Pakkanen 7 years ago committed by GitHub
commit 19617f8661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      mesonbuild/modules/windows.py
  2. 5
      test cases/windows/15 resource scripts with duplicate filenames/exe3/meson.build
  3. 6
      test cases/windows/15 resource scripts with duplicate filenames/exe3/src_dll/main.c
  4. 11
      test cases/windows/15 resource scripts with duplicate filenames/exe3/src_dll/version.rc
  5. 3
      test cases/windows/15 resource scripts with duplicate filenames/exe3/src_exe/main.c
  6. 11
      test cases/windows/15 resource scripts with duplicate filenames/exe3/src_exe/version.rc
  7. 5
      test cases/windows/15 resource scripts with duplicate filenames/exe4/meson.build
  8. 6
      test cases/windows/15 resource scripts with duplicate filenames/exe4/src_dll/main.c
  9. 11
      test cases/windows/15 resource scripts with duplicate filenames/exe4/src_dll/version.rc
  10. 3
      test cases/windows/15 resource scripts with duplicate filenames/exe4/src_exe/main.c
  11. 11
      test cases/windows/15 resource scripts with duplicate filenames/exe4/src_exe/version.rc
  12. 2
      test cases/windows/15 resource scripts with duplicate filenames/meson.build

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

@ -0,0 +1,5 @@
dll_res = win.compile_resources('src_dll/version.rc')
shared_library('lib3', 'src_dll/main.c', dll_res)
exe_res = win.compile_resources('src_exe/version.rc')
executable('exe3', 'src_exe/main.c', exe_res)

@ -0,0 +1,6 @@
#include <windows.h>
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
return TRUE;
}

@ -0,0 +1,11 @@
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
END

@ -0,0 +1,11 @@
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
END

@ -0,0 +1,5 @@
dll_res = win.compile_resources(files('src_dll/version.rc'))
shared_library('lib4', 'src_dll/main.c', dll_res)
exe_res = win.compile_resources(files('src_exe/version.rc'))
executable('exe4', 'src_exe/main.c', exe_res)

@ -0,0 +1,6 @@
#include <windows.h>
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
return TRUE;
}

@ -0,0 +1,11 @@
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
END

@ -0,0 +1,11 @@
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
BEGIN
END

@ -5,6 +5,8 @@ win = import('windows')
subdir('a')
subdir('b')
subdir('c')
subdir('exe3')
subdir('exe4')
main = win.compile_resources('rsrc.rc')

Loading…
Cancel
Save