From 56dc926b9d8d97439c96a7b5db581621431207b5 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Mon, 15 Jul 2019 17:43:48 +0300 Subject: [PATCH] ProjectExplorer: Auto-detect GNU toolchains provided by AtmelStudio v7 A latest AtmelStudio v7 contains the GNU toolchains in an other directories (against to Atmel Studio v6). This patch takes it into account to detect a provided toolchains. Change-Id: Ife239abca8a513f2fd6652363d1fff049cf16397 Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/gcctoolchain.cpp | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index a0a9583e6fd..8d749ea79a3 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -900,6 +900,9 @@ static Utils::FilePathList atmelSearchPathsFromRegistry() Utils::FilePathList searchPaths; QSettings registry(kRegistryToken, QSettings::NativeFormat); + + // This code enumerate the installed toolchains provided + // by the Atmel Studio v6.x. const auto toolchainGroups = registry.childGroups(); for (const QString &toolchainKey : toolchainGroups) { if (!toolchainKey.endsWith("GCC")) @@ -936,6 +939,31 @@ static Utils::FilePathList atmelSearchPathsFromRegistry() registry.endGroup(); } + // This code enumerate the installed toolchains provided + // by the Atmel Studio v7. + registry.beginGroup("AtmelStudio"); + const auto productVersions = registry.childGroups(); + for (const auto &productVersionKey : productVersions) { + registry.beginGroup(productVersionKey); + const QString installDir = registry.value("InstallDir").toString(); + registry.endGroup(); + + const QStringList knownToolchainSubdirs = { + "/toolchain/arm/arm-gnu-toolchain/bin/", + "/toolchain/avr8/avr8-gnu-toolchain/bin/", + "/toolchain/avr32/avr32-gnu-toolchain/bin/", + }; + + for (const auto &subdir : knownToolchainSubdirs) { + const QString toolchainPath = installDir + subdir; + const FilePath path = FilePath::fromString(toolchainPath); + if (!path.exists()) + continue; + searchPaths.push_back(path); + } + } + registry.endGroup(); + return searchPaths; }