From 2aead8b3e4513eda90140841528966b6926948bf Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Mon, 15 Mar 2021 09:02:09 +0100 Subject: [PATCH] McuSupport: detect fallback lib when desktop kit missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The library filename has changed in recent versions of the SDK, which was causing false negatives. Fixes: QTCREATORBUG-25469 Change-Id: Ie98c75a57efc5384262dbfd17f729b34cdd5f577 Reviewed-by: Erik Verbruggen Reviewed-by: Alessandro Portale Reviewed-by: Dawid Śliwa --- src/plugins/mcusupport/mcusupportsdk.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/plugins/mcusupport/mcusupportsdk.cpp b/src/plugins/mcusupport/mcusupportsdk.cpp index 75a2d115336..b0e1395bae4 100644 --- a/src/plugins/mcusupport/mcusupportsdk.cpp +++ b/src/plugins/mcusupport/mcusupportsdk.cpp @@ -593,13 +593,18 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector *packa }); if (!hasDesktopDescription) { - Utils::FilePath desktopLib; - if (Utils::HostOsInfo::isWindowsHost()) - desktopLib = dir / "lib/QulQuickUltralite_QT_32bpp_Windows_Release.lib"; - else - desktopLib = dir / "lib/libQulQuickUltralite_QT_32bpp_Linux_Debug.a"; + QVector desktopLibs; + if (Utils::HostOsInfo::isWindowsHost()) { + desktopLibs << dir / "lib/QulQuickUltralite_QT_32bpp_Windows_Release.lib"; // older versions of QUL (<1.5?) + desktopLibs << dir / "lib/QulQuickUltralitePlatform_QT_32bpp_Windows_msvc_Release.lib"; // newer versions of QUL + } else { + desktopLibs << dir / "lib/libQulQuickUltralite_QT_32bpp_Linux_Debug.a"; // older versions of QUL (<1.5?) + desktopLibs << dir / "lib/libQulQuickUltralitePlatform_QT_32bpp_Linux_gnu_Debug.a"; // newer versions of QUL + } - if (desktopLib.exists()) { + if (Utils::anyOf(desktopLibs, [](const Utils::FilePath &desktopLib) { + return desktopLib.exists(); }) + ) { McuTargetDescription desktopDescription; desktopDescription.qulVersion = descriptions.empty() ? McuSupportOptions::minimalQulVersion().toString() @@ -613,8 +618,10 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector *packa descriptions.prepend(desktopDescription); } else { if (dir.exists()) - printMessage(McuTarget::tr("Skipped creating fallback desktop kit: Could not find %1.") - .arg(QDir::toNativeSeparators(desktopLib.fileNameWithPathComponents(1))), + printMessage(McuTarget::tr("Skipped creating fallback desktop kit: Could not find any of %1.") + .arg(Utils::transform(desktopLibs, [](const auto &path) { + return QDir::toNativeSeparators(path.fileNameWithPathComponents(1)); + }).toList().join(" or ")), false); } }