Add qmake support for c++2a
Makes it possible to build user projects and Qt with C++2a. It is not automatically upgraded to yet though. Change-Id: I949ce94871ddc53f21b7265a52b9c0e1370456c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
38deb05109
commit
51bae0331c
@ -139,7 +139,7 @@ Build options:
|
||||
-coverage {trace-pc-guard}
|
||||
Add code coverage instrumentation (Clang only)
|
||||
|
||||
-c++std <edition> .... Select C++ standard <edition> [c++17/c++14/c++11]
|
||||
-c++std <edition> .... Select C++ standard <edition> [c++2a/c++17/c++14/c++11]
|
||||
(Not supported with MSVC 2015)
|
||||
|
||||
-sse2 ................ Use SSE2 instructions [auto]
|
||||
|
@ -339,6 +339,20 @@
|
||||
"qmake": "CONFIG += c++11 c++14 c++1z"
|
||||
}
|
||||
},
|
||||
"c++2a": {
|
||||
"label": "C++2a support",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"head": [
|
||||
"#if __cplusplus > 201703L",
|
||||
"// Compiler claims to support experimental C++2a, trust it",
|
||||
"#else",
|
||||
"# error __cplusplus must be > 201703L (the value for C++17)",
|
||||
"#endif"
|
||||
],
|
||||
"qmake": "CONFIG += c++11 c++14 c++1z c++2a"
|
||||
}
|
||||
},
|
||||
"precompile_header": {
|
||||
"label": "precompiled header support",
|
||||
"type": "compile",
|
||||
@ -911,6 +925,12 @@
|
||||
"condition": "features.c++14 && tests.c++1z",
|
||||
"output": [ "publicFeature", "publicQtConfig" ]
|
||||
},
|
||||
"c++2a": {
|
||||
"label": "C++2a",
|
||||
"autoDetect": false,
|
||||
"condition": "features.c++1z && tests.c++2a",
|
||||
"output": [ "publicFeature", "publicQtConfig" ]
|
||||
},
|
||||
"c89": {
|
||||
"label": "C89"
|
||||
},
|
||||
@ -1413,7 +1433,7 @@ Configure with '-qreal float' to create a build that is binary-compatible with 5
|
||||
{
|
||||
"message": "Using C++ standard",
|
||||
"type": "firstAvailableFeature",
|
||||
"args": "c++1z c++14 c++11"
|
||||
"args": "c++2a c++1z c++14 c++11"
|
||||
},
|
||||
{
|
||||
"type": "feature",
|
||||
|
@ -20,12 +20,20 @@ defineTest(qtConfCommandline_cxxstd) {
|
||||
!contains(val, "^-.*"):!isEmpty(val) {
|
||||
contains(val, "(c\+\+)?11") {
|
||||
qtConfCommandlineSetInput("c++14", "no")
|
||||
qtConfCommandlineSetInput("c++1z", "no")
|
||||
qtConfCommandlineSetInput("c++2a", "no")
|
||||
} else: contains(val, "(c\+\+)?(14|1y)") {
|
||||
qtConfCommandlineSetInput("c++14", "yes")
|
||||
qtConfCommandlineSetInput("c++1z", "no")
|
||||
qtConfCommandlineSetInput("c++2a", "no")
|
||||
} else: contains(val, "(c\+\+)?(17|1z)") {
|
||||
qtConfCommandlineSetInput("c++14", "yes")
|
||||
qtConfCommandlineSetInput("c++1z", "yes")
|
||||
qtConfCommandlineSetInput("c++2a", "no")
|
||||
} else: contains(val, "(c\+\+)?(2a)") {
|
||||
qtConfCommandlineSetInput("c++14", "yes")
|
||||
qtConfCommandlineSetInput("c++1z", "yes")
|
||||
qtConfCommandlineSetInput("c++2a", "yes")
|
||||
} else {
|
||||
qtConfAddError("Invalid argument $$val to command line parameter $$arg")
|
||||
}
|
||||
|
@ -31,9 +31,11 @@ QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
|
||||
QMAKE_CXXFLAGS_CXX11 = -std=c++11
|
||||
QMAKE_CXXFLAGS_CXX14 = -std=c++1y
|
||||
QMAKE_CXXFLAGS_CXX1Z = -std=c++1z
|
||||
QMAKE_CXXFLAGS_CXX2A = -std=c++2a
|
||||
QMAKE_CXXFLAGS_GNUCXX11 = -std=gnu++11
|
||||
QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++1y
|
||||
QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z
|
||||
QMAKE_CXXFLAGS_GNUCXX2A = -std=gnu++2a
|
||||
|
||||
QMAKE_LFLAGS_CXX11 =
|
||||
QMAKE_LFLAGS_CXX14 =
|
||||
|
@ -32,9 +32,11 @@ QMAKE_CFLAGS_GNUC11 = -std=gnu11
|
||||
QMAKE_CXXFLAGS_CXX11 = -std=c++11
|
||||
QMAKE_CXXFLAGS_CXX14 = -std=c++1y
|
||||
QMAKE_CXXFLAGS_CXX1Z = -std=c++1z
|
||||
QMAKE_CXXFLAGS_CXX2A = -std=c++2a
|
||||
QMAKE_CXXFLAGS_GNUCXX11 = -std=gnu++11
|
||||
QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++1y
|
||||
QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z
|
||||
QMAKE_CXXFLAGS_GNUCXX2A = -std=gnu++2a
|
||||
QMAKE_LFLAGS_CXX11 =
|
||||
QMAKE_LFLAGS_CXX14 =
|
||||
QMAKE_LFLAGS_CXX1Z =
|
||||
|
@ -116,6 +116,8 @@ greaterThan(QMAKE_MSC_VER, 1910) {
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
!isEmpty(COMPAT_MKSPEC):!$$COMPAT_MKSPEC: CONFIG += $$COMPAT_MKSPEC
|
||||
|
@ -121,15 +121,16 @@ breakpad {
|
||||
|
||||
c++17: CONFIG += c++1z
|
||||
|
||||
!c++11:!c++14:!c++1z {
|
||||
!c++11:!c++14:!c++1z:!c++2a {
|
||||
# Qt requires C++11 since 5.7, check if we need to force a compiler option
|
||||
QT_COMPILER_STDCXX_no_L = $$replace(QT_COMPILER_STDCXX, "L$", "")
|
||||
!greaterThan(QT_COMPILER_STDCXX_no_L, 199711): CONFIG += c++11
|
||||
}
|
||||
c++11|c++14|c++1z {
|
||||
c++11|c++14|c++1z|c++2a {
|
||||
# Disable special compiler flags for host builds
|
||||
!host_build|!cross_compile {
|
||||
c++1z: cxxstd = CXX1Z
|
||||
c++2a: cxxstd = CXX2A
|
||||
else: c++1z: cxxstd = CXX1Z
|
||||
else: c++14: cxxstd = CXX14
|
||||
else: cxxstd = CXX11
|
||||
} else {
|
||||
|
@ -17,6 +17,7 @@ DEFINES *= QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
|
||||
qtConfig(c++11): CONFIG += c++11 strict_c++
|
||||
qtConfig(c++14): CONFIG += c++14
|
||||
qtConfig(c++1z): CONFIG += c++1z
|
||||
qtConfig(c++2a): CONFIG += c++2a
|
||||
qtConfig(c99): CONFIG += c99
|
||||
qtConfig(c11): CONFIG += c11
|
||||
qtConfig(stack-protector-strong): CONFIG += stack_protector_strong
|
||||
|
Loading…
Reference in New Issue
Block a user