summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-12-20 20:20:39 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-01-19 21:48:10 +0000
commita4e4f8918183608a0449c5d60622e6b355b8dbbd (patch)
tree5588432e4147e3518439316e358abac0387b2f5d
parent6b070340a818089cb5cc2d01c155d1696c8e392b (diff)
fix up static linking of plugins somewhat
move the code before the linking of qt modules - dependency resolution would re-order them anyway (or static linking would fail). on the way, fix up the coding style and rename some variables. the code to de-duplicate/normalize QTPLUGIN is pulled ahead, which means that the automatic plugin importing wouldn't make a mess of it any more. but this is mostly legacy anyway. Change-Id: Id135470d027f5d84b7f30531425a65efa230f278 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--mkspecs/features/qt.prf39
1 files changed, 18 insertions, 21 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 626cf9c809..3ccbbe7061 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -63,6 +63,8 @@ CLEAN_QT_PRIVATE = $$replace(QT_PRIVATE, -private$, _private)
qt_module_deps = $$CLEAN_QT $$CLEAN_QT_PRIVATE
all_qt_module_deps = $$resolve_depends(qt_module_deps, "QT.", ".depends" ".run_depends")
+QTPLUGIN = $$unique($$list($$lower($$QTPLUGIN)))
+
import_plugins:qtConfig(static) {
manualplugs = $$QTPLUGIN # User may specify plugins. Mostly legacy.
autoplugs = # Auto-added plugins.
@@ -132,6 +134,22 @@ import_plugins:qtConfig(static) {
}
}
+# Only link against plugins in static builds
+!isEmpty(QTPLUGIN):qtConfig(static) {
+ for (plug, QTPLUGIN) {
+ # Check if the plugin is known to Qt. We can use this to determine
+ # the plugin path. Unknown plugins must rely on the default link path.
+ plug_type = $$eval(QT_PLUGIN.$${plug}.TYPE)
+ !isEmpty(plug_type) {
+ plug_path = $$eval(QT_PLUGIN.$${plug}.PATH)
+ isEmpty(plug_path): \
+ plug_path = $$[QT_INSTALL_PLUGINS/get]
+ LIBS += -L$$plug_path/$$plug_type
+ }
+ LIBS += -l$${plug}$$qtPlatformTargetSuffix()
+ }
+}
+
# target variable, flag source variable
defineTest(qtProcessModuleFlags) {
for(flag, $$2) {
@@ -322,24 +340,3 @@ contains(all_qt_module_deps, qml): \
QMAKE_DISTCLEAN += $$QML_IMPORT_CPP
}
}
-qtConfig(static) {
- for (QTPLUG, $$list($$lower($$unique(QTPLUGIN)))) {
- # Check if the plugin is known to Qt. We can use this to determine
- # the plugin path. Unknown plugins must rely on the default link path.
- QT_PLUGINPATH = $$eval(QT_PLUGIN.$${QTPLUG}.TYPE)
-
- # Generate the plugin linker line
- QT_LINKAGE = -l$${QTPLUG}$$qtPlatformTargetSuffix()
-
- # Only link against plugin in static builds
- {
- !isEmpty(QT_PLUGINPATH) {
- plugpath = $$eval(QT_PLUGIN.$${QTPLUG}.PATH)
- isEmpty(plugpath): \
- plugpath = $$[QT_INSTALL_PLUGINS/get]
- LIBS *= -L$$plugpath/$$QT_PLUGINPATH
- }
- LIBS += $$QT_LINKAGE
- }
- }
-}