forked from qt-creator/qt-creator
BareMetal: Auto-detection of IAR toolchain version 9
The Windows registry node containing the installation path of IAR workbench changed since version 9 that is the same as the one for 32-bit Windows host. Multiple registry keys will be used to identify the latest IAR toolchain as well. Task-number: QTCREATORBUG-28245 Change-Id: I92ed0c10a38e081ca45fcf9e543d902a3e98efc2 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -415,10 +415,10 @@ Toolchains IarToolChainFactory::autoDetect(const ToolchainDetector &detector) co
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
||||||
|
QStringList registryNodes;
|
||||||
|
registryNodes << "HKEY_LOCAL_MACHINE\\SOFTWARE\\IAR Systems\\Embedded Workbench";
|
||||||
#ifdef Q_OS_WIN64
|
#ifdef Q_OS_WIN64
|
||||||
static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\IAR Systems\\Embedded Workbench";
|
registryNodes << "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\IAR Systems\\Embedded Workbench";
|
||||||
#else
|
|
||||||
static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\IAR Systems\\Embedded Workbench";
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Dictionary for know toolchains.
|
// Dictionary for know toolchains.
|
||||||
@@ -446,33 +446,35 @@ Toolchains IarToolChainFactory::autoDetect(const ToolchainDetector &detector) co
|
|||||||
{{"EWCR16C"}, {"/cr16c/bin/icccr16c.exe"}},
|
{{"EWCR16C"}, {"/cr16c/bin/icccr16c.exe"}},
|
||||||
};
|
};
|
||||||
|
|
||||||
QSettings registry(kRegistryNode, QSettings::NativeFormat);
|
for (const QString ®istryNode : registryNodes) {
|
||||||
const auto oneLevelGroups = registry.childGroups();
|
QSettings registry(registryNode, QSettings::NativeFormat);
|
||||||
for (const QString &oneLevelKey : oneLevelGroups) {
|
const auto oneLevelGroups = registry.childGroups();
|
||||||
registry.beginGroup(oneLevelKey);
|
for (const QString &oneLevelKey : oneLevelGroups) {
|
||||||
const auto twoLevelGroups = registry.childGroups();
|
registry.beginGroup(oneLevelKey);
|
||||||
for (const Entry &entry : knowToolchains) {
|
const auto twoLevelGroups = registry.childGroups();
|
||||||
if (twoLevelGroups.contains(entry.registryKey)) {
|
for (const Entry &entry : knowToolchains) {
|
||||||
registry.beginGroup(entry.registryKey);
|
if (twoLevelGroups.contains(entry.registryKey)) {
|
||||||
const auto threeLevelGroups = registry.childGroups();
|
registry.beginGroup(entry.registryKey);
|
||||||
for (const QString &threeLevelKey : threeLevelGroups) {
|
const auto threeLevelGroups = registry.childGroups();
|
||||||
registry.beginGroup(threeLevelKey);
|
for (const QString &threeLevelKey : threeLevelGroups) {
|
||||||
QString compilerPath = registry.value("InstallPath").toString();
|
registry.beginGroup(threeLevelKey);
|
||||||
if (!compilerPath.isEmpty()) {
|
QString compilerPath = registry.value("InstallPath").toString();
|
||||||
// Build full compiler path.
|
if (!compilerPath.isEmpty()) {
|
||||||
compilerPath += entry.subExePath;
|
// Build full compiler path.
|
||||||
const FilePath fn = FilePath::fromString(compilerPath);
|
compilerPath += entry.subExePath;
|
||||||
if (compilerExists(fn)) {
|
const FilePath fn = FilePath::fromString(compilerPath);
|
||||||
// Note: threeLevelKey is a guessed toolchain version.
|
if (compilerExists(fn)) {
|
||||||
candidates.push_back({fn, threeLevelKey});
|
// Note: threeLevelKey is a guessed toolchain version.
|
||||||
|
candidates.push_back({fn, threeLevelKey});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
registry.endGroup();
|
||||||
}
|
}
|
||||||
registry.endGroup();
|
registry.endGroup();
|
||||||
}
|
}
|
||||||
registry.endGroup();
|
|
||||||
}
|
}
|
||||||
|
registry.endGroup();
|
||||||
}
|
}
|
||||||
registry.endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
|
|||||||
Reference in New Issue
Block a user