forked from qt-creator/qt-creator
McuSupport: Display errors when generating kits automatically
Fixes: QTCREATORBUG-25260 Change-Id: I5e45a56d08920886b2f654a1c98a7451e1c9dc3f Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
committed by
christiaan.janssen
parent
1b0ad83b99
commit
4b6f1c1366
@@ -490,6 +490,19 @@ bool McuTarget::isValid() const
|
||||
});
|
||||
}
|
||||
|
||||
void McuTarget::printPackageProblems() const
|
||||
{
|
||||
for (auto package: packages()) {
|
||||
package->updateStatus();
|
||||
if (package->status() != McuPackage::ValidPackage)
|
||||
printMessage(QString("Error creating kit for target %1, package %2: %3").arg(
|
||||
McuSupportOptions::kitName(this),
|
||||
package->label(),
|
||||
package->statusText()),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
QVersionNumber McuTarget::qulVersion() const
|
||||
{
|
||||
return m_qulVersion;
|
||||
@@ -699,13 +712,28 @@ static void setKitCMakeOptions(Kit *k, const McuTarget* mcuTarget, const QString
|
||||
config.append(CMakeConfigItem("CMAKE_CXX_COMPILER", "%{Compiler:Executable:Cxx}"));
|
||||
config.append(CMakeConfigItem("CMAKE_C_COMPILER", "%{Compiler:Executable:C}"));
|
||||
}
|
||||
if (!mcuTarget->toolChainPackage()->isDesktopToolchain())
|
||||
|
||||
if (!mcuTarget->toolChainPackage()->isDesktopToolchain()) {
|
||||
const FilePath cMakeToolchainFile = FilePath::fromString(qulDir + "/lib/cmake/Qul/toolchain/"
|
||||
+ mcuTarget->toolChainPackage()->cmakeToolChainFileName());
|
||||
|
||||
config.append(CMakeConfigItem(
|
||||
"CMAKE_TOOLCHAIN_FILE",
|
||||
(qulDir + "/lib/cmake/Qul/toolchain/"
|
||||
+ mcuTarget->toolChainPackage()->cmakeToolChainFileName()).toUtf8()));
|
||||
cMakeToolchainFile.toString().toUtf8()));
|
||||
if (!cMakeToolchainFile.exists()) {
|
||||
printMessage(McuTarget::tr("Warning for target %1: missing CMake Toolchain File expected at %2.")
|
||||
.arg(McuSupportOptions::kitName(mcuTarget), cMakeToolchainFile.toUserOutput()), false);
|
||||
}
|
||||
}
|
||||
|
||||
const FilePath generatorsPath = FilePath::fromString(qulDir + "/lib/cmake/Qul/QulGenerators.cmake");
|
||||
config.append(CMakeConfigItem("QUL_GENERATORS",
|
||||
(qulDir + "/lib/cmake/Qul/QulGenerators.cmake").toUtf8()));
|
||||
generatorsPath.toString().toUtf8()));
|
||||
if (!generatorsPath.exists()) {
|
||||
printMessage(McuTarget::tr("Warning for target %1: missing QulGenerators expected at %2.")
|
||||
.arg(McuSupportOptions::kitName(mcuTarget), generatorsPath.toUserOutput()), false);
|
||||
}
|
||||
|
||||
config.append(CMakeConfigItem("QUL_PLATFORM",
|
||||
mcuTarget->platform().name.toUtf8()));
|
||||
|
||||
@@ -861,8 +889,12 @@ void McuSupportOptions::createAutomaticKits()
|
||||
Sdk::targetsAndPackages(dir, &packages, &mcuTargets);
|
||||
|
||||
for (auto target: qAsConst(mcuTargets))
|
||||
if (target->isValid() && existingKits(target).isEmpty())
|
||||
newKit(target, qtForMCUsPackage);
|
||||
if (existingKits(target).isEmpty()) {
|
||||
if (target->isValid())
|
||||
newKit(target, qtForMCUsPackage);
|
||||
else
|
||||
target->printPackageProblems();
|
||||
}
|
||||
|
||||
qDeleteAll(packages);
|
||||
qDeleteAll(mcuTargets);
|
||||
|
@@ -175,6 +175,7 @@ public:
|
||||
void setColorDepth(int colorDepth);
|
||||
int colorDepth() const;
|
||||
bool isValid() const;
|
||||
void printPackageProblems() const;
|
||||
|
||||
private:
|
||||
const QVersionNumber m_qulVersion;
|
||||
|
@@ -567,7 +567,7 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector<McuPackage *> *packa
|
||||
const McuTargetDescription desc = parseDescriptionJson(file.readAll());
|
||||
if (QVersionNumber::fromString(desc.qulVersion) < McuSupportOptions::minimalQulVersion()) {
|
||||
auto pth = Utils::FilePath::fromString(fileInfo.filePath());
|
||||
printMessage(QObject::tr("Skipped %1 - Unsupported version \"%2\" (should be >= %3)")
|
||||
printMessage(McuTarget::tr("Skipped %1 - Unsupported version \"%2\" (should be >= %3)")
|
||||
.arg(
|
||||
QDir::toNativeSeparators(pth.fileNameWithPathComponents(1)),
|
||||
desc.qulVersion,
|
||||
@@ -580,7 +580,7 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector<McuPackage *> *packa
|
||||
|
||||
// No valid description means invalid SDK installation.
|
||||
if (descriptions.empty() && kitsPath(dir).exists()) {
|
||||
printMessage(QObject::tr("No valid kit descriptions found at %1.").arg(kitsPath(dir).toUserOutput()), true);
|
||||
printMessage(McuTarget::tr("No valid kit descriptions found at %1.").arg(kitsPath(dir).toUserOutput()), true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -611,6 +611,11 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector<McuPackage *> *packa
|
||||
desktopDescription.toolchainId = Utils::HostOsInfo::isWindowsHost() ? QString("msvc") : QString("gcc");
|
||||
desktopDescription.type = McuTargetDescription::TargetType::Desktop;
|
||||
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))),
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user