forked from qt-creator/qt-creator
McuSupport: remove legacy support for 1.x SDKs
Task-number: QTCREATORBUG-26891 Change-Id: I011649b051c6c4c9b954b1c782685e404c3796fe Reviewed-by: Piotr Mućko <piotr.mucko@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -401,7 +401,7 @@ void McuSupportOptions::registerExamples()
|
||||
|
||||
const QVersionNumber &McuSupportOptions::minimalQulVersion()
|
||||
{
|
||||
static const QVersionNumber v({1, 3});
|
||||
static const QVersionNumber v({2, 0});
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ void McuSupportOptions::setQulDir(const FilePath &dir)
|
||||
FilePath McuSupportOptions::qulDirFromSettings()
|
||||
{
|
||||
return Sdk::packagePathFromSettings(Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK,
|
||||
QSettings::UserScope);
|
||||
QSettings::UserScope, {});
|
||||
}
|
||||
|
||||
static void setKitProperties(const QString &kitName,
|
||||
@@ -567,14 +567,6 @@ void McuSupportOptions::setKitEnvironment(Kit *k,
|
||||
processPackage(package);
|
||||
processPackage(qtForMCUsSdkPackage);
|
||||
|
||||
// Clang not needed in version 1.7+
|
||||
if (mcuTarget->qulVersion() < QVersionNumber{1, 7}) {
|
||||
const QString path = QLatin1String(HostOsInfo::isWindowsHost() ? "Path" : "PATH");
|
||||
pathAdditions.append("${" + path + "}");
|
||||
pathAdditions.append(Core::ICore::libexecPath("clang/bin").toUserOutput());
|
||||
changes.append({path, pathAdditions.join(HostOsInfo::pathListSeparator())});
|
||||
}
|
||||
|
||||
if (kitNeedsQtVersion())
|
||||
changes.append({QLatin1String("LD_LIBRARY_PATH"), "%{Qt:QT_INSTALL_LIBS}"});
|
||||
|
||||
@@ -671,9 +663,6 @@ static void setKitCMakeOptions(Kit *k, const McuTarget *mcuTarget, const FilePat
|
||||
|
||||
config.append(CMakeConfigItem("QUL_PLATFORM", mcuTarget->platform().name.toUtf8()));
|
||||
|
||||
if (mcuTarget->qulVersion() <= QVersionNumber{1, 3} // OS variable was removed in Qul 1.4
|
||||
&& mcuTarget->os() == McuTarget::OS::FreeRTOS)
|
||||
config.append(CMakeConfigItem("OS", "FreeRTOS"));
|
||||
if (mcuTarget->colorDepth() != McuTarget::UnspecifiedColorDepth)
|
||||
config.append(CMakeConfigItem("QUL_COLOR_DEPTH",
|
||||
QString::number(mcuTarget->colorDepth()).toLatin1()));
|
||||
@@ -700,12 +689,6 @@ static void setKitQtVersionOptions(Kit *k)
|
||||
|
||||
QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
|
||||
{
|
||||
QString os;
|
||||
if (mcuTarget->qulVersion() <= QVersionNumber{1, 3}
|
||||
&& mcuTarget->os() == McuTarget::OS::FreeRTOS)
|
||||
// Starting from Qul 1.4 each OS is a separate platform
|
||||
os = QLatin1String(" FreeRTOS");
|
||||
|
||||
const McuToolChainPackage *tcPkg = mcuTarget->toolChainPackage();
|
||||
const QString compilerName = tcPkg && !tcPkg->isDesktopToolchain()
|
||||
? QString::fromLatin1(" (%1)").arg(
|
||||
@@ -717,11 +700,10 @@ QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
|
||||
const QString targetName = mcuTarget->platform().displayName.isEmpty()
|
||||
? mcuTarget->platform().name
|
||||
: mcuTarget->platform().displayName;
|
||||
return QString::fromLatin1("Qt for MCUs %1.%2 - %3%4%5%6")
|
||||
return QString::fromLatin1("Qt for MCUs %1.%2 - %3%4%5")
|
||||
.arg(QString::number(mcuTarget->qulVersion().majorVersion()),
|
||||
QString::number(mcuTarget->qulVersion().minorVersion()),
|
||||
targetName,
|
||||
os,
|
||||
colorDepth,
|
||||
compilerName);
|
||||
}
|
||||
|
@@ -527,10 +527,9 @@ protected:
|
||||
|
||||
QVector<McuTarget *> mcuTargets;
|
||||
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchain.id);
|
||||
if (tcPkg) {
|
||||
if (QVersionNumber::fromString(desc.qulVersion) >= QVersionNumber({1, 8}))
|
||||
tcPkg->setVersions(desc.toolchain.versions);
|
||||
} else
|
||||
if (tcPkg)
|
||||
tcPkg->setVersions(desc.toolchain.versions);
|
||||
else
|
||||
tcPkg = createUnsupportedToolChainPackage();
|
||||
for (int colorDepth : desc.platform.colorDepths) {
|
||||
QVector<McuAbstractPackage *> required3rdPartyPkgs;
|
||||
@@ -551,8 +550,7 @@ protected:
|
||||
boardSdkPkgs.insert(desc.boardSdk.envVar, boardSdkPkg);
|
||||
}
|
||||
auto boardSdkPkg = boardSdkPkgs.value(desc.boardSdk.envVar);
|
||||
if (QVersionNumber::fromString(desc.qulVersion) >= QVersionNumber({1, 8}))
|
||||
boardSdkPkg->setVersions(desc.boardSdk.versions);
|
||||
boardSdkPkg->setVersions(desc.boardSdk.versions);
|
||||
boardSdkDefaultPath = boardSdkPkg->defaultPath();
|
||||
required3rdPartyPkgs.append(boardSdkPkg);
|
||||
}
|
||||
@@ -641,9 +639,12 @@ static QFileInfoList targetDescriptionFiles(const Utils::FilePath &dir)
|
||||
return kitsDir.entryInfoList();
|
||||
}
|
||||
|
||||
static McuTargetDescription parseDescriptionJsonCommon(const QString &qulVersion,
|
||||
const QJsonObject &target)
|
||||
McuTargetDescription parseDescriptionJson(const QByteArray &data)
|
||||
{
|
||||
const QJsonDocument document = QJsonDocument::fromJson(data);
|
||||
const QJsonObject target = document.object();
|
||||
const QString qulVersion = target.value("qulVersion").toString();
|
||||
const QJsonObject platform = target.value("platform").toObject();
|
||||
const QString compatVersion = target.value("compatVersion").toString();
|
||||
const QJsonObject toolchain = target.value("toolchain").toObject();
|
||||
const QJsonObject boardSdk = target.value("boardSdk").toObject();
|
||||
@@ -660,105 +661,70 @@ static McuTargetDescription parseDescriptionJsonCommon(const QString &qulVersion
|
||||
return version.toString();
|
||||
});
|
||||
|
||||
return {qulVersion,
|
||||
compatVersion,
|
||||
{},
|
||||
{
|
||||
toolchain.value("id").toString(),
|
||||
toolchainVersionsList,
|
||||
},
|
||||
{
|
||||
boardSdk.value("name").toString(),
|
||||
boardSdk.value("defaultPath").toString(),
|
||||
boardSdk.value("envVar").toString(),
|
||||
boardSdkVersionsList,
|
||||
},
|
||||
{
|
||||
freeRTOS.value("envVar").toString(),
|
||||
freeRTOS.value("boardSdkSubDir").toString(),
|
||||
}};
|
||||
}
|
||||
|
||||
static McuTargetDescription parseDescriptionJsonV1x(const QString &qulVersion,
|
||||
const QJsonObject &target)
|
||||
{
|
||||
auto description = parseDescriptionJsonCommon(qulVersion, target);
|
||||
|
||||
const QVariantList colorDepths = target.value("colorDepths").toArray().toVariantList();
|
||||
const auto colorDepthsVector = Utils::transform<QVector<int>>(colorDepths,
|
||||
[&](const QVariant &colorDepth) {
|
||||
return colorDepth.toInt();
|
||||
});
|
||||
|
||||
description.platform = {target.value("platform").toString(),
|
||||
target.value("platformName").toString(),
|
||||
target.value("platformVendor").toString(),
|
||||
colorDepthsVector,
|
||||
description.boardSdk.envVar.isEmpty()
|
||||
? McuTargetDescription::TargetType::Desktop
|
||||
: McuTargetDescription::TargetType::MCU};
|
||||
return description;
|
||||
}
|
||||
|
||||
static McuTargetDescription parseDescriptionJsonV2x(const QString &qulVersion,
|
||||
const QJsonObject &target)
|
||||
{
|
||||
const QJsonObject platform = target.value("platform").toObject();
|
||||
|
||||
const QVariantList colorDepths = platform.value("colorDepths").toArray().toVariantList();
|
||||
const auto colorDepthsVector = Utils::transform<QVector<int>>(colorDepths,
|
||||
[&](const QVariant &colorDepth) {
|
||||
return colorDepth.toInt();
|
||||
});
|
||||
const QString platformName = platform.value("platformName").toString();
|
||||
McuTargetDescription description = parseDescriptionJsonCommon(qulVersion, target);
|
||||
description.platform = {
|
||||
platform.value("id").toString(),
|
||||
platformName,
|
||||
platform.value("vendor").toString(),
|
||||
colorDepthsVector,
|
||||
platformName == "Desktop" ? McuTargetDescription::TargetType::Desktop
|
||||
: McuTargetDescription::TargetType::MCU,
|
||||
|
||||
return {
|
||||
qulVersion,
|
||||
compatVersion,
|
||||
{
|
||||
platform.value("id").toString(),
|
||||
platformName,
|
||||
platform.value("vendor").toString(),
|
||||
colorDepthsVector,
|
||||
platformName == "Desktop" ? McuTargetDescription::TargetType::Desktop : McuTargetDescription::TargetType::MCU,
|
||||
},
|
||||
{
|
||||
toolchain.value("id").toString(),
|
||||
toolchainVersionsList,
|
||||
},
|
||||
{
|
||||
boardSdk.value("name").toString(),
|
||||
boardSdk.value("defaultPath").toString(),
|
||||
boardSdk.value("envVar").toString(),
|
||||
boardSdkVersionsList,
|
||||
},
|
||||
{
|
||||
freeRTOS.value("envVar").toString(),
|
||||
freeRTOS.value("boardSdkSubDir").toString(),
|
||||
}
|
||||
};
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
McuTargetDescription parseDescriptionJson(const QByteArray &data)
|
||||
{
|
||||
const QJsonDocument document = QJsonDocument::fromJson(data);
|
||||
const QJsonObject target = document.object();
|
||||
|
||||
const QString qulVersion = target.value("qulVersion").toString();
|
||||
|
||||
switch (QVersionNumber::fromString(qulVersion).majorVersion()) {
|
||||
case 1:
|
||||
return parseDescriptionJsonV1x(qulVersion, target);
|
||||
case 2:
|
||||
return parseDescriptionJsonV2x(qulVersion, target);
|
||||
default:
|
||||
return {qulVersion};
|
||||
}
|
||||
}
|
||||
|
||||
// https://doc.qt.io/qtcreator/creator-developing-mcu.html#supported-qt-for-mcus-sdks
|
||||
const QHash<QString, QString> oldSdkQtcRequiredVersion = {
|
||||
{{"1.0"}, {"4.11.x"}},
|
||||
{{"1.1"}, {"4.12.0 or 4.12.1"}},
|
||||
{{"1.2"}, {"4.12.2 or 4.12.3"}},
|
||||
};
|
||||
static const QString legacySupportVersionFor(const QString &sdkVersion)
|
||||
{
|
||||
static const QHash<QString, QString> oldSdkQtcRequiredVersion = {
|
||||
{{"1.0"}, {"4.11.x"}},
|
||||
{{"1.1"}, {"4.12.0 or 4.12.1"}},
|
||||
{{"1.2"}, {"4.12.2 or 4.12.3"}}
|
||||
};
|
||||
if (oldSdkQtcRequiredVersion.contains(sdkVersion))
|
||||
return oldSdkQtcRequiredVersion.value(sdkVersion);
|
||||
|
||||
if (QVersionNumber::fromString(sdkVersion).majorVersion() == 1)
|
||||
return "4.12.4 up to 6.0";
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
bool checkDeprecatedSdkError(const Utils::FilePath &qulDir, QString &message)
|
||||
{
|
||||
const McuPackagePathVersionDetector versionDetector("(?<=\\bQtMCUs.)(\\d+\\.\\d+)");
|
||||
const QString sdkDetectedVersion = versionDetector.parseVersion(qulDir.toString());
|
||||
const QString legacyVersion = legacySupportVersionFor(sdkDetectedVersion);
|
||||
|
||||
if (oldSdkQtcRequiredVersion.contains(sdkDetectedVersion)) {
|
||||
if (!legacyVersion.isEmpty()) {
|
||||
message = McuTarget::tr("Qt for MCUs SDK version %1 detected, "
|
||||
"only supported by Qt Creator version %2. "
|
||||
"This version of Qt Creator requires Qt for MCUs %3 or greater.")
|
||||
.arg(sdkDetectedVersion,
|
||||
oldSdkQtcRequiredVersion.value(sdkDetectedVersion),
|
||||
legacyVersion,
|
||||
McuSupportOptions::minimalQulVersion().toString());
|
||||
return true;
|
||||
}
|
||||
@@ -787,10 +753,11 @@ void targetsAndPackages(const Utils::FilePath &dir, McuSdkRepository *repo)
|
||||
continue;
|
||||
}
|
||||
if (QVersionNumber::fromString(desc.qulVersion) < McuSupportOptions::minimalQulVersion()) {
|
||||
const QString legacyVersion = legacySupportVersionFor(desc.qulVersion);
|
||||
const QString qtcSupportText
|
||||
= oldSdkQtcRequiredVersion.contains(desc.qulVersion)
|
||||
= !legacyVersion.isEmpty()
|
||||
? McuTarget::tr("Detected version \"%1\", only supported by Qt Creator %2.")
|
||||
.arg(desc.qulVersion, oldSdkQtcRequiredVersion.value(desc.qulVersion))
|
||||
.arg(desc.qulVersion, legacyVersion)
|
||||
: McuTarget::tr("Unsupported version \"%1\".").arg(desc.qulVersion);
|
||||
printMessage(McuTarget::tr("Skipped %1. %2 Qt for MCUs version >= %3 required.")
|
||||
.arg(QDir::toNativeSeparators(pth.fileNameWithPathComponents(1)),
|
||||
@@ -818,61 +785,6 @@ void targetsAndPackages(const Utils::FilePath &dir, McuSdkRepository *repo)
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround for missing JSON file for Desktop target.
|
||||
// Desktop JSON file is shipped starting from Qul 1.5.
|
||||
// This whole section could be removed when minimalQulVersion will reach 1.5 or above
|
||||
{
|
||||
const bool hasDesktopDescription
|
||||
= contains(descriptions, [](const McuTargetDescription &desc) {
|
||||
return desc.platform.type == McuTargetDescription::TargetType::Desktop;
|
||||
});
|
||||
|
||||
if (!hasDesktopDescription) {
|
||||
QVector<FilePath> desktopLibs;
|
||||
if (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 (anyOf(desktopLibs, [](const FilePath &desktopLib) { return desktopLib.exists(); })) {
|
||||
McuTargetDescription desktopDescription;
|
||||
desktopDescription.qulVersion
|
||||
= descriptions.empty() ? McuSupportOptions::minimalQulVersion().toString()
|
||||
: descriptions.first().qulVersion;
|
||||
desktopDescription.platform.id = "Qt";
|
||||
desktopDescription.platform.name = "Desktop";
|
||||
desktopDescription.platform.vendor = "Qt";
|
||||
desktopDescription.platform.colorDepths = {32};
|
||||
desktopDescription.toolchain.id = HostOsInfo::isWindowsHost() ? QString("msvc")
|
||||
: QString("gcc");
|
||||
desktopDescription.platform.type = McuTargetDescription::TargetType::Desktop;
|
||||
descriptions.prepend(desktopDescription);
|
||||
} else {
|
||||
// show error only on 1.x SDKs, but skip on 2.x
|
||||
const FilePath desktopLibV2
|
||||
= HostOsInfo::isWindowsHost()
|
||||
? dir / "lib/QulPlatform_qt_32bpp_Windows_msvc_Release.lib"
|
||||
: dir / "lib/libQulPlatform_qt_32bpp_Linux_gnu_Release.a";
|
||||
if (dir.exists() && !desktopLibV2.exists())
|
||||
printMessage(
|
||||
McuTarget::tr(
|
||||
"Skipped creating fallback desktop kit: Could not find any of %1.")
|
||||
.arg(transform(desktopLibs,
|
||||
[](const auto &path) {
|
||||
return QDir::toNativeSeparators(
|
||||
path.fileNameWithPathComponents(1));
|
||||
})
|
||||
.toList()
|
||||
.join(" or ")),
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repo->mcuTargets.append(targetsFromDescriptions(descriptions, &(repo->packages)));
|
||||
|
||||
// Keep targets sorted lexicographically
|
||||
|
@@ -57,8 +57,8 @@ QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescription> &
|
||||
Utils::FilePath kitsPath(const Utils::FilePath &dir);
|
||||
|
||||
Utils::FilePath packagePathFromSettings(const QString &settingsKey,
|
||||
QSettings::Scope scope = QSettings::UserScope,
|
||||
const Utils::FilePath &defaultPath = {});
|
||||
QSettings::Scope scope,
|
||||
const Utils::FilePath &defaultPath);
|
||||
} // namespace Sdk
|
||||
} // namespace Internal
|
||||
} // namespace McuSupport
|
||||
|
@@ -4,20 +4,7 @@ project(%{ProjectName} VERSION 0.0.1 LANGUAGES C CXX ASM ASM_MASM)
|
||||
|
||||
find_package(Qul)
|
||||
|
||||
if(Qul_VERSION VERSION_GREATER_EQUAL "1.7")
|
||||
qul_add_target(%{ProjectName})
|
||||
else()
|
||||
add_executable(%{ProjectName})
|
||||
target_link_libraries(%{ProjectName}
|
||||
Qul::QuickUltralite
|
||||
Qul::QuickUltralitePlatform)
|
||||
endif()
|
||||
|
||||
qul_add_target(%{ProjectName})
|
||||
qul_target_qml_sources(%{ProjectName} %{MainQmlFile})
|
||||
app_target_setup_os(%{ProjectName})
|
||||
|
||||
if(Qul_VERSION VERSION_GREATER_EQUAL "2.0")
|
||||
app_target_default_entrypoint(%{ProjectName} %{RootItemName})
|
||||
else()
|
||||
app_target_default_main(%{ProjectName} %{RootItemName})
|
||||
endif()
|
||||
app_target_default_entrypoint(%{ProjectName} %{RootItemName})
|
||||
|
Reference in New Issue
Block a user