From 020c54daaaee6a0e4ce7de9bdf57b3ca4e8965b1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 12 May 2014 15:30:47 +0200 Subject: [PATCH] fix/optimize QT_PLUGIN_PATH construction in qtAddTargetEnv() instead of adding all possible plugin paths (for which QMAKEMODULES wouldn't have been a reliable source anyway), only add the paths of plugins of the necessary types. this necessitates that we create qt_plugin_.pri files also in shared builds of qt when making a prefix build. we don't install them unless it's a static build, though. Change-Id: Ib56b009562a7131d4dc4dfc259b34ec6581b0f77 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_functions.prf | 20 ++++++++++++-------- mkspecs/features/qt_plugin.prf | 10 ++++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index d41fe3b4d51..9a4d80e80f2 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -253,11 +253,13 @@ defineTest(qtAddTargetEnv) { deps = $$replace($$2, -private$, _private) deps = $$resolve_depends(deps, "QT.", ".depends" ".private_depends" ".run_depends") !isEmpty(deps) { + ptypes = for(dep, deps) { isEmpty(3): \ deppath += $$shell_path($$eval(QT.$${dep}.libs)) else: \ deppath += $$system_path($$eval(QT.$${dep}.libs)) + ptypes += $$eval(QT.$${dep}.plugin_types) } equals(QMAKE_HOST.os, Windows) { deppath.name = PATH @@ -277,14 +279,16 @@ defineTest(qtAddTargetEnv) { deppath.CONFIG = prepend pluginpath.value = - for(qmod, QMAKEMODULES) { - qmod = $$section(qmod, /, 0, -3)/plugins - exists($$qmod) { - isEmpty(3): \ - pluginpath.value += $$shell_path($$qmod) - else: \ - pluginpath.value += $$system_path($$qmod) - } + ppaths = $$[QT_INSTALL_PLUGINS/get] + for(qplug, QT_PLUGINS): \ + contains(ptypes, QT_PLUGIN.$${qplug}.TYPE): \ + ppaths += $$eval(QT_PLUGIN.$${qplug}.PATH) + ppaths = $$unique(ppaths) + for(qplug, ppaths) { + isEmpty(3): \ + pluginpath.value += $$shell_path($$qplug) + else: \ + pluginpath.value += $$system_path($$qplug) } pluginpath.name = QT_PLUGIN_PATH diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index b012278bde3..8a70ce041a8 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -24,7 +24,7 @@ tool_plugin { contains(QT_CONFIG, build_all):CONFIG += build_all } -CONFIG(static, static|shared) { +CONFIG(static, static|shared)|prefix_build { isEmpty(MODULE): MODULE = $$basename(TARGET) mod_work_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules @@ -66,9 +66,11 @@ CONFIG(static, static|shared) { cache(QT_PLUGINS, transient) } - pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules - pritarget.files = $$MODULE_PRI - INSTALLS += pritarget + CONFIG(static, static|shared) { + pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules + pritarget.files = $$MODULE_PRI + INSTALLS += pritarget + } } target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE