Merge pull request #3715 from jon-turney/duplicate-rsrc-script-name

Use a unique name for windows resource compilation custom target
pull/3208/merge
Jussi Pakkanen 7 years ago committed by GitHub
commit 8014a42f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      mesonbuild/modules/windows.py
  2. 1
      test cases/windows/16 resource scripts with duplicate filenames/a/meson.build
  3. 1
      test cases/windows/16 resource scripts with duplicate filenames/a/rsrc.rc
  4. 2
      test cases/windows/16 resource scripts with duplicate filenames/b/meson.build
  5. 1
      test cases/windows/16 resource scripts with duplicate filenames/b/rsrc.rc
  6. 2
      test cases/windows/16 resource scripts with duplicate filenames/c/meson.build
  7. 1
      test cases/windows/16 resource scripts with duplicate filenames/c/rsrc.rc
  8. 19
      test cases/windows/16 resource scripts with duplicate filenames/meson.build
  9. 1
      test cases/windows/16 resource scripts with duplicate filenames/rsrc.rc
  10. 23
      test cases/windows/16 resource scripts with duplicate filenames/verify.c

@ -88,8 +88,10 @@ class WindowsModule(ExtensionModule):
'depend_files': wrc_deps,
}
if isinstance(src, (str, mesonlib.File)):
name = 'file {!r}'.format(str(src))
if isinstance(src, str):
name = 'file {!r}'.format(os.path.join(state.subdir, src))
elif isinstance(src, mesonlib.File):
name = 'file {!r}'.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.')

@ -0,0 +1,2 @@
bf = files('rsrc.rc')
b = win.compile_resources(bf)

@ -0,0 +1,2 @@
cf = files('rsrc.rc')
c = win.compile_resources(cf)

@ -0,0 +1,19 @@
project('foobar', 'c')
win = import('windows')
subdir('a')
subdir('b')
subdir('c')
main = win.compile_resources('rsrc.rc')
testa = executable('testa', 'verify.c', a)
testb = executable('testb', 'verify.c', b)
testc = executable('testc', 'verify.c', c)
testmain = executable('testmain', 'verify.c', main)
test('a', testa, args: 'a')
test('b', testb, args: 'b')
test('c', testc, args: 'c')
test('main', testmain, args: 'main')

@ -0,0 +1,23 @@
#include <assert.h>
#include <windows.h>
int main(int arc, char *argv[])
{
// verify that the expected resource exists and has the expected contents
HRSRC hRsrc;
unsigned int size;
HGLOBAL hGlobal;
void* data;
hRsrc = FindResource(NULL, argv[1], RT_RCDATA);
assert(hRsrc);
size = SizeofResource(NULL, hRsrc);
hGlobal = LoadResource(NULL, hRsrc);
data = LockResource(hGlobal);
assert(size == strlen(argv[1]));
assert(memcmp(data, argv[1], size) == 0);
return 0;
}
Loading…
Cancel
Save