diff options
author | Ivan Komissarov <ABBAPOH@gmail.com> | 2019-03-19 22:24:33 +0100 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2019-04-10 07:27:02 +0000 |
commit | 62e07306481373d9d9b6b656d855b204aa6964f3 (patch) | |
tree | dac1f681be32eaba98b117a481a9011500af9b91 /src/app/qbs-setup-toolchains/msvcprobe.cpp | |
parent | 14324ad4aa9582e07dc687dc63b1b886f2d272e5 (diff) |
Add support for the clang-cl compiler
Task-number: QBS-1316
Change-Id: Ibf9da364610c260ead088a8990a70c7739d53c39
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/app/qbs-setup-toolchains/msvcprobe.cpp')
-rw-r--r-- | src/app/qbs-setup-toolchains/msvcprobe.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp index faacb4d09..d0b60a7fe 100644 --- a/src/app/qbs-setup-toolchains/msvcprobe.cpp +++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp @@ -160,12 +160,6 @@ static QString wow6432Key() #endif } -struct MSVCInstallInfo -{ - QString version; - QString installDir; -}; - static QString vswhereFilePath() { static const std::vector<const char *> envVarCandidates{"ProgramFiles", "ProgramFiles(x86)"}; @@ -288,7 +282,28 @@ static std::vector<MSVCInstallInfo> installedMSVCsFromRegistry() return result; } -static std::vector<MSVC> installedMSVCs() +QString MSVCInstallInfo::findVcvarsallBat() const +{ + static const auto vcvarsall2017 = QStringLiteral("VC/Auxiliary/Build/vcvarsall.bat"); + // 2015, 2013 and 2012 + static const auto vcvarsallOld = QStringLiteral("VC/vcvarsall.bat"); + QDir dir(installDir); + if (dir.exists(vcvarsall2017)) + return dir.absoluteFilePath(vcvarsall2017); + if (dir.exists(vcvarsallOld)) + return dir.absoluteFilePath(vcvarsallOld); + return {}; +} + +std::vector<MSVCInstallInfo> installedMSVCs() +{ + const auto installInfos = installedMSVCsFromVsWhere(); + if (installInfos.empty()) + return installedMSVCsFromRegistry(); + return installInfos; +} + +static std::vector<MSVC> installedCompilers() { std::vector<MSVC> msvcs; std::vector<MSVCInstallInfo> installInfos = installedMSVCsFromVsWhere(); @@ -385,7 +400,7 @@ void msvcProbe(Settings *settings, QList<Profile> &profiles) // 2) Installed MSVCs std::vector<MSVC> msvcs; - const auto instMsvcs = installedMSVCs(); + const auto instMsvcs = installedCompilers(); for (const MSVC &msvc : instMsvcs) { if (msvc.internalVsVersion.majorVersion() < 15) { // Check existence of various install scripts @@ -452,7 +467,7 @@ void msvcProbe(Settings *settings, QList<Profile> &profiles) void createMsvcProfile(const QString &profileName, const QString &compilerFilePath, Settings *settings) { - MSVC msvc(compilerFilePath); + MSVC msvc(compilerFilePath, MSVC::architectureFromClPath(compilerFilePath)); msvc.init(); QList<Profile> dummy; addMSVCPlatform(settings, dummy, profileName, &msvc); |