|
|
|
@ -16,7 +16,7 @@ import os |
|
|
|
|
from .. import mlog |
|
|
|
|
from .. import build |
|
|
|
|
from ..mesonlib import MesonException, Popen_safe, extract_as_list, File |
|
|
|
|
from ..dependencies import Qt4Dependency, Qt5Dependency |
|
|
|
|
from ..dependencies import Dependency, Qt4Dependency, Qt5Dependency |
|
|
|
|
import xml.etree.ElementTree as ET |
|
|
|
|
from . import ModuleReturnValue, get_include_args |
|
|
|
|
from ..interpreterbase import permittedKwargs, FeatureNewKwargs |
|
|
|
@ -117,10 +117,10 @@ class QtBaseModule: |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
@FeatureNewKwargs('qt.preprocess', '0.44.0', ['moc_extra_arguments']) |
|
|
|
|
@permittedKwargs({'moc_headers', 'moc_sources', 'moc_extra_arguments', 'include_directories', 'ui_files', 'qresources', 'method'}) |
|
|
|
|
@permittedKwargs({'moc_headers', 'moc_sources', 'moc_extra_arguments', 'include_directories', 'dependencies', 'ui_files', 'qresources', 'method'}) |
|
|
|
|
def preprocess(self, state, args, kwargs): |
|
|
|
|
rcc_files, ui_files, moc_headers, moc_sources, moc_extra_arguments, sources, include_directories \ |
|
|
|
|
= extract_as_list(kwargs, 'qresources', 'ui_files', 'moc_headers', 'moc_sources', 'moc_extra_arguments', 'sources', 'include_directories', pop = True) |
|
|
|
|
rcc_files, ui_files, moc_headers, moc_sources, moc_extra_arguments, sources, include_directories, dependencies \ |
|
|
|
|
= extract_as_list(kwargs, 'qresources', 'ui_files', 'moc_headers', 'moc_sources', 'moc_extra_arguments', 'sources', 'include_directories', 'dependencies', pop = True) |
|
|
|
|
sources += args[1:] |
|
|
|
|
method = kwargs.get('method', 'auto') |
|
|
|
|
self._detect_tools(state.environment, method) |
|
|
|
@ -166,15 +166,28 @@ class QtBaseModule: |
|
|
|
|
ui_output = ui_gen.process_files('Qt{} ui'.format(self.qt_version), ui_files, state) |
|
|
|
|
sources.append(ui_output) |
|
|
|
|
inc = get_include_args(include_dirs=include_directories) |
|
|
|
|
compile_args = [] |
|
|
|
|
for dep in dependencies: |
|
|
|
|
if hasattr(dep, 'held_object'): |
|
|
|
|
dep = dep.held_object |
|
|
|
|
if isinstance(dep, Dependency): |
|
|
|
|
for arg in dep.get_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 len(moc_headers) > 0: |
|
|
|
|
arguments = moc_extra_arguments + inc + ['@INPUT@', '-o', '@OUTPUT@'] |
|
|
|
|
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('Qt{} moc header'.format(self.qt_version), moc_headers, state) |
|
|
|
|
sources.append(moc_output) |
|
|
|
|
if len(moc_sources) > 0: |
|
|
|
|
arguments = moc_extra_arguments + inc + ['@INPUT@', '-o', '@OUTPUT@'] |
|
|
|
|
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) |
|
|
|
|