aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/CMakeLists.txt
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2022-08-03 12:20:26 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-11-28 14:11:21 +0100
commit46429839fedd79244559069bb4235a8b0e7ebf0a (patch)
tree849874ae236f954dea3a5db294d60a4e87f526d5 /src/qml/CMakeLists.txt
parente11c1eda4fbd1910f9089dae60e4d22bfe3bb595 (diff)
QtQml: Restructure the module
Create a new module QtQml.Base which contains the actual QtQml types and a new module QtQml that just imports QtQml.Base, WorkerScript and Models. This is so we don't have circular dependencies within QtQml anymore where QtQml imports QtQml.Models but Models can't depend on QtQml for type information. [ChangeLog][QtQml][Important Behavior Changes] If you import QtQml you now need to make sure that QtQml is actually in the import path. Usually this is the case, but by manipulating the import path you can hide QtQml. In previous versions of Qt you could then still import QtQml because its types are present in the QtQml library. However, it would ignore its dependencies: QtQml.Models and QtQml.WorkerScript. If you really want to import only the builtins, you can always "import QML". Fixes: QTBUG-105240 Change-Id: Icdcdcc926757a8e9e8d639301b5b6d110de59613 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/CMakeLists.txt')
-rw-r--r--src/qml/CMakeLists.txt33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt
index 24c18daef5..5781b03573 100644
--- a/src/qml/CMakeLists.txt
+++ b/src/qml/CMakeLists.txt
@@ -32,13 +32,12 @@ if(ANDROID)
endif()
qt_internal_add_qml_module(Qml
- URI "QtQml"
+ URI "QtQml.Base"
VERSION "${PROJECT_VERSION}"
DESIGNER_SUPPORTED
__QT_INTERNAL_SYSTEM_MODULE
PLUGIN_TARGET qmlplugin
CLASS_NAME QtQmlPlugin
- IMPORTS ${module_dynamic_qml_imports}
PLUGIN_TYPES qmltooling
SOURCES
../3rdparty/masm/assembler/ARM64Assembler.h
@@ -294,6 +293,7 @@ qt_internal_add_qml_module(Qml
qml/qqmllist.cpp qml/qqmllist.h qml/qqmllist_p.h
qml/qqmllistwrapper.cpp qml/qqmllistwrapper_p.h
qml/qqmlloggingcategory.cpp qml/qqmlloggingcategory_p.h
+ qml/qqmlmetamoduleregistration.cpp
qml/qqmlmetaobject.cpp qml/qqmlmetaobject_p.h
qml/qqmlmetatype.cpp qml/qqmlmetatype_p.h
qml/qqmlmetatypedata.cpp qml/qqmlmetatypedata_p.h
@@ -419,6 +419,35 @@ qt_internal_add_qml_module(Qml
GENERATE_PRIVATE_CPP_EXPORTS
)
+qt_internal_add_qml_module(QmlMeta
+ URI "QtQml"
+ VERSION "${PROJECT_VERSION}"
+ DESIGNER_SUPPORTED
+ CLASS_NAME QtQmlMetaPlugin
+ PLUGIN_TARGET QmlMeta
+
+ # Prevent type registration
+ NO_GENERATE_QMLTYPES
+
+ PAST_MAJOR_VERSIONS 2
+ IMPORTS
+ QtQml.Base/auto
+ ${module_dynamic_qml_imports}
+)
+
+# Add the QtQml qmldir to libQtQml, too.
+# Since we also provide the (bare bones) type registration in libQtQml,
+# this makes the complete module reside in libQtQml. There is no need to
+# load the QmlMeta plugin, then.
+# Se still provide the plugin so that static linking works.
+get_target_property(qtqml_out_dir QmlMeta QT_QML_MODULE_OUTPUT_DIRECTORY)
+qt_internal_add_resource(Qml "qmlMetaQmldir"
+ PREFIX
+ "/qt-project.org/imports/QtQml"
+ FILES
+ ${qtqml_out_dir}/qmldir
+)
+
# Linking to the static qml plugin should also automatically link to the worker script
# static plugin otherwise you get errors like
# module "QtQml.WorkerScript" plugin "workerscriptplugin" not found