summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-29 23:36:08 +0800
committerruki <[email protected]>2021-09-29 23:36:08 +0800
commitdb6fe6c5fafdac2e719fcfbfc9dbe305ed4cf606 (patch)
treeb852f84f50fbbf73481ec5f1d6c509f192c65901
parentd4397494c7585d62364df8026c1626f1f682baa5 (diff)
improve to detect c++ features
-rw-r--r--xmake/modules/detect/tools/clang/cxxfeatures.lua5
-rw-r--r--xmake/modules/detect/tools/gcc/cxxfeatures.lua3
2 files changed, 5 insertions, 3 deletions
diff --git a/xmake/modules/detect/tools/clang/cxxfeatures.lua b/xmake/modules/detect/tools/clang/cxxfeatures.lua
index 6a468db00..1fd57c8d6 100644
--- a/xmake/modules/detect/tools/clang/cxxfeatures.lua
+++ b/xmake/modules/detect/tools/clang/cxxfeatures.lua
@@ -38,9 +38,10 @@ function main()
_g.features = cxxfeatures()
-- init conditions
+ -- clang -x c++ -std=c++20 -dM -E - < /dev/null | grep __cplusplus
local clang_minver = "((__clang_major__ * 100) + __clang_minor__) >= 301"
- local clang80_cxx20 = "((__clang_major__ * 100) + __clang_minor__) >= 800 && __cplusplus > 201707L"
- local clang50_cxx17 = "((__clang_major__ * 100) + __clang_minor__) >= 500 && __cplusplus > 201703L"
+ local clang80_cxx20 = "((__clang_major__ * 100) + __clang_minor__) >= 800 && __cplusplus >= 202002L"
+ local clang50_cxx17 = "((__clang_major__ * 100) + __clang_minor__) >= 500 && __cplusplus >= 201703L"
local clang34_cxx14 = "((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L"
local clang31_cxx11 = clang_minver .. " && __cplusplus >= 201103L"
local clang29_cxx11 = clang_minver .. " && __cplusplus >= 201103L"
diff --git a/xmake/modules/detect/tools/gcc/cxxfeatures.lua b/xmake/modules/detect/tools/gcc/cxxfeatures.lua
index e40eadf13..96eaecf66 100644
--- a/xmake/modules/detect/tools/gcc/cxxfeatures.lua
+++ b/xmake/modules/detect/tools/gcc/cxxfeatures.lua
@@ -35,8 +35,9 @@ end
function main()
-- init conditions
+ -- gcc -x c++ -std=c++20 -dM -E - < /dev/null | grep __cplusplus
local gcc_minver = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404"
- local gcc90_cxx20 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 900 && __cplusplus >= 201709L"
+ local gcc90_cxx20 = "(__GNUC__ * 100 + __GNUC_MINOR__) >= 900 && __cplusplus >= 202002L"
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"