summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-12-20 20:20:35 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-01-06 20:10:46 +0000
commit623b191c10ad36a82e31b8af794b6e04ae18775f (patch)
treec9883fd0aa3c5b3dded893d0b0d9a29d9c80556a /mkspecs
parentac740d9d285a73e98c99495769782a0d5b934d7a (diff)
track plugins' qt dependencies
plugins may pull in additional qt modules which may require additional plugins in turn. Change-Id: I22264b39c1397666b2dc9079048ed1fc64aa84d9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/qt.prf148
-rw-r--r--mkspecs/features/qt_plugin.prf4
2 files changed, 88 insertions, 64 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 564f3d774d..626cf9c809 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -45,9 +45,93 @@ qaxserver {
QT += axserver
}
+!import_qpa_plugin {
+ warning("CONFIG-=import_qpa_plugin is deprecated. Use QTPLUGIN.platforms=- instead.")
+ QTPLUGIN.platforms = -
+} else: qpa_minimal_plugin {
+ warning("CONFIG+=qpa_minimal_plugin is deprecated. Use QTPLUGIN.platforms=qminimal instead.")
+ QTPLUGIN.platforms = qminimal
+}
+
!force_import_plugins:!contains(TEMPLATE, ".*app"):!if(contains(TEMPLATE, ".*lib"):dll): \
CONFIG -= import_plugins
+# qmake variables cannot contain dashes, so normalize the names first
+CLEAN_QT = $$replace(QT, -private$, _private)
+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")
+
+import_plugins:qtConfig(static) {
+ manualplugs = $$QTPLUGIN # User may specify plugins. Mostly legacy.
+ autoplugs = # Auto-added plugins.
+ # First round: explicitly specified modules.
+ plugin_deps = $$all_qt_module_deps
+ for(ever) {
+ # Automatically link the default plugins for the linked Qt modules.
+ for (qtmod, plugin_deps) {
+ for (ptype, QT.$${qtmod}.plugin_types) {
+ nptype = $$replace(ptype, [-/], _)
+ isEmpty(QTPLUGIN.$$nptype) {
+ for (plug, QT_PLUGINS) {
+ equals(QT_PLUGIN.$${plug}.TYPE, $$ptype) {
+ for (dep, QT_PLUGIN.$${plug}.EXTENDS) {
+ !contains(all_qt_module_deps, $$dep) {
+ plug =
+ break()
+ }
+ }
+ autoplugs += $$plug
+ }
+ }
+ } else {
+ plug = $$eval(QTPLUGIN.$$nptype)
+ !equals(plug, -): \
+ autoplugs += $$plug
+ }
+ }
+ }
+ QTPLUGIN = $$manualplugs $$autoplugs
+ QTPLUGIN = $$unique(QTPLUGIN)
+
+ # Obtain the plugins' Qt dependencies ...
+ plugin_deps =
+ for (plug, QTPLUGIN): \
+ plugin_deps += $$eval(QT_PLUGIN.$${plug}.DEPENDS)
+ plugin_deps = $$resolve_depends(plugin_deps, "QT.", ".depends" ".run_depends")
+ plugin_deps -= $$all_qt_module_deps
+ isEmpty(plugin_deps): \
+ break()
+ # ... and start over if any new Qt modules appeared,
+ # as these may want to load plugins in turn.
+ all_qt_module_deps += $$plugin_deps
+ }
+ extraplugs = $$manualplugs
+ manualplugs -= $$autoplugs
+ extraplugs -= $$manualplugs
+ !isEmpty(extraplugs): \
+ warning("Redundant entries in QTPLUGIN: $$extraplugs")
+
+ !isEmpty(QTPLUGIN) {
+ IMPORT_FILE_CONT = \
+ "// This file is autogenerated by qmake. It imports static plugin classes for" \
+ "// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables." \
+ "$${LITERAL_HASH}include <QtPlugin>"
+ for (plug, QTPLUGIN) {
+ plug_class = $$eval(QT_PLUGIN.$${plug}.CLASS_NAME)
+ !isEmpty(plug_class): \
+ IMPORT_FILE_CONT += "Q_IMPORT_PLUGIN($$plug_class)"
+ else: \
+ warning("Plugin class name could not be determined for plugin '$$plug'.")
+ }
+ IMPORT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_plugin_import.cpp
+ write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error()
+ GENERATED_SOURCES += $$IMPORT_CPP
+ QMAKE_DISTCLEAN += $$IMPORT_CPP
+ }
+}
+
# target variable, flag source variable
defineTest(qtProcessModuleFlags) {
for(flag, $$2) {
@@ -62,8 +146,6 @@ defineTest(qtProcessModuleFlags) {
unset(using_privates)
var_sfx =
for(ever) {
- # qmake variables cannot contain dashes, so normalize the names first
- CLEAN_QT$$var_sfx = $$replace(QT$$var_sfx, -private$, _private)
# Topological resolution of modules based on their QT.<module>.depends variable
FULL_QT$$var_sfx = $$resolve_depends(CLEAN_QT$$var_sfx, "QT.")
# Finally actually add the modules
@@ -167,9 +249,6 @@ for(ever) {
message("This is not a bug, but a result of using Qt internals. You have been warned!")
}
-qt_module_deps = $$CLEAN_QT $$CLEAN_QT_PRIVATE
-all_qt_module_deps = $$resolve_depends(qt_module_deps, "QT.", ".depends" ".run_depends")
-
!no_qt_rpath:!static:qtConfig(rpath):!qtConfig(static):\
contains(all_qt_module_deps, core) {
relative_qt_rpath:!isEmpty(QMAKE_REL_RPATH_BASE):contains(INSTALLS, target):\
@@ -243,66 +322,7 @@ contains(all_qt_module_deps, qml): \
QMAKE_DISTCLEAN += $$QML_IMPORT_CPP
}
}
-
-!import_qpa_plugin {
- warning("CONFIG-=import_qpa_plugin is deprecated. Use QTPLUGIN.platforms=- instead.")
- QTPLUGIN.platforms = -
-} else: qpa_minimal_plugin {
- warning("CONFIG+=qpa_minimal_plugin is deprecated. Use QTPLUGIN.platforms=qminimal instead.")
- QTPLUGIN.platforms = qminimal
-}
-
-import_plugins {
- autoplugs =
- for (qtmod, all_qt_module_deps) {
- for (ptype, QT.$${qtmod}.plugin_types) {
- nptype = $$replace(ptype, [-/], _)
- isEmpty(QTPLUGIN.$$nptype) {
- for (plug, QT_PLUGINS) {
- equals(QT_PLUGIN.$${plug}.TYPE, $$ptype) {
- for (dep, QT_PLUGIN.$${plug}.EXTENDS) {
- !contains(all_qt_module_deps, $$dep) {
- plug =
- break()
- }
- }
- autoplugs += $$plug
- }
- }
- } else {
- plug = $$eval(QTPLUGIN.$$nptype)
- !equals(plug, -): \
- autoplugs += $$plug
- }
- }
- }
- manualplugs = $$QTPLUGIN
- manualplugs -= $$autoplugs
- QTPLUGIN -= $$manualplugs
- !isEmpty(QTPLUGIN): \
- warning("Redundant entries in QTPLUGIN: $$QTPLUGIN")
- QTPLUGIN = $$manualplugs $$autoplugs
-}
-
qtConfig(static) {
- import_plugins:!isEmpty(QTPLUGIN) {
- IMPORT_FILE_CONT = \
- "// This file is autogenerated by qmake. It imports static plugin classes for" \
- "// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables." \
- "$${LITERAL_HASH}include <QtPlugin>"
- for(IMPORT_PLUG, $$list($$unique(QTPLUGIN))) {
- PLUG_CLASS = $$eval(QT_PLUGIN.$${IMPORT_PLUG}.CLASS_NAME)
- !isEmpty(PLUG_CLASS): \
- IMPORT_FILE_CONT += "Q_IMPORT_PLUGIN($$PLUG_CLASS)"
- else: \
- warning("Plugin class name could not be determined for $$IMPORT_PLUG plugin.")
- }
- IMPORT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_plugin_import.cpp
- write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error()
- GENERATED_SOURCES += $$IMPORT_CPP
- QMAKE_DISTCLEAN += $$IMPORT_CPP
- }
-
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.
diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
index 265b4ea8a2..80d9c87e05 100644
--- a/mkspecs/features/qt_plugin.prf
+++ b/mkspecs/features/qt_plugin.prf
@@ -44,9 +44,13 @@ CONFIG(static, static|shared)|prefix_build {
MODULE_FWD_PRI = $$mod_work_pfx/qt_plugin_$${MODULE}.pri
!build_pass {
+ qt_plugin_deps = $$QT $$QT_PRIVATE
+ qt_plugin_deps = s,-private$,_private,g
+
MODULE_PRI_CONT = \
"QT_PLUGIN.$${MODULE}.TYPE = $$PLUGIN_TYPE" \
"QT_PLUGIN.$${MODULE}.EXTENDS =$$join(PLUGIN_EXTENDS, " ", " ")" \
+ "QT_PLUGIN.$${MODULE}.DEPENDS = $$qt_plugin_deps" \
"QT_PLUGIN.$${MODULE}.CLASS_NAME = $$PLUGIN_CLASS_NAME" \
"QT_PLUGINS += $$MODULE"
write_file($$MODULE_PRI, MODULE_PRI_CONT)|error()