From 15cf52cd592a4758ee334148546aba485d703142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Keller?= Date: Tue, 14 Nov 2023 17:34:33 +0100 Subject: [PATCH] Windeployqt: also allow platform-type plugin selection Including/excluding plugins of the platforms type did not work, since windeployqt was only ever looking for 'qwindows'. Keep the default behavior of deploying 'qwindows.dll', but also allow users to add/remove platform-type plugins. Pick-to: 6.6 Change-Id: I4062a71939224d1462896d95a2541e8caced399d Reviewed-by: Oliver Wolff (cherry picked from commit bca41b1832bf1ce76787109456094149520bc403) Reviewed-by: Qt Cherry-pick Bot --- src/tools/windeployqt/main.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/tools/windeployqt/main.cpp b/src/tools/windeployqt/main.cpp index a92b4f9a8b8..57c32897309 100644 --- a/src/tools/windeployqt/main.cpp +++ b/src/tools/windeployqt/main.cpp @@ -953,6 +953,14 @@ static QString deployPlugin(const QString &plugin, const QDir &subDir, const boo return {}; } + // By default, only deploy qwindows.dll + if (subDirName == u"platforms" + && !(pluginSelections.includedPlugins.contains(pluginName) + || (pluginSelections.enabledPluginTypes.contains(subDirName))) + && !pluginName.startsWith(u"qwindows")) { + return {}; + } + const QString pluginPath = subDir.absoluteFilePath(plugin); // If dueToModule is false, check if the user included the plugin or the entire type. In the @@ -1043,25 +1051,17 @@ QStringList findQtPlugins(ModuleBitset *usedQtModules, const ModuleBitset &disab : debugMatchModeIn; QDir subDir(subDirFi.absoluteFilePath()); std::wcout << "Adding in plugin type " << subDirFi.baseName() << " for module: " << qtModuleEntries.moduleById(module).name << '\n'; - // Filter for platform or any. - QString filter; + const bool isPlatformPlugin = subDirName == "platforms"_L1; - if (isPlatformPlugin) { - filter = QStringLiteral("qwindows"); - if (!infix.isEmpty()) - filter += infix; - } else { - filter = u"*"_s; - } const QStringList plugins = - findSharedLibraries(subDir, platform, debugMatchMode, filter); + findSharedLibraries(subDir, platform, debugMatchMode, QString()); for (const QString &plugin : plugins) { const QString pluginPath = deployPlugin(plugin, subDir, dueToModule, debugMatchMode, usedQtModules, disabledQtModules, pluginSelections, libraryLocation, infix, platform, deployInsightTrackerPlugin); if (!pluginPath.isEmpty()) { - if (isPlatformPlugin) + if (isPlatformPlugin && plugin.startsWith(u"qwindows")) *platformPlugin = subDir.absoluteFilePath(plugin); result.append(pluginPath); }