8780fbb2eb
*Not* using /permissive- exposes Qt and client apps to interesting
bugs and/or build failures, (e.g. QTBUG-87225, or
19b5520abf
). We demand strict
conformance by any other compiler, it's time to demand it from
MSVC too.
The Windows headers themselves are clean starting from the
Windows Fall Creators SDK (10.0.16299.0), and moreover Qt 6 will
drop WinRT; therefore, the comment in the mkspecs does not apply
any more.
Since /permissive- implies /Zc:referenceBinding, drop that
option. The other implied options are set on MSVC < 2017,
but I leave them in to avoid tinkering with the fragile lists
of C/C++ flags.
Rename the CMake internal helper function to better describe
what it does.
Fixes: QTBUG-85633
Fixes: QTBUG-85637
Fixes: QTBUG-85635
Fixes: QTBUG-88244
Change-Id: Ie03fddb61aa066fdc14b7231c22e7108b4a02fbb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
121 lines
3.8 KiB
Plaintext
121 lines
3.8 KiB
Plaintext
#
|
|
# qmake configuration for Microsoft Visual Studio C/C++ Compiler
|
|
# This file is used by win32-msvc
|
|
#
|
|
|
|
#
|
|
# Version-specific changes
|
|
#
|
|
|
|
isEmpty(QMAKE_MSC_VER): error("msvc-version.conf loaded but QMAKE_MSC_VER isn't set")
|
|
|
|
MSVC_VER = 8.0
|
|
COMPAT_MKSPEC = win32-msvc2005
|
|
|
|
greaterThan(QMAKE_MSC_VER, 1499) {
|
|
# Visual Studio 2008 (9.0) / Visual C++ 15.0 and up
|
|
MSVC_VER = 9.0
|
|
COMPAT_MKSPEC = win32-msvc2008
|
|
QMAKE_CFLAGS_MP = -MP
|
|
QMAKE_CXXFLAGS_MP = $$QMAKE_CFLAGS_MP
|
|
}
|
|
|
|
greaterThan(QMAKE_MSC_VER, 1599) {
|
|
# Visual Studio 2010 (10.0) / Visual C++ 16.0 and up
|
|
MSVC_VER = 10.0
|
|
COMPAT_MKSPEC = win32-msvc2010
|
|
MAKEFILE_GENERATOR = MSBUILD
|
|
|
|
QMAKE_CFLAGS_AVX = -arch:AVX
|
|
QMAKE_CFLAGS_AVX2 = -arch:AVX
|
|
|
|
VCPROJ_EXTENSION = .vcxproj
|
|
}
|
|
|
|
greaterThan(QMAKE_MSC_VER, 1699) {
|
|
# Visual Studio 2012 (11.0) / Visual C++ 17.0 and up
|
|
MSVC_VER = 11.0
|
|
COMPAT_MKSPEC = win32-msvc2012
|
|
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = /wd4530 /wd4577
|
|
QT_CONFIG += c++11
|
|
CONFIG += c++11
|
|
}
|
|
|
|
greaterThan(QMAKE_MSC_VER, 1799) {
|
|
# Visual Studio 2013 (12.0) / Visual C++ 18.0 and up
|
|
MSVC_VER = 12.0
|
|
COMPAT_MKSPEC = win32-msvc2013
|
|
QMAKE_CFLAGS += -FS
|
|
QMAKE_CXXFLAGS += -FS -Zc:rvalueCast -Zc:inline
|
|
|
|
QMAKE_CFLAGS_F16C = -arch:AVX
|
|
QMAKE_CFLAGS_RDRND =
|
|
QMAKE_CFLAGS_RDSEED =
|
|
|
|
equals(QMAKE_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(QMAKE_MSC_VER, 1899) {
|
|
# Visual Studio 2015 (14.0) / Visual C++ 19.0 and up
|
|
MSVC_VER = 14.0
|
|
COMPAT_MKSPEC = win32-msvc2015
|
|
QMAKE_CFLAGS += -Zc:strictStrings
|
|
QMAKE_CFLAGS_WARN_ON += -w44456 -w44457 -w44458
|
|
QMAKE_CFLAGS_AVX2 = -arch:AVX2
|
|
QMAKE_CXXFLAGS += -Zc:strictStrings -Zc:throwingNew
|
|
QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 -wd4467
|
|
|
|
# -utf-8 compiler option for Visual Studio 2015 Update 2
|
|
greaterThan(QMAKE_MSC_FULL_VER, 190023918): QMAKE_CFLAGS_UTF8_SOURCE = -utf-8
|
|
}
|
|
|
|
greaterThan(QMAKE_MSC_VER, 1909) {
|
|
# Visual Studio 2017 (15.0) / Visual C++ 19.10 and up
|
|
MSVC_VER = 15.0
|
|
COMPAT_MKSPEC = win32-msvc2017
|
|
QMAKE_CXXFLAGS += -permissive-
|
|
|
|
# Only Visual Studio 2017 version 15.3 / Visual C++ 19.11 & up have support
|
|
# for AVX-512. We enable the switches anyway and let configure check if they
|
|
# work.
|
|
QMAKE_CFLAGS_AVX512F = -arch:AVX512
|
|
QMAKE_CFLAGS_AVX512ER = -arch:AVX512
|
|
QMAKE_CFLAGS_AVX512CD = -arch:AVX512
|
|
QMAKE_CFLAGS_AVX512PF = -arch:AVX512
|
|
QMAKE_CFLAGS_AVX512DQ = -arch:AVX512
|
|
QMAKE_CFLAGS_AVX512BW = -arch:AVX512
|
|
QMAKE_CFLAGS_AVX512VL = -arch:AVX512
|
|
QMAKE_CFLAGS_AVX512IFMA = -arch:AVX512
|
|
QMAKE_CFLAGS_AVX512VBMI = -arch:AVX512
|
|
|
|
# MSVC partially supports the following, but '__cplusplus' definition is set
|
|
# as for C++98 until MSVC fully conforms with C++14, see
|
|
# https://developercommunity.visualstudio.com/content/problem/139261/msvc-incorrectly-defines-cplusplus.html
|
|
# Support became available in MSVC 2017 15.7:
|
|
greaterThan(QMAKE_MSC_VER, 1913) {
|
|
QMAKE_CXXFLAGS += -Zc:__cplusplus
|
|
QMAKE_CXXFLAGS_CXX14 = -std:c++14
|
|
QMAKE_CXXFLAGS_CXX1Z = -std:c++17
|
|
}
|
|
}
|
|
|
|
greaterThan(QMAKE_MSC_VER, 1910) {
|
|
# No compat spec past MSVC 2017
|
|
COMPAT_MKSPEC =
|
|
}
|
|
|
|
greaterThan(QMAKE_MSC_VER, 1919) {
|
|
# Visual Studio 2019 (16.0) / Visual C++ 19.20 and up
|
|
MSVC_VER = 16.0
|
|
QMAKE_CXXFLAGS_CXX2A = -std:c++latest
|
|
|
|
QMAKE_CXXFLAGS += -Zc:externConstexpr
|
|
}
|
|
|
|
!isEmpty(COMPAT_MKSPEC):!$$COMPAT_MKSPEC: CONFIG += $$COMPAT_MKSPEC
|