diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-01-30 17:00:00 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-02-01 11:36:19 +0000 |
commit | a2342fa492207d45a2f99ae2b5ebcaf0e3ab91df (patch) | |
tree | ec3577e2e4ae5edd9855db0043aed56d568d6896 | |
parent | 0fd3b3d60db73843c386c46ac060f9a8bff6bba1 (diff) | |
download | qt-creator-a2342fa492207d45a2f99ae2b5ebcaf0e3ab91df.tar.gz |
MsvcToolChain: Detect Microsoft Visual C++ Build Tools.
Check the standard installation location of the Microsoft
Visual C C++ Build Tools introduced with MSVC2015 for the
presence of the bat file and add the toolchains.
Change-Id: Ia2b7770ed50c51132c88330ff1448900b0b06c1e
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
-rw-r--r-- | src/plugins/projectexplorer/msvctoolchain.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 16633ecc4e..4709d3197f 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -545,6 +545,45 @@ static ToolChain *findOrCreateToolChain(const QList<ToolChain *> &alreadyKnown, return tc; } +// Detect build tools introduced with MSVC2015 +static void detectCppBuildTools(QList<ToolChain *> *list) +{ + struct Entry { + const char *postFix; + const char *varsBatArg; + Abi::Architecture architecture; + Abi::BinaryFormat format; + unsigned char wordSize; + }; + + const Entry entries[] = { + {" (x86)", "x86", Abi::X86Architecture, Abi::PEFormat, 32}, + {" (x64)", "amd64", Abi::X86Architecture, Abi::PEFormat, 64}, + {" (x86_arm)", "x86_arm", Abi::ArmArchitecture, Abi::PEFormat, 32}, + {" (x64_arm)", "amd64_arm", Abi::ArmArchitecture, Abi::PEFormat, 64} + }; + +#ifdef Q_OS_WIN64 + const char programFilesC[] = "ProgramFiles(x86)"; +#else + const char programFilesC[] = "ProgramFiles"; +#endif + const QString name = QStringLiteral("Microsoft Visual C++ Build Tools"); + const QString vcVarsBat = QFile::decodeName(qgetenv(programFilesC)) + + QLatin1Char('/') + name + QStringLiteral("/vcbuildtools.bat"); + if (!QFileInfo(vcVarsBat).isFile()) + return; + const size_t count = sizeof(entries) / sizeof(entries[0]); + for (size_t i = 0; i < count; ++i) { + const Entry &e = entries[i]; + const Abi abi(e.architecture, Abi::WindowsOS, Abi::WindowsMsvc2015Flavor, + e.format, e.wordSize); + list->append(new MsvcToolChain(name + QLatin1String(e.postFix), abi, + vcVarsBat, QLatin1String(e.varsBatArg), + ToolChain::AutoDetection)); + } +} + QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown) { QList<ToolChain *> results; @@ -635,6 +674,8 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &al } } + detectCppBuildTools(&results); + return results; } |