qmake: Add support for C++23
Add the CONFIG value c++2b that represent the upcoming C++23 standard. Add QMAKE_CXXFLAGS_CXX2B and QMAKE_CXXFLAGS_GNUCXX2B. On MSVC, use /std:c++latest when c++2b is active. Task-number: QTBUG-102202 Change-Id: Ie00ee5793c1a649195013c8c19efc8d59cf0acc9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit b5ed3cb7baeb6d77c375134719ee04ffcc211b9f) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
bdaef58214
commit
5b165f11bc
@ -142,7 +142,7 @@ Build options:
|
||||
sanitizers or generate instrumented code to collect execution
|
||||
counts and enable code coverage analysis, respectively. (Clang only)
|
||||
|
||||
-c++std <edition> .... Select C++ standard <edition> [c++2a/c++17/c++14/c++11]
|
||||
-c++std <edition> .... Select C++ standard <edition> [c++2b/c++2a/c++17/c++14/c++11]
|
||||
(Not supported with MSVC 2015)
|
||||
|
||||
-sse2 ................ Use SSE2 instructions [auto]
|
||||
|
@ -380,6 +380,20 @@
|
||||
"qmake": "CONFIG += c++11 c++14 c++17 c++2a"
|
||||
}
|
||||
},
|
||||
"cxx2b": {
|
||||
"label": "C++2b support",
|
||||
"type": "compile",
|
||||
"test": {
|
||||
"head": [
|
||||
"#if __cplusplus > 202002L",
|
||||
"// Compiler claims to support experimental C++2b, trust it",
|
||||
"#else",
|
||||
"# error __cplusplus must be > 202002L (the value for C++20)",
|
||||
"#endif"
|
||||
],
|
||||
"qmake": "CONFIG += c++11 c++14 c++17 c++2a c++2b"
|
||||
}
|
||||
},
|
||||
"precompile_header": {
|
||||
"label": "precompiled header support",
|
||||
"type": "compile",
|
||||
@ -1002,6 +1016,12 @@
|
||||
"condition": "features.c++17 && tests.cxx2a",
|
||||
"output": [ "publicFeature", "publicQtConfig" ]
|
||||
},
|
||||
"c++2b": {
|
||||
"label": "C++2b",
|
||||
"autoDetect": false,
|
||||
"condition": "features.c++2a && tests.cxx2b",
|
||||
"output": [ "publicFeature", "publicQtConfig" ]
|
||||
},
|
||||
"c89": {
|
||||
"label": "C89"
|
||||
},
|
||||
@ -1554,7 +1574,7 @@ Configure with '-qreal float' to create a build that is binary-compatible with 5
|
||||
{
|
||||
"message": "Using C++ standard",
|
||||
"type": "firstAvailableFeature",
|
||||
"args": "c++2a c++17 c++14 c++11"
|
||||
"args": "c++2b c++2a c++17 c++14 c++11"
|
||||
},
|
||||
{
|
||||
"type": "feature",
|
||||
|
@ -22,18 +22,27 @@ defineTest(qtConfCommandline_cxxstd) {
|
||||
qtConfCommandlineSetInput("c++14", "no")
|
||||
qtConfCommandlineSetInput("c++1z", "no")
|
||||
qtConfCommandlineSetInput("c++2a", "no")
|
||||
qtConfCommandlineSetInput("c++2b", "no")
|
||||
} else: contains(val, "(c\+\+)?(14|1y)") {
|
||||
qtConfCommandlineSetInput("c++14", "yes")
|
||||
qtConfCommandlineSetInput("c++1z", "no")
|
||||
qtConfCommandlineSetInput("c++2a", "no")
|
||||
qtConfCommandlineSetInput("c++2b", "no")
|
||||
} else: contains(val, "(c\+\+)?(17|1z)") {
|
||||
qtConfCommandlineSetInput("c++14", "yes")
|
||||
qtConfCommandlineSetInput("c++1z", "yes")
|
||||
qtConfCommandlineSetInput("c++2a", "no")
|
||||
qtConfCommandlineSetInput("c++2b", "no")
|
||||
} else: contains(val, "(c\+\+)?(2a)") {
|
||||
qtConfCommandlineSetInput("c++14", "yes")
|
||||
qtConfCommandlineSetInput("c++1z", "yes")
|
||||
qtConfCommandlineSetInput("c++2a", "yes")
|
||||
qtConfCommandlineSetInput("c++2b", "no")
|
||||
} else: contains(val, "(c\+\+)?(2b)") {
|
||||
qtConfCommandlineSetInput("c++14", "yes")
|
||||
qtConfCommandlineSetInput("c++1z", "yes")
|
||||
qtConfCommandlineSetInput("c++2a", "yes")
|
||||
qtConfCommandlineSetInput("c++2b", "yes")
|
||||
} else {
|
||||
qtConfAddError("Invalid argument $$val to command line parameter $$arg")
|
||||
}
|
||||
|
@ -35,10 +35,12 @@ 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_CXX2B = -std=c++2b
|
||||
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_CXXFLAGS_GNUCXX2B = -std=gnu++2b
|
||||
|
||||
QMAKE_LFLAGS_CXX11 =
|
||||
QMAKE_LFLAGS_CXX14 =
|
||||
|
@ -33,10 +33,12 @@ 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_CXX2B = -std=c++2b
|
||||
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_CXXFLAGS_GNUCXX2B = -std=gnu++2b
|
||||
QMAKE_LFLAGS_CXX11 =
|
||||
QMAKE_LFLAGS_CXX14 =
|
||||
QMAKE_LFLAGS_CXX1Z =
|
||||
|
@ -118,6 +118,7 @@ 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_CXX2B = -std:c++latest
|
||||
|
||||
}
|
||||
|
||||
|
@ -122,17 +122,18 @@ breakpad {
|
||||
}
|
||||
|
||||
c++17: CONFIG += c++1z
|
||||
c++latest: CONFIG *= c++2a c++1z c++14 c++11
|
||||
c++latest: CONFIG *= c++2b c++2a c++1z c++14 c++11
|
||||
|
||||
!c++11:!c++14:!c++1z:!c++2a {
|
||||
!c++11:!c++14:!c++1z:!c++2a:!c++2b {
|
||||
# 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++2a {
|
||||
c++11|c++14|c++1z|c++2a|c++2b {
|
||||
# Disable special compiler flags for host builds
|
||||
!host_build|!cross_compile {
|
||||
c++2a: cxxstd = CXX2A
|
||||
c++2b: cxxstd = CXX2B
|
||||
else: c++2a: cxxstd = CXX2A
|
||||
else: c++1z: cxxstd = CXX1Z
|
||||
else: c++14: cxxstd = CXX14
|
||||
else: cxxstd = CXX11
|
||||
|
@ -18,6 +18,7 @@ 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(c++2b): CONFIG += c++2b
|
||||
qtConfig(c99): CONFIG += c99
|
||||
qtConfig(c11): CONFIG += c11
|
||||
qtConfig(separate_debug_info): CONFIG += separate_debug_info
|
||||
@ -158,4 +159,3 @@ warnings_are_errors:warning_clean {
|
||||
}
|
||||
unset(ver)
|
||||
}
|
||||
|
||||
|
@ -1217,6 +1217,9 @@
|
||||
\row \li c++2a \li C++2a support is enabled. This option has no effect if
|
||||
the compiler does not support C++2a, or can't select the C++ standard.
|
||||
By default, support is disabled.
|
||||
\row \li c++2b \li c++2b support is enabled. This option has no effect if
|
||||
the compiler does not support c++2b, or can't select the C++ standard.
|
||||
By default, support is disabled.
|
||||
\row \li c++latest \li Support for the latest C++ language standard is
|
||||
enabled that is supported by the compiler. By default, this option is
|
||||
disabled.
|
||||
|
Loading…
x
Reference in New Issue
Block a user