diff options
author | Kwangsub Kim <kwangsub.kim@qt.io> | 2022-11-09 16:51:43 +0100 |
---|---|---|
committer | Kwangsub Kim <kwangsub.kim@qt.io> | 2022-12-07 16:37:34 +0000 |
commit | b4015fc345416f2c15a1d95e36287936e9438b02 (patch) | |
tree | 205ff5dd02646baba25ffae8c00bc07bcd455deb | |
parent | ea01c74d50c2ef9f96a8aea6cf9bdf30f3c7156d (diff) |
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>
-rw-r--r-- | src/plugins/baremetal/iarewtoolchain.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/plugins/baremetal/iarewtoolchain.cpp b/src/plugins/baremetal/iarewtoolchain.cpp index 6972a92bd9b..d75610681c3 100644 --- a/src/plugins/baremetal/iarewtoolchain.cpp +++ b/src/plugins/baremetal/iarewtoolchain.cpp @@ -415,10 +415,10 @@ Toolchains IarToolChainFactory::autoDetect(const ToolchainDetector &detector) co #ifdef Q_OS_WIN + QStringList registryNodes; + registryNodes << "HKEY_LOCAL_MACHINE\\SOFTWARE\\IAR Systems\\Embedded Workbench"; #ifdef Q_OS_WIN64 - static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\IAR Systems\\Embedded Workbench"; -#else - static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\IAR Systems\\Embedded Workbench"; + registryNodes << "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\IAR Systems\\Embedded Workbench"; #endif // Dictionary for know toolchains. @@ -446,33 +446,35 @@ Toolchains IarToolChainFactory::autoDetect(const ToolchainDetector &detector) co {{"EWCR16C"}, {"/cr16c/bin/icccr16c.exe"}}, }; - QSettings registry(kRegistryNode, QSettings::NativeFormat); - const auto oneLevelGroups = registry.childGroups(); - for (const QString &oneLevelKey : oneLevelGroups) { - registry.beginGroup(oneLevelKey); - const auto twoLevelGroups = registry.childGroups(); - for (const Entry &entry : knowToolchains) { - if (twoLevelGroups.contains(entry.registryKey)) { - registry.beginGroup(entry.registryKey); - const auto threeLevelGroups = registry.childGroups(); - for (const QString &threeLevelKey : threeLevelGroups) { - registry.beginGroup(threeLevelKey); - QString compilerPath = registry.value("InstallPath").toString(); - if (!compilerPath.isEmpty()) { - // Build full compiler path. - compilerPath += entry.subExePath; - const FilePath fn = FilePath::fromString(compilerPath); - if (compilerExists(fn)) { - // Note: threeLevelKey is a guessed toolchain version. - candidates.push_back({fn, threeLevelKey}); + for (const QString ®istryNode : registryNodes) { + QSettings registry(registryNode, QSettings::NativeFormat); + const auto oneLevelGroups = registry.childGroups(); + for (const QString &oneLevelKey : oneLevelGroups) { + registry.beginGroup(oneLevelKey); + const auto twoLevelGroups = registry.childGroups(); + for (const Entry &entry : knowToolchains) { + if (twoLevelGroups.contains(entry.registryKey)) { + registry.beginGroup(entry.registryKey); + const auto threeLevelGroups = registry.childGroups(); + for (const QString &threeLevelKey : threeLevelGroups) { + registry.beginGroup(threeLevelKey); + QString compilerPath = registry.value("InstallPath").toString(); + if (!compilerPath.isEmpty()) { + // Build full compiler path. + compilerPath += entry.subExePath; + const FilePath fn = FilePath::fromString(compilerPath); + if (compilerExists(fn)) { + // Note: threeLevelKey is a guessed toolchain version. + candidates.push_back({fn, threeLevelKey}); + } } + registry.endGroup(); } registry.endGroup(); } - registry.endGroup(); } + registry.endGroup(); } - registry.endGroup(); } #endif // Q_OS_WIN |