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 diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index 5efd55582d..c020bd2767 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -27,7 +27,13 @@ tool_plugin { CONFIG(static, static|shared) { 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 { MODULE_PRI_CONT = \ @@ -35,8 +41,29 @@ CONFIG(static, static|shared) { "QT_PLUGIN.$${MODULE}.EXTENDS = $$PLUGIN_EXTENDS" \ "QT_PLUGIN.$${MODULE}.CLASS_NAME = $$PLUGIN_CLASS_NAME" \ "QT_PLUGINS += $$MODULE" - 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