automatically link plugins belonging to qt modules when building static apps
the plugins already declare which modules they belong to. additionally, we allow plugins to declare which modules they "extend" - e.g., while the Quick accessibility plugin belongs to Gui's 'accessiblity' type, it makes no sense to link it unless Quick is actually linked. finally, it is possible to manually override the plugins which are linked for a particular type, by setting QTPLUGIN.<type> (to '-' if no plugins of this type should be linked at all). Task-number: QTBUG-35195 Change-Id: I8273d167a046eb3f3c1c584dc6e3798212a2fa31 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
4e0c9fbb8f
commit
4255ba40ab
@ -73,10 +73,11 @@ wince*:static:gui {
|
||||
QTLIB += qmenu_wce.res
|
||||
}
|
||||
|
||||
# static builds: link qml import plugins into the app.
|
||||
qt_module_deps = $$QT $$QT_PRIVATE
|
||||
qt_module_deps = $$replace(qt_module_deps, -private$, _private)
|
||||
qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
|
||||
|
||||
# static builds: link qml import plugins into the app.
|
||||
contains(qt_module_deps, qml): \
|
||||
contains(QT_CONFIG, static):contains(TEMPLATE, .*app):!host_build:!no_import_scan {
|
||||
# run qmlimportscanner
|
||||
@ -162,6 +163,37 @@ contains(qt_module_deps, qml): \
|
||||
}
|
||||
}
|
||||
|
||||
contains(TEMPLATE, .*app) {
|
||||
autoplugs =
|
||||
for (qtmod, qt_module_deps) {
|
||||
for (ptype, QT.$${qtmod}.plugin_types) {
|
||||
isEmpty(QTPLUGIN.$$ptype) {
|
||||
for (plug, QT_PLUGINS) {
|
||||
equals(QT_PLUGIN.$${plug}.TYPE, $$ptype) {
|
||||
for (dep, QT_PLUGIN.$${plug}.EXTENDS) {
|
||||
!contains(qt_module_deps, $$dep) {
|
||||
plug =
|
||||
break()
|
||||
}
|
||||
}
|
||||
autoplugs += $$plug
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plug = $$eval(QTPLUGIN.$$ptype)
|
||||
!equals(plug, -): \
|
||||
autoplugs += $$plug
|
||||
}
|
||||
}
|
||||
}
|
||||
manualplugs = $$QTPLUGIN
|
||||
manualplugs -= $$autoplugs
|
||||
QTPLUGIN -= $$manualplugs
|
||||
!isEmpty(QTPLUGIN): \
|
||||
warning("Redundant entries in QTPLUGIN: $$QTPLUGIN")
|
||||
QTPLUGIN = $$manualplugs $$autoplugs
|
||||
}
|
||||
|
||||
QT_PLUGIN_VERIFY = DEPLOYMENT_PLUGIN
|
||||
contains(QT_CONFIG, static) {
|
||||
QT_PLUGIN_VERIFY += QTPLUGIN
|
||||
|
@ -70,6 +70,10 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
|
||||
module_config = "QT.$${MODULE_ID}.CONFIG = $$MODULE_CONFIG"
|
||||
else: \
|
||||
module_config =
|
||||
!isEmpty(MODULE_PLUGIN_TYPES): \
|
||||
module_plugtypes = "QT.$${MODULE_ID}.plugin_types = $$replace(MODULE_PLUGIN_TYPES, /.*$, )"
|
||||
else: \
|
||||
module_plugtypes =
|
||||
!no_module_headers:!minimal_syncqt {
|
||||
MODULE_INCLUDES = \$\$QT_MODULE_INCLUDE_BASE \$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME
|
||||
MODULE_PRIVATE_INCLUDES = \$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME/$$VERSION \
|
||||
@ -100,7 +104,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
|
||||
"QT.$${MODULE_ID}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \
|
||||
"QT.$${MODULE_ID}.imports = \$\$QT_MODULE_IMPORT_BASE" \
|
||||
"QT.$${MODULE_ID}.qml = \$\$QT_MODULE_QML_BASE" \
|
||||
$$join(MODULE_PLUGIN_TYPES, " ", "QT.$${MODULE_ID}.plugin_types = ")
|
||||
$$module_plugtypes
|
||||
MODULE_PRI_CONT += \
|
||||
"QT.$${MODULE_ID}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
|
||||
$$module_rundep \
|
||||
|
@ -32,7 +32,9 @@ CONFIG(static, static|shared) {
|
||||
!build_pass {
|
||||
MODULE_PRI_CONT = \
|
||||
"QT_PLUGIN.$${MODULE}.TYPE = $$PLUGIN_TYPE" \
|
||||
"QT_PLUGIN.$${MODULE}.CLASS_NAME = $$PLUGIN_CLASS_NAME"
|
||||
"QT_PLUGIN.$${MODULE}.EXTENDS = $$PLUGIN_EXTENDS" \
|
||||
"QT_PLUGIN.$${MODULE}.CLASS_NAME = $$PLUGIN_CLASS_NAME" \
|
||||
"QT_PLUGINS += $$MODULE"
|
||||
|
||||
write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.")
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
TARGET = qtaccessiblewidgets
|
||||
|
||||
PLUGIN_TYPE = accessible
|
||||
PLUGIN_EXTENDS = widgets
|
||||
PLUGIN_CLASS_NAME = AccessibleFactory
|
||||
load(qt_plugin)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user