From 4255ba40ab073afcf2a095b135883612859af4c2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 2 Apr 2014 22:17:40 +0200 Subject: 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. (to '-' if no plugins of this type should be linked at all). Task-number: QTBUG-35195 Change-Id: I8273d167a046eb3f3c1c584dc6e3798212a2fa31 Reviewed-by: Fawzi Mohamed Reviewed-by: Richard Moe Gustavsen Reviewed-by: Joerg Bornemann --- mkspecs/features/qt.prf | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'mkspecs/features/qt.prf') 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 -- cgit v1.2.3 From 06e4676871143acf99380dfe9331563d106d3c50 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 4 Apr 2014 16:49:26 +0200 Subject: make QTPLUGIN work in prefix builds for plugins outside qtbase this means creating forwarding pris also for plugins. unlike for qt modules, we don't actually populate the .PATH unless it we are making a prefix build (and thus expecting it to be outside the regular location). Change-Id: Id836821cddec8d5f53d0708ae001e8eaa13cc71b Reviewed-by: Joerg Bornemann --- mkspecs/features/qt.prf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mkspecs/features/qt.prf') diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index cf6d66d1a0..5968a8a4ff 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -241,7 +241,12 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) { # Only link against plugin in static builds isEqual(QT_CURRENT_VERIFY, QTPLUGIN): { - !isEmpty(QT_PLUGINPATH): LIBS *= -L$$[QT_INSTALL_PLUGINS/get]/$$QT_PLUGINPATH + !isEmpty(QT_PLUGINPATH) { + plugpath = $$eval(QT_PLUGIN.$${QTPLUG}.PATH) + isEmpty(plugpath): \ + plugpath = $$[QT_INSTALL_PLUGINS/get] + LIBS *= -L$$plugpath/$$QT_PLUGINPATH + } LIBS += $$QT_LINKAGE # if the plugin is linked statically there is no need to deploy it DEPLOYMENT_PLUGIN -= $$QT_CURRENT_VERIFY -- cgit v1.2.3