diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-11-13 23:05:47 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-11-13 23:28:59 -0500 |
commit | 0bc0905210c500f3d9c4d1de7cea882133416d34 (patch) | |
tree | 07fd7dff7c5ce8045547468c0a87d662df54a1a7 /mesonbuild/modules/qt.py | |
parent | 39ceb677744e1f959a0db6406d51a26d78f0ab68 (diff) | |
download | meson-0bc0905210c500f3d9c4d1de7cea882133416d34.zip meson-0bc0905210c500f3d9c4d1de7cea882133416d34.tar.gz meson-0bc0905210c500f3d9c4d1de7cea882133416d34.tar.bz2 |
qt module: add depfile support to moc as well
We currently enable this only for rcc (where this really really matters)
but it can often matter for moc as well, and is just generally more
correct.
Really, this should have been added in #7451 too, but I neglected it
since the module warned about inaccurate dependencies only for rcc...
Diffstat (limited to 'mesonbuild/modules/qt.py')
-rw-r--r-- | mesonbuild/modules/qt.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index 2696562..e548a0d 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -98,6 +98,7 @@ if T.TYPE_CHECKING: class QtBaseModule(ExtensionModule): _tools_detected = False _rcc_supports_depfiles = False + _moc_supports_depfiles = False def __init__(self, interpreter: 'Interpreter', qt_version: int = 5): ExtensionModule.__init__(self, interpreter) @@ -170,6 +171,10 @@ class QtBaseModule(ExtensionModule): # Get all tools and then make sure that they are the right version self.compilers_detect(state, qt) if version_compare(qt.version, '>=5.14.0'): + self._moc_supports_depfiles = True + else: + mlog.warning('moc dependencies will not work properly until you move to Qt >= 5.15', fatal=False) + 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:', @@ -434,15 +439,20 @@ class QtBaseModule(ExtensionModule): output: T.List[build.GeneratedList] = [] - arguments = kwargs['extra_args'] + inc + compile_args + ['@INPUT@', '-o', '@OUTPUT@'] + # depfile arguments (defaults to <output-name>.d) + DEPFILE_ARGS: T.List[str] = ['--output-dep-file'] if self._moc_supports_depfiles else [] + + arguments = kwargs['extra_args'] + DEPFILE_ARGS + inc + compile_args + ['@INPUT@', '-o', '@OUTPUT@'] if kwargs['headers']: moc_gen = build.Generator( self.tools['moc'], arguments, ['moc_@BASENAME@.cpp'], + depfile='moc_@BASENAME@.cpp.d', name=f'Qt{self.qt_version} moc header') output.append(moc_gen.process_files(kwargs['headers'], state)) if kwargs['sources']: moc_gen = build.Generator( self.tools['moc'], arguments, ['@BASENAME@.moc'], + depfile='@BASENAME.moc.d@', name=f'Qt{self.qt_version} moc source') output.append(moc_gen.process_files(kwargs['sources'], state)) |