Can have multiple Qt resource files in a single target. Closes #572.

pull/574/head
Jussi Pakkanen 9 years ago
parent 065dcee7f3
commit cc055387cd
  1. 14
      mesonbuild/modules/qt5.py
  2. 9
      test cases/frameworks/4 qt5/meson.build
  3. 1
      test cases/frameworks/4 qt5/stuff.qrc
  4. 6
      test cases/frameworks/4 qt5/stuff2.qrc

@ -125,14 +125,18 @@ class Qt5Module():
if len(rcc_files) > 0:
rcc_kwargs = {'output' : '@BASENAME@.cpp',
'arguments' : ['@INPUT@', '-o', '@OUTPUT@']}
rcc_gen = build.Generator([self.rcc], rcc_kwargs)
rcc_output = build.GeneratedList(rcc_gen)
qrc_deps = []
for i in rcc_files:
qrc_deps += self.parse_qrc(state, i)
rcc_output.extra_depends = qrc_deps
[rcc_output.add_file(os.path.join(state.subdir, a)) for a in rcc_files]
sources.append(rcc_output)
rcc_kwargs = {'input' : rcc_files,
'output' : rcc_files[0] + '.cpp',
'command' : [self.rcc, '-o', '@OUTPUT@', '@INPUT@'],
'depend_files' : qrc_deps,
}
res_target = build.CustomTarget(rcc_files[0].replace('.', '_'),
state.subdir,
rcc_kwargs)
sources.append(res_target)
if len(ui_files) > 0:
ui_kwargs = {'output' : 'ui_@BASENAME@.h',
'arguments' : ['-o', '@OUTPUT@', '@INPUT@']}

@ -3,10 +3,13 @@ project('qt5 build test', 'cpp')
qt5 = import('qt5')
qt5dep = dependency('qt5', modules : ['Core', 'Gui', 'Widgets'])
# The following has two resource files because having two in one target
# requires you to do it properly or you get linker symbol clashes.
prep = qt5.preprocess(
moc_headers : ['mainWindow.h'], # These need to be fed through the moc tool before use.
ui_files : 'mainWindow.ui', # XML files that need to be compiled with the uic tol.
qresources : 'stuff.qrc', # Resource file for rcc compiler.
moc_headers : ['mainWindow.h'], # These need to be fed through the moc tool before use.
ui_files : 'mainWindow.ui', # XML files that need to be compiled with the uic tol.
qresources : ['stuff.qrc', 'stuff2.qrc'], # Resource file for rcc compiler.
)
q5exe = executable('qt5app',

@ -2,6 +2,5 @@
<RCC version="1.0">
<qresource>
<file>thing.png</file>
<file>thing2.png</file>
</qresource>
</RCC>

@ -0,0 +1,6 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<file>thing2.png</file>
</qresource>
</RCC>
Loading…
Cancel
Save