diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2019-05-16 17:08:38 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2019-05-17 12:43:26 +0000 |
commit | c3f90175c38969c05bcdabac67fb6a590679bbf3 (patch) | |
tree | c5cf2d2a9fbc134c390b09913a8c7024c33f431d /src/app/qbs-setup-toolchains/probe.cpp | |
parent | b2bd149c776b9c7ab399ed132c7c89472f4b59ff (diff) |
bare-metal: Improve the SDCC toolchain auto detection
Now the SDCC compiler path also extracts from the Windows
registry in addition to the path feature.
Change-Id: I84148e464696fdfffc6342d22baa1d75c6caa0ce
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/app/qbs-setup-toolchains/probe.cpp')
-rw-r--r-- | src/app/qbs-setup-toolchains/probe.cpp | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/src/app/qbs-setup-toolchains/probe.cpp b/src/app/qbs-setup-toolchains/probe.cpp index af46d451b..df617da23 100644 --- a/src/app/qbs-setup-toolchains/probe.cpp +++ b/src/app/qbs-setup-toolchains/probe.cpp @@ -40,6 +40,7 @@ #include "clangclprobe.h" #include "msvcprobe.h" +#include "sdccprobe.h" #include "xcodeprobe.h" #include <logging/translator.h> @@ -132,18 +133,6 @@ static bool isKeilCompiler(const QString &compilerName) }); } -static QStringList knownSdccCompilerNames() -{ - return {QStringLiteral("sdcc")}; -} - -static bool isSdccCompiler(const QString &compilerName) -{ - return Internal::any_of(knownSdccCompilerNames(), [compilerName](const QString &knownName) { - return compilerName.contains(knownName); - }); -} - static QStringList toolchainTypeFromCompilerName(const QString &compilerName) { if (compilerName == QLatin1String("cl.exe")) @@ -345,35 +334,6 @@ static Profile createKeilProfile(const QFileInfo &compiler, Settings *settings, return profile; } -static QString guessSdccArchitecture(const QFileInfo &compiler) -{ - const auto baseName = compiler.baseName(); - if (baseName == QLatin1String("sdcc")) - return QStringLiteral("mcs51"); - return {}; -} - -static Profile createSdccProfile(const QFileInfo &compiler, Settings *settings, - QString profileName = QString()) -{ - const QString architecture = guessSdccArchitecture(compiler); - - // In case the profile is auto-detected. - if (profileName.isEmpty()) - profileName = QLatin1String("sdcc-") + architecture; - - Profile profile(profileName, settings); - profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), compiler.absolutePath()); - profile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("sdcc")); - if (!architecture.isEmpty()) - profile.setValue(QStringLiteral("qbs.architecture"), architecture); - - qStdout << Tr::tr("Profile '%1' created for '%2'.").arg( - profile.name(), compiler.absoluteFilePath()) - << endl; - return profile; -} - static void gccProbe(Settings *settings, QList<Profile> &profiles, const QString &compilerName) { qStdout << Tr::tr("Trying to detect %1...").arg(compilerName) << endl; @@ -450,25 +410,6 @@ static void keilProbe(Settings *settings, QList<Profile> &profiles) qStdout << Tr::tr("No KEIL toolchains found.") << endl; } -static void sdccProbe(Settings *settings, QList<Profile> &profiles) -{ - qStdout << Tr::tr("Trying to detect SDCC toolchains...") << endl; - - bool isFound = false; - const auto compilerNames = knownSdccCompilerNames(); - for (const QString &compilerName : compilerNames) { - const QString sdccPath = findExecutable(HostOsInfo::appendExecutableSuffix(compilerName)); - if (!sdccPath.isEmpty()) { - const auto profile = createSdccProfile(sdccPath, settings); - profiles.push_back(profile); - isFound = true; - } - } - - if (!isFound) - qStdout << Tr::tr("No SDCC toolchains found.") << endl; -} - void probe(Settings *settings) { QList<Profile> profiles; |