aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/tools/msvcinfo.h
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-05-22 15:37:18 -0700
committerJoerg Bornemann <joerg.bornemann@qt.io>2016-06-27 13:13:52 +0000
commit129e7a8ab1edfb583157db6050ab3f1bd426279e (patch)
tree6f3634e0c1ce07501a1368a774ef62fe1106f065 /src/lib/corelib/tools/msvcinfo.h
parent2ea9e28a6963cae217923d77fd00f581306b1980 (diff)
Determine Visual Studio architecture & build environment automatically.
This moves one step further to making the setup-toolchains tool unnecessary and also makes the toolchainInstallPath of MSVC profiles consistent with what Qt Creator sets. Change-Id: I3eb11b456bf02bde8993ec0dac7e0f9950174a08 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/tools/msvcinfo.h')
-rw-r--r--src/lib/corelib/tools/msvcinfo.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/lib/corelib/tools/msvcinfo.h b/src/lib/corelib/tools/msvcinfo.h
new file mode 100644
index 000000000..8c5c288b6
--- /dev/null
+++ b/src/lib/corelib/tools/msvcinfo.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing
+**
+** This file is part of Qbs.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms and
+** conditions see http://www.qt.io/terms-conditions. For further information
+** use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QBS_MSVCINFO_H
+#define QBS_MSVCINFO_H
+
+#include <logging/translator.h>
+#include <tools/error.h>
+
+#include <QDir>
+#include <QFileInfo>
+#include <QHash>
+#include <QProcessEnvironment>
+#include <QStringList>
+
+namespace qbs {
+namespace Internal {
+
+class Version;
+
+class MSVC
+{
+public:
+ QString version;
+ QString installPath;
+ QString pathPrefix;
+ QStringList architectures;
+
+ typedef QHash<QString, QProcessEnvironment> EnvironmentPerArch;
+ EnvironmentPerArch environments;
+
+ MSVC() { }
+
+ MSVC(const QString &clPath)
+ {
+ QDir parentDir = QFileInfo(clPath).dir();
+ QString arch = parentDir.dirName().toLower();
+ if (arch == QLatin1String("bin"))
+ arch = QString(); // x86
+ else
+ parentDir.cdUp();
+ architectures << arch;
+ installPath = parentDir.path();
+ }
+
+ QString clPath(const QString &arch = QString()) const {
+ return QDir::cleanPath(
+ installPath + QLatin1Char('/') +
+ pathPrefix + QLatin1Char('/') +
+ arch + QLatin1Char('/') +
+ QLatin1String("cl.exe"));
+ }
+
+ QBS_EXPORT QVariantMap compilerDefines(const QString &compilerFilePath) const;
+};
+
+class WinSDK : public MSVC
+{
+public:
+ bool isDefault;
+
+ WinSDK()
+ {
+ pathPrefix = QLatin1String("bin");
+ }
+};
+
+} // namespace Internal
+} // namespace qbs
+
+#endif // QBS_MSVCINFO_H