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 <joerg.bornemann@digia.com>
This commit is contained in:
Oswald Buddenhagen 2014-04-04 16:49:26 +02:00 committed by The Qt Project
parent 4255ba40ab
commit 06e4676871
2 changed files with 35 additions and 3 deletions

View File

@ -241,7 +241,12 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
# Only link against plugin in static builds # Only link against plugin in static builds
isEqual(QT_CURRENT_VERIFY, QTPLUGIN): { 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 LIBS += $$QT_LINKAGE
# if the plugin is linked statically there is no need to deploy it # if the plugin is linked statically there is no need to deploy it
DEPLOYMENT_PLUGIN -= $$QT_CURRENT_VERIFY DEPLOYMENT_PLUGIN -= $$QT_CURRENT_VERIFY

View File

@ -27,7 +27,13 @@ tool_plugin {
CONFIG(static, static|shared) { CONFIG(static, static|shared) {
isEmpty(MODULE): MODULE = $$basename(TARGET) isEmpty(MODULE): MODULE = $$basename(TARGET)
MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_plugin_$${MODULE}.pri mod_work_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
force_independent: \
mod_inst_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst
else: \
mod_inst_pfx = $$mod_work_pfx
MODULE_PRI = $$mod_inst_pfx/qt_plugin_$${MODULE}.pri
MODULE_FWD_PRI = $$mod_work_pfx/qt_plugin_$${MODULE}.pri
!build_pass { !build_pass {
MODULE_PRI_CONT = \ MODULE_PRI_CONT = \
@ -35,8 +41,29 @@ CONFIG(static, static|shared) {
"QT_PLUGIN.$${MODULE}.EXTENDS = $$PLUGIN_EXTENDS" \ "QT_PLUGIN.$${MODULE}.EXTENDS = $$PLUGIN_EXTENDS" \
"QT_PLUGIN.$${MODULE}.CLASS_NAME = $$PLUGIN_CLASS_NAME" \ "QT_PLUGIN.$${MODULE}.CLASS_NAME = $$PLUGIN_CLASS_NAME" \
"QT_PLUGINS += $$MODULE" "QT_PLUGINS += $$MODULE"
write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.") write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.")
MODULE_PRI_FILES = $$MODULE_PRI
force_independent {
# Create a forwarding module .pri file
MODULE_FWD_PRI_CONT = \
"QT_PLUGIN.$${MODULE}.PATH = $$MODULE_BASE_OUTDIR/plugins" \
"include($$MODULE_PRI)"
write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.")
touch($$MODULE_FWD_PRI, $$MODULE_PRI)
MODULE_PRI_FILES += $$MODULE_FWD_PRI
}
# Then, inject the new module into the current cache state
!contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_FWD_PRI): \ # before the actual include()!
cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, MODULE_PRI_FILES)
include($$MODULE_FWD_PRI)
for(var, $$list(TYPE EXTENDS CLASS_NAME PATH)): \
defined(QT_PLUGIN.$${MODULE}.$$var, var): \
cache(QT_PLUGIN.$${MODULE}.$$var, transient)
cache(QT_PLUGINS, transient)
} }
pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules