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;
|
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 QVector<McuPackage *> &packages,
|
||||||
const McuToolChainPackage *toolChainPackage)
|
const McuToolChainPackage *toolChainPackage)
|
||||||
: m_vendor(vendor)
|
: m_qulVersion(qulVersion)
|
||||||
|
, m_vendor(vendor)
|
||||||
, m_qulPlatform(platform)
|
, m_qulPlatform(platform)
|
||||||
, m_os(os)
|
, m_os(os)
|
||||||
, m_packages(packages)
|
, m_packages(packages)
|
||||||
@@ -379,6 +381,11 @@ bool McuTarget::isValid() const
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVersionNumber McuTarget::qulVersion() const
|
||||||
|
{
|
||||||
|
return m_qulVersion;
|
||||||
|
}
|
||||||
|
|
||||||
int McuTarget::colorDepth() const
|
int McuTarget::colorDepth() const
|
||||||
{
|
{
|
||||||
return m_colorDepth;
|
return m_colorDepth;
|
||||||
@@ -455,7 +462,7 @@ void McuSupportOptions::deletePackagesAndTargets()
|
|||||||
mcuTargets.clear();
|
mcuTargets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVersionNumber &McuSupportOptions::supportedQulVersion()
|
const QVersionNumber &McuSupportOptions::minimalQulVersion()
|
||||||
{
|
{
|
||||||
static const QVersionNumber v({1, 3});
|
static const QVersionNumber v({1, 3});
|
||||||
return v;
|
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_VENDOR_KEY, mcuTarget->vendor());
|
||||||
k->setValue(KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform());
|
k->setValue(KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform());
|
||||||
k->setValue(KIT_MCUTARGET_COLORDEPTH_KEY, mcuTarget->colorDepth());
|
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_KITVERSION_KEY, KIT_VERSION);
|
||||||
k->setValue(KIT_MCUTARGET_OS_KEY, static_cast<int>(mcuTarget->os()));
|
k->setValue(KIT_MCUTARGET_OS_KEY, static_cast<int>(mcuTarget->os()));
|
||||||
k->setAutoDetected(true);
|
k->setAutoDetected(true);
|
||||||
@@ -631,7 +638,7 @@ QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
|
|||||||
? "Desktop"
|
? "Desktop"
|
||||||
: mcuTarget->qulPlatform();
|
: mcuTarget->qulPlatform();
|
||||||
return QString::fromLatin1("Qt for MCUs %1 - %2%3%4")
|
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)
|
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 Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) {
|
||||||
return kit->isAutoDetected()
|
return kit->isAutoDetected()
|
||||||
&& kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
|
&& kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
|
||||||
&& kit->value(KIT_MCUTARGET_SDKVERSION_KEY) ==
|
|
||||||
McuSupportOptions::supportedQulVersion().toString()
|
|
||||||
&& (!mcuTarget || (
|
&& (!mcuTarget || (
|
||||||
kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->vendor()
|
kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->vendor()
|
||||||
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->qulPlatform()
|
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->qulPlatform()
|
||||||
|
@@ -138,9 +138,11 @@ public:
|
|||||||
FreeRTOS
|
FreeRTOS
|
||||||
};
|
};
|
||||||
|
|
||||||
McuTarget(const QString &vendor, const QString &platform, OS os,
|
McuTarget(const QVersionNumber &qulVersion, const QString &vendor, const QString &platform,
|
||||||
const QVector<McuPackage *> &packages, const McuToolChainPackage *toolChainPackage);
|
OS os, const QVector<McuPackage *> &packages,
|
||||||
|
const McuToolChainPackage *toolChainPackage);
|
||||||
|
|
||||||
|
QVersionNumber qulVersion() const;
|
||||||
QString vendor() const;
|
QString vendor() const;
|
||||||
QVector<McuPackage *> packages() const;
|
QVector<McuPackage *> packages() const;
|
||||||
const McuToolChainPackage *toolChainPackage() const;
|
const McuToolChainPackage *toolChainPackage() const;
|
||||||
@@ -151,6 +153,7 @@ public:
|
|||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const QVersionNumber m_qulVersion;
|
||||||
const QString m_vendor;
|
const QString m_vendor;
|
||||||
const QString m_qulPlatform;
|
const QString m_qulPlatform;
|
||||||
const OS m_os = OS::BareMetal;
|
const OS m_os = OS::BareMetal;
|
||||||
@@ -184,7 +187,7 @@ public:
|
|||||||
static void registerQchFiles();
|
static void registerQchFiles();
|
||||||
static void registerExamples();
|
static void registerExamples();
|
||||||
|
|
||||||
static const QVersionNumber &supportedQulVersion();
|
static const QVersionNumber &minimalQulVersion();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void deletePackagesAndTargets();
|
void deletePackagesAndTargets();
|
||||||
|
@@ -59,8 +59,8 @@ static QString findInProgramFiles(const QString &folder)
|
|||||||
McuPackage *createQtForMCUsPackage()
|
McuPackage *createQtForMCUsPackage()
|
||||||
{
|
{
|
||||||
auto result = new McuPackage(
|
auto result = new McuPackage(
|
||||||
McuPackage::tr("Qt for MCUs %1 SDK").arg(
|
McuPackage::tr("Qt for MCUs %1+ SDK").arg(
|
||||||
McuSupportOptions::supportedQulVersion().toString()),
|
McuSupportOptions::minimalQulVersion().toString()),
|
||||||
QDir::homePath(),
|
QDir::homePath(),
|
||||||
Utils::HostOsInfo::withExecutableSuffix("bin/qmltocpp"),
|
Utils::HostOsInfo::withExecutableSuffix("bin/qmltocpp"),
|
||||||
Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK);
|
Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK);
|
||||||
@@ -276,7 +276,8 @@ static QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescrip
|
|||||||
for (auto desc : descriptions) {
|
for (auto desc : descriptions) {
|
||||||
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchainId);
|
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchainId);
|
||||||
if (desc.toolchainId == "desktop") {
|
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);
|
McuTarget::OS::Desktop, {}, tcPkg);
|
||||||
mcuTargets.append(mcuTarget);
|
mcuTargets.append(mcuTarget);
|
||||||
continue;
|
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);
|
required3rdPartyPkgs, tcPkg);
|
||||||
if (desc.colorDepths.count() > 1)
|
if (desc.colorDepths.count() > 1)
|
||||||
mcuTarget->setColorDepth(colorDepth);
|
mcuTarget->setColorDepth(colorDepth);
|
||||||
@@ -370,16 +372,17 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector<McuPackage *> *packa
|
|||||||
if (!file.open(QFile::ReadOnly))
|
if (!file.open(QFile::ReadOnly))
|
||||||
continue;
|
continue;
|
||||||
const McuTargetDescription desc = parseDescriptionJson(file.readAll());
|
const McuTargetDescription desc = parseDescriptionJson(file.readAll());
|
||||||
if (!McuSupportOptions::supportedQulVersion()
|
if (QVersionNumber::fromString(desc.qulVersion) < McuSupportOptions::minimalQulVersion())
|
||||||
.isPrefixOf(QVersionNumber::fromString(desc.qulVersion)))
|
|
||||||
return; // Invalid version means invalid SDK installation.
|
return; // Invalid version means invalid SDK installation.
|
||||||
descriptions.append(desc);
|
descriptions.append(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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()) {
|
if (dir.pathAppended("/lib/QulQuickUltralite_QT_32bpp_Windows_Release.lib").exists()) {
|
||||||
descriptions.prepend({McuSupportOptions::supportedQulVersion().toString(),
|
const QString qulVersion = descriptions.empty() ?
|
||||||
{"Qt"}, {"Qt"}, {32}, {"desktop"}, {}, {}, {}});
|
McuSupportOptions::minimalQulVersion().toString()
|
||||||
|
: descriptions.first().qulVersion;
|
||||||
|
descriptions.prepend({qulVersion, {"Qt"}, {"Qt"}, {32}, {"desktop"}, {}, {}, {}});
|
||||||
}
|
}
|
||||||
|
|
||||||
mcuTargets->append(targetsFromDescriptions(descriptions, packages));
|
mcuTargets->append(targetsFromDescriptions(descriptions, packages));
|
||||||
|
Reference in New Issue
Block a user