diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-04-02 22:17:40 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-09 20:53:06 +0200 |
commit | 4255ba40ab073afcf2a095b135883612859af4c2 (patch) | |
tree | c12a414ae62d92b37cc6b53068baf60b79a18a98 /mkspecs/features | |
parent | 4e0c9fbb8f1db2750455fddb9a9b88386c26903e (diff) |
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>
Diffstat (limited to 'mkspecs/features')
-rw-r--r-- | mkspecs/features/qt.prf | 34 | ||||
-rw-r--r-- | mkspecs/features/qt_module_pris.prf | 6 | ||||
-rw-r--r-- | mkspecs/features/qt_plugin.prf | 4 |
3 files changed, 41 insertions, 3 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index fb83e59e65..cf6d66d1a0 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -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 diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 900ade9b6e..f31bc38c75 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -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 \ diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index ba12b9c1cd..5efd55582d 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -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.") } |