From 92139f18b0ce0d6906f31fcf51913fb2e27c431e Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 18 Jun 2020 19:03:44 +0200 Subject: [PATCH] McuSupport: Improve version checking, support Desktop-only installation Due to the missing .json file for desktop targets, the Desktop target was only listed in the target chooser if at least one hardware target (which do have .json files) was installed in the SDK. This prevented using of Desktop-only Qt for MCUs installations. This change causes the Desktop target to be listed if the respective library exists. With a Desktop-only Qt for MCUs installation, this means that we blindly trust that the selected Qt for MCUs SDK version is supported. On the other hand we make the version checking stricter (in case we do find .json files). If the version of one targets does not match, the whole SDK installation is deemed invalid and no target is listed, also none for Desktop. Change-Id: I9d83b22255c19c5f8c6360e0b6137ce40311f8c4 Reviewed-by: Marco Bubke Reviewed-by: Alessandro Portale --- src/plugins/mcusupport/mcusupportsdk.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/mcusupport/mcusupportsdk.cpp b/src/plugins/mcusupport/mcusupportsdk.cpp index 7dd79679977..d87038c8a00 100644 --- a/src/plugins/mcusupport/mcusupportsdk.cpp +++ b/src/plugins/mcusupport/mcusupportsdk.cpp @@ -344,17 +344,17 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector *packa const McuTargetDescription desc = parseDescriptionJson(file.readAll()); if (!McuSupportOptions::supportedQulVersion() .isPrefixOf(QVersionNumber::fromString(desc.qulVersion))) - continue; + return; // Invalid version means invalid SDK installation. descriptions.append(desc); } - if (!descriptions.isEmpty()) { - // Workaround for missing JSON file for Desktop target: + // Workaround for missing JSON file for Desktop target: + if (dir.pathAppended("/lib/QulQuickUltralite_QT_32bpp_Windows_Release.lib").exists()) { descriptions.prepend({McuSupportOptions::supportedQulVersion().toString(), {"Qt"}, {"Qt"}, {32}, {"desktop"}, {}, {}}); - - mcuTargets->append(targetsFromDescriptions(descriptions, packages)); } + + mcuTargets->append(targetsFromDescriptions(descriptions, packages)); } } // namespace Sdk