diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-02-24 15:27:16 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-02-29 12:31:32 +0000 |
commit | a0b15306ea358c9e810bdaa29905c551cd570ac1 (patch) | |
tree | 91da5ef84efa8dc43c832917fc9e13b700e42244 /src/app/qbs-setup-toolchains/msvcprobe.cpp | |
parent | b2cafd6cc4ac8e61b503aed54b0bc3743a0c5a0b (diff) |
setup-toolchains: Allow to set up a single, named MSVC profile.
Change-Id: I42ba3fd646ef488435be90f7e4daa6fb7e83f05f
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/app/qbs-setup-toolchains/msvcprobe.cpp')
-rw-r--r-- | src/app/qbs-setup-toolchains/msvcprobe.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp index 07c583d45..8f4c6acb7 100644 --- a/src/app/qbs-setup-toolchains/msvcprobe.cpp +++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp @@ -38,6 +38,7 @@ #include <logging/translator.h> #include <tools/architectures.h> +#include <tools/error.h> #include <tools/profile.h> #include <tools/settings.h> #include <tools/visualstudioversioninfo.h> @@ -63,9 +64,11 @@ static void writeEnvironment(Profile &p, const QProcessEnvironment &env) } static void addMSVCPlatform(const MSVC &msvc, Settings *settings, QList<Profile> &profiles, - QString name, const QString &installPath, const QString &architecture) + QString name, const QString &installPath, const QString &architecture, + bool appendArchToName = true) { - name.append(QLatin1Char('_') + architecture); + if (appendArchToName) + name.append(QLatin1Char('_') + architecture); qbsInfo() << Tr::tr("Setting up profile '%1'.").arg(name); Profile p(name, settings); p.removeProfile(); @@ -211,3 +214,17 @@ void msvcProbe(Settings *settings, QList<Profile> &profiles) } } } + +void createMsvcProfile(const QString &profileName, const QString &compilerFilePath, + Settings *settings) +{ + MSVC msvc(compilerFilePath); + VsEnvironmentDetector envdetector(&msvc); + if (!envdetector.start()) + throw qbs::ErrorInfo(Tr::tr("Detecting the build environment failed.")); + QList<Profile> dummy; + addMSVCPlatform(msvc, settings, dummy, profileName, msvc.installPath, + msvc.architectures.first(), false); + qbsInfo() << Tr::tr("Profile '%1' created for '%2'.") + .arg(profileName, QDir::toNativeSeparators(compilerFilePath)); +} |