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>
This commit is contained in:
parent
ac740d9d28
commit
623b191c10
@ -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.
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user