From f7eda0e822615ccdfe796c3a8db5a2bae954d72a Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 17 Jun 2021 10:05:04 -0700 Subject: modules/qt: allow string values for include_directories This should have been supported before, but wasn't. --- docs/markdown/_include_qt_base.md | 22 +++++++++++----------- mesonbuild/modules/qt.py | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/markdown/_include_qt_base.md b/docs/markdown/_include_qt_base.md index 4c50abc..aff9146 100644 --- a/docs/markdown/_include_qt_base.md +++ b/docs/markdown/_include_qt_base.md @@ -41,7 +41,7 @@ It takes no positional arguments, and the following keyword arguments: - `extra_args` string[]: Extra arguments to pass directly to `qt-moc` - `method` string: The method to use to detect qt, see `dependency()` for more information. - - `include_directories` IncludeDirectory[]: A list of `include_directory()` + - `include_directories` (string | IncludeDirectory)[]: A list of `include_directory()` objects used when transpiling the .moc files ## preprocess @@ -62,16 +62,16 @@ sources += qt.preprocess(qresources : ['resources']) ``` This method takes the following keyword arguments: - - `qresources`: a list of strings, Files, Custom Targets, or Build Targets to pass the `rcc` compiler - - `ui_files`: a list of strings, Files, Custom Targets, or Build Targets to pass the `uic` compiler - - `moc_sources`: a list of strings, Files, Custom Targets, or Build Targets to pass the `moc` compiler the - - `moc_headers`: a list of strings, Files, Custom Targets, or Build Targets to pass the `moc` compiler. These will be converted into .cpp files - - `include_directories`, the directories to add to header search path for `moc` (optional) - - `moc_extra_arguments`, any additional arguments to `moc` (optional). Available since v0.44.0. - - `uic_extra_arguments`, any additional arguments to `uic` (optional). Available since v0.49.0. - - `rcc_extra_arguments`, any additional arguments to `rcc` (optional). Available since v0.49.0. - - `dependencies`, dependency objects needed by moc. Available since v0.48.0. - - `sources`, a list of extra sources, which are added to the output unchaged. Deprecated in 0.59.0 + - `qresources` (string | File | CustomTarget | BuildTarget)[]: Passed to the RCC compiler + - `ui_files`: (string | File | CustomTarget | BuilduTarget)[]: Passed the `uic` compiler + - `moc_sources`: (string | File | CustomTarget | BuildTarget)[]: Passed the `moc` compiler the + - `moc_headers`: (string | File | CustomTarget | BuildTarget)[]: Passied the `moc` compiler. These will be converted into .cpp files + - `include_directories` (IncludeDirectories | string)[], the directories to add to header search path for `moc` + - `moc_extra_arguments` string[]: any additional arguments to `moc`. Since v0.44.0. + - `uic_extra_arguments` string[]: any additional arguments to `uic`. Since v0.49.0. + - `rcc_extra_arguments` string[]: any additional arguments to `rcc`. Since v0.49.0. + - `dependencies` Dependency[]: dependency objects needed by moc. Available since v0.48.0. + - `sources`: a list of extra sources, which are added to the output unchaged. Deprecated in 0.59.0. It returns an array of targets and sources to pass to a compilation target. diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index 7d752db..5165fb3 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -65,7 +65,7 @@ if T.TYPE_CHECKING: headers: T.List[mesonlib.FileOrString] extra_args: T.List[str] method: str - include_directories: T.List[IncludeDirsHolder] + include_directories: T.List[T.Union[str, IncludeDirsHolder]] dependencies: T.List[T.Union[DependencyHolder, ExternalLibraryHolder]] class PreprocessKwArgs(TypedDict): @@ -78,7 +78,7 @@ if T.TYPE_CHECKING: moc_extra_arguments: T.List[str] rcc_extra_arguments: T.List[str] uic_extra_arguments: T.List[str] - include_directories: T.List[IncludeDirsHolder] + include_directories: T.List[T.Union[str, IncludeDirsHolder]] dependencies: T.List[T.Union[DependencyHolder, ExternalLibraryHolder]] method: str @@ -362,7 +362,7 @@ class QtBaseModule(ExtensionModule): KwargInfo('headers', ContainerTypeInfo(list, (File, str)), listify=True, default=[]), KwargInfo('extra_args', ContainerTypeInfo(list, str), listify=True, default=[]), KwargInfo('method', str, default='auto'), - KwargInfo('include_directories', ContainerTypeInfo(list, IncludeDirsHolder), listify=True, default=[]), + KwargInfo('include_directories', ContainerTypeInfo(list, (IncludeDirsHolder, str)), listify=True, default=[]), KwargInfo('dependencies', ContainerTypeInfo(list, (DependencyHolder, ExternalLibraryHolder)), listify=True, default=[]), ) def compile_moc(self, state: 'ModuleState', args: T.Tuple, kwargs: 'MocCompilerKwArgs') -> ModuleReturnValue: @@ -408,7 +408,7 @@ class QtBaseModule(ExtensionModule): KwargInfo('rcc_extra_arguments', ContainerTypeInfo(list, str), listify=True, default=[], since='0.49.0'), KwargInfo('uic_extra_arguments', ContainerTypeInfo(list, str), listify=True, default=[], since='0.49.0'), KwargInfo('method', str, default='auto'), - KwargInfo('include_directories', ContainerTypeInfo(list, IncludeDirsHolder), listify=True, default=[]), + KwargInfo('include_directories', ContainerTypeInfo(list, (IncludeDirsHolder, str)), listify=True, default=[]), KwargInfo('dependencies', ContainerTypeInfo(list, (DependencyHolder, ExternalLibraryHolder)), listify=True, default=[]), ) def preprocess(self, state: 'ModuleState', args: T.List[T.Union[str, File]], kwargs: 'PreprocessKwArgs') -> ModuleReturnValue: -- cgit v1.1