diff options
| author | ruki <[email protected]> | 2021-09-29 23:19:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-29 23:19:52 +0800 |
| commit | d4397494c7585d62364df8026c1626f1f682baa5 (patch) | |
| tree | 7f7f0b14b3840f79441b1c3683a5d797e567c800 /xmake/modules/detect/tools/gcc | |
| parent | 2904ba8f0e7eb87eab4b47a6021c1ce9039a40ba (diff) | |
add cxx_std_ features
Diffstat (limited to 'xmake/modules/detect/tools/gcc')
| -rw-r--r-- | xmake/modules/detect/tools/gcc/cfeatures.lua | 5 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/gcc/cxxfeatures.lua | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/gcc/cfeatures.lua b/xmake/modules/detect/tools/gcc/cfeatures.lua index 664892720..9f4ee275b 100644 --- a/xmake/modules/detect/tools/gcc/cfeatures.lua +++ b/xmake/modules/detect/tools/gcc/cfeatures.lua @@ -33,6 +33,11 @@ function main() local gcc34_c99 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L" local gcc_c90 = gcc_minver + -- set language standard supports + _set("c_std_89", gcc46_c90) + _set("c_std_99", gcc34_c99) + _set("c_std_11", gcc46_c11) + -- set features _set("c_static_assert", gcc46_c11) -- GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it to 201000L _set("c_restrict", gcc34_c99) diff --git a/xmake/modules/detect/tools/gcc/cxxfeatures.lua b/xmake/modules/detect/tools/gcc/cxxfeatures.lua index 4edb33a27..e40eadf13 100644 --- a/xmake/modules/detect/tools/gcc/cxxfeatures.lua +++ b/xmake/modules/detect/tools/gcc/cxxfeatures.lua @@ -28,6 +28,7 @@ end -- -- http://gcc.gnu.org/projects/cxx0x.html -- http://gcc.gnu.org/projects/cxx1y.html +-- https://gcc.gnu.org/projects/cxx-status.html -- -- porting from Modules/Compiler/GNU-CXX-FeatureTests.cmake -- @@ -35,6 +36,8 @@ function main() -- init conditions local gcc_minver = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404" + local gcc90_cxx20 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 900 && __cplusplus >= 201709L" + local gcc70_cxx17 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 700 && __cplusplus >= 201703L" local gcc50_cxx14 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L" local gcc49_cxx14 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L" local gcc481_cxx11 = "((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L" @@ -46,6 +49,13 @@ function main() local gcc44_cxx11 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && " .. gcc_cxx0x_defined local gcc43_cxx11 = gcc_minver .. " && " .. gcc_cxx0x_defined + -- set language standard supports + _set("cxx_std_98", gcc_minver) + _set("cxx_std_11", gcc43_cxx11) + _set("cxx_std_14", gcc49_cxx14) + _set("cxx_std_17", gcc70_cxx17) + _set("cxx_std_20", gcc90_cxx20) + -- set features _set("cxx_variable_templates", gcc50_cxx14) _set("cxx_relaxed_constexpr", gcc50_cxx14) |
