diff --git a/mesonbuild/modules/qt5.py b/mesonbuild/modules/qt5.py index f669d77e8..e12d5ea03 100644 --- a/mesonbuild/modules/qt5.py +++ b/mesonbuild/modules/qt5.py @@ -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@']} diff --git a/test cases/frameworks/4 qt5/meson.build b/test cases/frameworks/4 qt5/meson.build index cfea5ba78..56720719f 100644 --- a/test cases/frameworks/4 qt5/meson.build +++ b/test cases/frameworks/4 qt5/meson.build @@ -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', diff --git a/test cases/frameworks/4 qt5/stuff.qrc b/test cases/frameworks/4 qt5/stuff.qrc index 9152500a3..fdfb58eab 100644 --- a/test cases/frameworks/4 qt5/stuff.qrc +++ b/test cases/frameworks/4 qt5/stuff.qrc @@ -2,6 +2,5 @@ thing.png - thing2.png diff --git a/test cases/frameworks/4 qt5/stuff2.qrc b/test cases/frameworks/4 qt5/stuff2.qrc new file mode 100644 index 000000000..910e2fbae --- /dev/null +++ b/test cases/frameworks/4 qt5/stuff2.qrc @@ -0,0 +1,6 @@ + + + + thing2.png + +