summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-06-03 19:59:04 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-06-09 14:10:10 +0200
commit910804a4202d5be645a841a1e2ec38ad63c0598d (patch)
tree6eba4e02e3254e17ac3e2bcde59f89d85388a367 /util
parent16c15cb0b582c669a1b7266c11afeec3e2fd8500 (diff)
pro2cmake: Parse "optional plugin" from qmldir files
Task-number: QTBUG-84639 Change-Id: Iedfa2e53c686a7c7c855efc7b9deee097a15f4b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-xutil/cmake/pro2cmake.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 74905f38e8..441f8335e2 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -576,6 +576,7 @@ class QmlDir:
def __init__(self) -> None:
self.module = ""
self.plugin_name = ""
+ self.plugin_optional = False
self.plugin_path = ""
self.classname = ""
self.imports: List[str] = []
@@ -589,7 +590,7 @@ class QmlDir:
imports_line = " \n".join(self.imports)
string = f"""\
module: {self.module}
- plugin: {self.plugin_name} {self.plugin_path}
+ plugin: {self.plugin_optional} {self.plugin_name} {self.plugin_path}
classname: {self.classname}
type_infos:{type_infos_line}
imports:{imports_line}
@@ -664,6 +665,13 @@ class QmlDir:
self.plugin_name = entries[1]
if len(entries) > 2:
self.plugin_path = entries[2]
+ elif entries[0] == "optional":
+ if entries[1] != "plugin":
+ raise RuntimeError("Only plugins can be optional in qmldir files")
+ self.plugin_name = entries[2]
+ self.plugin_optional = True
+ if len(entries) > 3:
+ self.plugin_path = entries[3]
elif entries[0] == "classname":
self.classname = entries[1]
elif entries[0] == "typeinfo":
@@ -3427,6 +3435,8 @@ def write_example(
add_target += f" IMPORTS\n{qml_dir_imports_line}"
if qml_dir_dynamic_imports:
add_target += " IMPORTS ${module_dynamic_qml_imports}\n"
+ if qml_dir.plugin_optional:
+ add_target += " PLUGIN_OPTIONAL\n"
add_target += " INSTALL_LOCATION ${INSTALL_EXAMPLEDIR}\n)\n\n"
add_target += f"target_sources({binary_name} PRIVATE"
@@ -3720,6 +3730,8 @@ def write_qml_plugin(
extra_lines.append("IMPORTS\n " f"{qml_dir_imports_line}")
if qml_dir_dynamic_imports:
extra_lines.append("IMPORTS ${module_dynamic_qml_imports}")
+ if qml_dir.plugin_optional:
+ extra_lines.append("PLUGIN_OPTIONAL")
return qml_dir