forked from qt-creator/qt-creator
McuSupport: Change version checking from exact == to >= minimum
So far, one Qt Creator version supported exactly one Qt for MCUs version, mainly because of incompatibilities in-between Qt for MCUs versions. The compatibility of 1.2 with 1.3 and further is now deemed stable enough to loosen the version checking. This change replaces the exact versions comparison (between Qt for MCUs SDK version and what Qt Creator supports) to a minimum version check of what Qt Creator supports. One limitation that remains is that you can only have one kit per target, across the supported Qt for MCUs versions. To mend this, UI changes are required (in a separate commit). Workaround for now: If you want e.g. Desktop Kits for different Qt for MCUs versions at the same time, you need to work with kit clones. Task-number: QTCREATORBUG-24293 Change-Id: Ifd31cd2eadbc1d7fa02415e1928d0047cf007f7c Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -336,10 +336,12 @@ QVariant McuToolChainPackage::debuggerId() const
|
||||
return debuggerId;
|
||||
}
|
||||
|
||||
McuTarget::McuTarget(const QString &vendor, const QString &platform, OS os,
|
||||
McuTarget::McuTarget(const QVersionNumber &qulVersion, const QString &vendor,
|
||||
const QString &platform, OS os,
|
||||
const QVector<McuPackage *> &packages,
|
||||
const McuToolChainPackage *toolChainPackage)
|
||||
: m_vendor(vendor)
|
||||
: m_qulVersion(qulVersion)
|
||||
, m_vendor(vendor)
|
||||
, m_qulPlatform(platform)
|
||||
, m_os(os)
|
||||
, m_packages(packages)
|
||||
@@ -379,6 +381,11 @@ bool McuTarget::isValid() const
|
||||
});
|
||||
}
|
||||
|
||||
QVersionNumber McuTarget::qulVersion() const
|
||||
{
|
||||
return m_qulVersion;
|
||||
}
|
||||
|
||||
int McuTarget::colorDepth() const
|
||||
{
|
||||
return m_colorDepth;
|
||||
@@ -455,7 +462,7 @@ void McuSupportOptions::deletePackagesAndTargets()
|
||||
mcuTargets.clear();
|
||||
}
|
||||
|
||||
const QVersionNumber &McuSupportOptions::supportedQulVersion()
|
||||
const QVersionNumber &McuSupportOptions::minimalQulVersion()
|
||||
{
|
||||
static const QVersionNumber v({1, 3});
|
||||
return v;
|
||||
@@ -498,7 +505,7 @@ static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k,
|
||||
k->setValue(KIT_MCUTARGET_VENDOR_KEY, mcuTarget->vendor());
|
||||
k->setValue(KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform());
|
||||
k->setValue(KIT_MCUTARGET_COLORDEPTH_KEY, mcuTarget->colorDepth());
|
||||
k->setValue(KIT_MCUTARGET_SDKVERSION_KEY, McuSupportOptions::supportedQulVersion().toString());
|
||||
k->setValue(KIT_MCUTARGET_SDKVERSION_KEY, mcuTarget->qulVersion().toString());
|
||||
k->setValue(KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION);
|
||||
k->setValue(KIT_MCUTARGET_OS_KEY, static_cast<int>(mcuTarget->os()));
|
||||
k->setAutoDetected(true);
|
||||
@@ -631,7 +638,7 @@ QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
|
||||
? "Desktop"
|
||||
: mcuTarget->qulPlatform();
|
||||
return QString::fromLatin1("Qt for MCUs %1 - %2%3%4")
|
||||
.arg(supportedQulVersion().toString(), targetName, os, colorDepth);
|
||||
.arg(mcuTarget->qulVersion().toString(), targetName, os, colorDepth);
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
|
||||
@@ -641,8 +648,6 @@ QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *m
|
||||
return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) {
|
||||
return kit->isAutoDetected()
|
||||
&& kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
|
||||
&& kit->value(KIT_MCUTARGET_SDKVERSION_KEY) ==
|
||||
McuSupportOptions::supportedQulVersion().toString()
|
||||
&& (!mcuTarget || (
|
||||
kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->vendor()
|
||||
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->qulPlatform()
|
||||
|
@@ -138,9 +138,11 @@ public:
|
||||
FreeRTOS
|
||||
};
|
||||
|
||||
McuTarget(const QString &vendor, const QString &platform, OS os,
|
||||
const QVector<McuPackage *> &packages, const McuToolChainPackage *toolChainPackage);
|
||||
McuTarget(const QVersionNumber &qulVersion, const QString &vendor, const QString &platform,
|
||||
OS os, const QVector<McuPackage *> &packages,
|
||||
const McuToolChainPackage *toolChainPackage);
|
||||
|
||||
QVersionNumber qulVersion() const;
|
||||
QString vendor() const;
|
||||
QVector<McuPackage *> packages() const;
|
||||
const McuToolChainPackage *toolChainPackage() const;
|
||||
@@ -151,6 +153,7 @@ public:
|
||||
bool isValid() const;
|
||||
|
||||
private:
|
||||
const QVersionNumber m_qulVersion;
|
||||
const QString m_vendor;
|
||||
const QString m_qulPlatform;
|
||||
const OS m_os = OS::BareMetal;
|
||||
@@ -184,7 +187,7 @@ public:
|
||||
static void registerQchFiles();
|
||||
static void registerExamples();
|
||||
|
||||
static const QVersionNumber &supportedQulVersion();
|
||||
static const QVersionNumber &minimalQulVersion();
|
||||
|
||||
private:
|
||||
void deletePackagesAndTargets();
|
||||
|
@@ -59,8 +59,8 @@ static QString findInProgramFiles(const QString &folder)
|
||||
McuPackage *createQtForMCUsPackage()
|
||||
{
|
||||
auto result = new McuPackage(
|
||||
McuPackage::tr("Qt for MCUs %1 SDK").arg(
|
||||
McuSupportOptions::supportedQulVersion().toString()),
|
||||
McuPackage::tr("Qt for MCUs %1+ SDK").arg(
|
||||
McuSupportOptions::minimalQulVersion().toString()),
|
||||
QDir::homePath(),
|
||||
Utils::HostOsInfo::withExecutableSuffix("bin/qmltocpp"),
|
||||
Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK);
|
||||
@@ -276,7 +276,8 @@ static QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescrip
|
||||
for (auto desc : descriptions) {
|
||||
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchainId);
|
||||
if (desc.toolchainId == "desktop") {
|
||||
auto mcuTarget = new McuTarget(desc.platformVendor, desc.platform,
|
||||
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
||||
desc.platformVendor, desc.platform,
|
||||
McuTarget::OS::Desktop, {}, tcPkg);
|
||||
mcuTargets.append(mcuTarget);
|
||||
continue;
|
||||
@@ -310,7 +311,8 @@ static QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescrip
|
||||
}
|
||||
}
|
||||
|
||||
auto mcuTarget = new McuTarget(desc.platformVendor, desc.platform, os,
|
||||
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
||||
desc.platformVendor, desc.platform, os,
|
||||
required3rdPartyPkgs, tcPkg);
|
||||
if (desc.colorDepths.count() > 1)
|
||||
mcuTarget->setColorDepth(colorDepth);
|
||||
@@ -370,16 +372,17 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector<McuPackage *> *packa
|
||||
if (!file.open(QFile::ReadOnly))
|
||||
continue;
|
||||
const McuTargetDescription desc = parseDescriptionJson(file.readAll());
|
||||
if (!McuSupportOptions::supportedQulVersion()
|
||||
.isPrefixOf(QVersionNumber::fromString(desc.qulVersion)))
|
||||
if (QVersionNumber::fromString(desc.qulVersion) < McuSupportOptions::minimalQulVersion())
|
||||
return; // Invalid version means invalid SDK installation.
|
||||
descriptions.append(desc);
|
||||
}
|
||||
|
||||
// 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"}, {}, {}, {}});
|
||||
const QString qulVersion = descriptions.empty() ?
|
||||
McuSupportOptions::minimalQulVersion().toString()
|
||||
: descriptions.first().qulVersion;
|
||||
descriptions.prepend({qulVersion, {"Qt"}, {"Qt"}, {32}, {"desktop"}, {}, {}, {}});
|
||||
}
|
||||
|
||||
mcuTargets->append(targetsFromDescriptions(descriptions, packages));
|
||||
|
Reference in New Issue
Block a user