From ce1c53b4130495b17addc45bf3f5b2a2dc052507 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Jun 2014 15:52:49 -0700 Subject: Add detection of and support for Visual Studio 2015 Tested with the Preview release of November 2014. Differences to the 2013 detection and support: - Option -Zc:strictStrings is present in both debug and release mode and is passed to qmake's own build - New warnings 4456, 4457 and 4458 (shadowing) are disabled - Compiler supports -arch:AVX2 Change-Id: I9572ff4d4aded4004c1fa5d6f13ffee5462043d6 Reviewed-by: Joerg Bornemann --- mkspecs/common/msvc-desktop.conf | 20 ++++++++++++++++---- mkspecs/win32-msvc2015/qmake.conf | 11 +++++++++++ mkspecs/win32-msvc2015/qplatformdefs.h | 34 ++++++++++++++++++++++++++++++++++ qmake/Makefile.win32 | 4 +++- tools/configure/configureapp.cpp | 3 ++- tools/configure/environment.cpp | 8 ++++++++ tools/configure/environment.h | 3 ++- 7 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 mkspecs/win32-msvc2015/qmake.conf create mode 100644 mkspecs/win32-msvc2015/qplatformdefs.h diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf index 044d21e426..bae8c7f267 100644 --- a/mkspecs/common/msvc-desktop.conf +++ b/mkspecs/common/msvc-desktop.conf @@ -123,10 +123,22 @@ greaterThan(MSC_VER, 1799) { # Visual Studio 2013 (12.0) / Visual C++ 18.0 and up QMAKE_CFLAGS += -FS QMAKE_CXXFLAGS += -FS - QMAKE_CFLAGS_RELEASE += -Zc:strictStrings - QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings - QMAKE_CXXFLAGS_RELEASE += -Zc:strictStrings - QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings + + equals(MSC_VER, 1800) { + QMAKE_CFLAGS_RELEASE += -Zc:strictStrings + QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings + QMAKE_CXXFLAGS_RELEASE += -Zc:strictStrings + QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings + } +} + +greaterThan(MSC_VER, 1899) { + # Visual Studio 2015 (14.0) / Visual C++ 19.0 and up + QMAKE_CFLAGS += -Zc:strictStrings + QMAKE_CFLAGS_WARN_ON += -w44456 -w44457 -w44458 + QMAKE_CFLAGS_AVX2 = -arch:AVX2 + QMAKE_CXXFLAGS += -Zc:strictStrings + QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 } unset(MSC_VER) diff --git a/mkspecs/win32-msvc2015/qmake.conf b/mkspecs/win32-msvc2015/qmake.conf new file mode 100644 index 0000000000..617adb681c --- /dev/null +++ b/mkspecs/win32-msvc2015/qmake.conf @@ -0,0 +1,11 @@ +# +# qmake configuration for win32-msvc2015 +# +# Written for Microsoft Visual C++ 2015 +# + +MSC_VER = 1900 +MSVC_VER = 14.0 +include(../common/msvc-desktop.conf) +include(../common/shell-win32.conf) +load(qt_config) diff --git a/mkspecs/win32-msvc2015/qplatformdefs.h b/mkspecs/win32-msvc2015/qplatformdefs.h new file mode 100644 index 0000000000..feb5ba5b80 --- /dev/null +++ b/mkspecs/win32-msvc2015/qplatformdefs.h @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../win32-msvc2005/qplatformdefs.h" diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index ebadd52f99..c8d63eb662 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -1,4 +1,4 @@ -!IF "$(QMAKESPEC)" == "win32-msvc" || "$(QMAKESPEC)" == "win32-msvc.net" || "$(QMAKESPEC)" == "win32-msvc2002" || "$(QMAKESPEC)" == "win32-msvc2003" || "$(QMAKESPEC)" == "win32-msvc2005" || "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-msvc2013" || "$(QMAKESPEC)" == "win32-icc" +!IF "$(QMAKESPEC)" == "win32-msvc" || "$(QMAKESPEC)" == "win32-msvc.net" || "$(QMAKESPEC)" == "win32-msvc2002" || "$(QMAKESPEC)" == "win32-msvc2003" || "$(QMAKESPEC)" == "win32-msvc2005" || "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-msvc2013" || "$(QMAKESPEC)" == "win32-msvc2015" || "$(QMAKESPEC)" == "win32-icc" !if "$(SOURCE_PATH)" == "" SOURCE_PATH = .. @@ -28,6 +28,8 @@ LINKER = link CFLAGS_EXTRA = /Zc:wchar_t- !elseif "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-msvc2013" CFLAGS_EXTRA = /MP /D_CRT_SECURE_NO_WARNINGS $(CFLAGS_CRT) +!elseif "$(QMAKESPEC)" == "win32-msvc2015" +CFLAGS_EXTRA = /MP /D_CRT_SECURE_NO_WARNINGS /Zc:strictStrings /w44456 /w44457 /w44458 $(CFLAGS_CRT) !endif CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 7ed8f8dfe3..14bc8455c7 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1379,7 +1379,8 @@ void Configure::parseCmdLine() dictionary[ "QMAKESPEC" ].endsWith("-msvc2008") || dictionary[ "QMAKESPEC" ].endsWith("-msvc2010") || dictionary[ "QMAKESPEC" ].endsWith("-msvc2012") || - dictionary[ "QMAKESPEC" ].endsWith("-msvc2013")) { + dictionary[ "QMAKESPEC" ].endsWith("-msvc2013") || + dictionary[ "QMAKESPEC" ].endsWith("-msvc2015")) { if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake"; dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32"; } else if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) { diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 494b10e554..6eb0107098 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -78,6 +78,9 @@ struct CompilerInfo{ {CC_MSVC2012, "Microsoft (R) Visual Studio 2012 C/C++ Compiler (11.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\11.0", "cl.exe"}, // link.exe, lib.exe {CC_MSVC2013, "Microsoft (R) Visual Studio 2013 C/C++ Compiler (12.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0", "cl.exe"}, // link.exe, lib.exe {CC_MSVC2013, "Microsoft (R) Visual Studio 2013 C/C++ Compiler (12.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0", "cl.exe"}, // link.exe, lib.exe + // Microsoft skipped version 13 + {CC_MSVC2015, "Microsoft (R) Visual Studio 2015 C/C++ Compiler (14.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VS7\\14.0", "cl.exe"}, // link.exe, lib.exe + {CC_MSVC2015, "Microsoft (R) Visual Studio 2015 C/C++ Compiler (14.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VS7\\14.0", "cl.exe"}, // link.exe, lib.exe {CC_UNKNOWN, "Unknown", 0, 0}, }; @@ -103,6 +106,9 @@ QString Environment::detectQMakeSpec() { QString spec; switch (detectCompiler()) { + case CC_MSVC2015: + spec = "win32-msvc2015"; + break; case CC_MSVC2013: spec = "win32-msvc2013"; break; @@ -136,6 +142,8 @@ QString Environment::detectQMakeSpec() Compiler Environment::compilerFromQMakeSpec(const QString &qmakeSpec) { + if (qmakeSpec == QLatin1String("win32-msvc2015")) + return CC_MSVC2015; if (qmakeSpec == QLatin1String("win32-msvc2013")) return CC_MSVC2013; if (qmakeSpec == QLatin1String("win32-msvc2012")) diff --git a/tools/configure/environment.h b/tools/configure/environment.h index 446f5212f7..8d2aed13f1 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -45,7 +45,8 @@ enum Compiler { CC_MSVC2008 = 0x90, CC_MSVC2010 = 0xA0, CC_MSVC2012 = 0xB0, - CC_MSVC2013 = 0xC0 + CC_MSVC2013 = 0xC0, + CC_MSVC2015 = 0xD0 }; struct CompilerInfo; -- cgit v1.2.3