From f2dad788e782a9e7b5abb8a036370f6d8e29f7fc Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 25 Jun 2020 11:32:12 -0400 Subject: [PATCH] qt module: rcc supports depfiles now, given a recent enough version of Qt5 Add depfile support to generated targets for Qt >= 5.14. Move warning into the module init itself, to check if the version is too old before issuing. Also tweak the wording itself, to advise upgrading to a suitable version of Qt5 instead of advising to wait for a Qt bug to be fixed. --- mesonbuild/modules/qt.py | 11 ++++++++++- mesonbuild/modules/qt4.py | 3 --- mesonbuild/modules/qt5.py | 3 --- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index c2b1e0105..c810df655 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -15,7 +15,7 @@ import os from .. import mlog from .. import build -from ..mesonlib import MesonException, extract_as_list, File, unholder +from ..mesonlib import MesonException, extract_as_list, File, unholder, version_compare from ..dependencies import Dependency, Qt4Dependency, Qt5Dependency, NonExistingExternalProgram import xml.etree.ElementTree as ET from . import ModuleReturnValue, get_include_args, ExtensionModule @@ -30,6 +30,7 @@ _QT_DEPS_LUT = { class QtBaseModule(ExtensionModule): tools_detected = False + rcc_supports_depfiles = False def __init__(self, interpreter, qt_version=5): ExtensionModule.__init__(self, interpreter) @@ -46,6 +47,11 @@ class QtBaseModule(ExtensionModule): if qt.found(): # Get all tools and then make sure that they are the right version self.moc, self.uic, self.rcc, self.lrelease = qt.compilers_detect(self.interpreter) + if version_compare(qt.version, '>=5.14.0'): + self.rcc_supports_depfiles = True + else: + mlog.warning('rcc dependencies will not work properly until you move to Qt >= 5.14:', + mlog.bold('https://bugreports.qt.io/browse/QTBUG-45460'), fatal=False) else: suffix = '-qt{}'.format(self.qt_version) self.moc = NonExistingExternalProgram(name='moc' + suffix) @@ -156,6 +162,9 @@ class QtBaseModule(ExtensionModule): 'output': name + '.cpp', 'command': [self.rcc, '-name', '@BASENAME@', '-o', '@OUTPUT@', rcc_extra_arguments, '@INPUT@'], 'depend_files': qrc_deps} + if self.rcc_supports_depfiles: + rcc_kwargs['depfile'] = name + '.d' + rcc_kwargs['command'] += ['--depfile', '@DEPFILE@'] res_target = build.CustomTarget(name, state.subdir, state.subproject, rcc_kwargs) sources.append(res_target) if ui_files: diff --git a/mesonbuild/modules/qt4.py b/mesonbuild/modules/qt4.py index 81a1055eb..e85a1506f 100644 --- a/mesonbuild/modules/qt4.py +++ b/mesonbuild/modules/qt4.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .. import mlog from .qt import QtBaseModule @@ -23,6 +22,4 @@ class Qt4Module(QtBaseModule): def initialize(*args, **kwargs): - mlog.warning('rcc dependencies will not work properly until this upstream issue is fixed:', - mlog.bold('https://bugreports.qt.io/browse/QTBUG-45460'), fatal=False) return Qt4Module(*args, **kwargs) diff --git a/mesonbuild/modules/qt5.py b/mesonbuild/modules/qt5.py index 244a2176e..873c2dbeb 100644 --- a/mesonbuild/modules/qt5.py +++ b/mesonbuild/modules/qt5.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .. import mlog from .qt import QtBaseModule @@ -23,6 +22,4 @@ class Qt5Module(QtBaseModule): def initialize(*args, **kwargs): - mlog.warning('rcc dependencies will not work reliably until this upstream issue is fixed:', - mlog.bold('https://bugreports.qt.io/browse/QTBUG-45460'), fatal=False) return Qt5Module(*args, **kwargs)