aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/qt.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-06-01 14:58:26 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-06-15 12:35:15 -0700
commit118f70fedef15c9b28cc4df01c0644596df4c42d (patch)
treec883440f863caea7a33cc034211068524efba05f /mesonbuild/modules/qt.py
parent2322804a4df9811ba75db01230b5df36efd20aee (diff)
downloadmeson-118f70fedef15c9b28cc4df01c0644596df4c42d.zip
meson-118f70fedef15c9b28cc4df01c0644596df4c42d.tar.gz
meson-118f70fedef15c9b28cc4df01c0644596df4c42d.tar.bz2
modules/qt: have pre-process dispatch to moc_compile
for ode sharing and simplicity
Diffstat (limited to 'mesonbuild/modules/qt.py')
-rw-r--r--mesonbuild/modules/qt.py41
1 files changed, 10 insertions, 31 deletions
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py
index 439f995..fa8b007 100644
--- a/mesonbuild/modules/qt.py
+++ b/mesonbuild/modules/qt.py
@@ -373,11 +373,6 @@ class QtBaseModule(ExtensionModule):
FeatureDeprecated.single_use('qt.preprocess positional sources', '0.59', state.subproject)
sources.extend(_sources)
method = kwargs.get('method', 'auto')
- self._detect_tools(state, method)
- err_msg = "{0} sources specified and couldn't find {1}, " \
- "please check your qt{2} installation"
- if (moc_headers or moc_sources) and not self.moc.found():
- raise MesonException(err_msg.format('MOC', f'moc-qt{self.qt_version}', self.qt_version))
if rcc_files:
# custom output name set? -> one output file, multiple otherwise
@@ -390,32 +385,16 @@ class QtBaseModule(ExtensionModule):
ui_kwargs: 'UICompilerKwArgs' = {'sources': ui_files, 'extra_args': uic_extra_arguments, 'method': method}
sources.extend(self.compile_ui(state, tuple(), ui_kwargs).return_value)
- inc = state.get_include_args(include_dirs=include_directories)
- compile_args = []
- for dep in unholder(dependencies):
- if isinstance(dep, Dependency):
- for arg in dep.get_all_compile_args():
- if arg.startswith('-I') or arg.startswith('-D'):
- compile_args.append(arg)
- else:
- raise MesonException('Argument is of an unacceptable type {!r}.\nMust be '
- 'either an external dependency (returned by find_library() or '
- 'dependency()) or an internal dependency (returned by '
- 'declare_dependency()).'.format(type(dep).__name__))
- if moc_headers:
- arguments = moc_extra_arguments + inc + compile_args + ['@INPUT@', '-o', '@OUTPUT@']
- moc_kwargs = {'output': 'moc_@BASENAME@.cpp',
- 'arguments': arguments}
- moc_gen = build.Generator([self.moc], moc_kwargs)
- moc_output = moc_gen.process_files(f'Qt{self.qt_version} moc header', moc_headers, state)
- sources.append(moc_output)
- if moc_sources:
- arguments = moc_extra_arguments + inc + compile_args + ['@INPUT@', '-o', '@OUTPUT@']
- moc_kwargs = {'output': '@BASENAME@.moc',
- 'arguments': arguments}
- moc_gen = build.Generator([self.moc], moc_kwargs)
- moc_output = moc_gen.process_files(f'Qt{self.qt_version} moc source', moc_sources, state)
- sources.append(moc_output)
+ if moc_headers or moc_sources:
+ moc_kwargs: 'MocCompilerKwArgs' = {
+ 'extra_args': moc_extra_arguments,
+ 'sources': moc_sources,
+ 'headers': moc_sources,
+ 'include_directories': include_directories,
+ 'dependencies': dependencies
+ }
+ sources.extend(self.compile_moc(state, tuple(), moc_kwargs).return_value)
+
return ModuleReturnValue(sources, sources)
@FeatureNew('qt.compile_translations', '0.44.0')