modules/qt: allow passing generated targets to compile_ui

pull/9012/head
Dylan Baker 3 years ago
parent 965fcf2883
commit ff573620b0
  1. 5
      docs/markdown/_include_qt_base.md
  2. 11
      mesonbuild/modules/qt.py

@ -21,8 +21,9 @@ It takes no positional arguments, and the following keyword arguments:
Compiles Qt's ui files (.ui) into header files.
It takes no positional arguments, and the following keyword arguments:
- `sources` (File | string)[]: A list of sources to be transpiled. Required,
must have at least one source
- `sources` (File | string | custom_target | custom_target index | generator_output)[]:
A list of sources to be transpiled. Required, must have at least one source
*New in 0.60.0*: support for custom_target, custom_target_index, and generator_output.
- `extra_args` string[]: Extra arguments to pass directly to `qt-uic`
- `method` string: The method to use to detect qt, see `dependency()` for more
information.

@ -52,7 +52,7 @@ if T.TYPE_CHECKING:
"""Keyword arguments for the Ui Compiler method."""
sources: T.Sequence[T.Union[FileOrString, build.CustomTarget]]
sources: T.Sequence[T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]]
extra_args: T.List[str]
method: str
@ -337,12 +337,19 @@ class QtBaseModule(ExtensionModule):
@noPosargs
@typed_kwargs(
'qt.compile_ui',
KwargInfo('sources', ContainerTypeInfo(list, (File, str), allow_empty=False), listify=True, required=True),
KwargInfo(
'sources',
ContainerTypeInfo(list, (File, str, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList), allow_empty=False),
listify=True,
required=True,
),
KwargInfo('extra_args', ContainerTypeInfo(list, str), listify=True, default=[]),
KwargInfo('method', str, default='auto')
)
def compile_ui(self, state: 'ModuleState', args: T.Tuple, kwargs: 'UICompilerKwArgs') -> ModuleReturnValue:
"""Compile UI resources into cpp headers."""
if any(isinstance(s, (build.CustomTarget, build.CustomTargetIndex, build.GeneratedList)) for s in kwargs['sources']):
FeatureNew.single_use('qt.compile_ui: custom_target or generator for "sources" keyword argument', '0.60.0', state.subproject)
out = self._compile_ui_impl(state, kwargs)
return ModuleReturnValue(out, [out])

Loading…
Cancel
Save