summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-08-22 22:07:05 +0800
committerruki <[email protected]>2020-08-22 22:07:05 +0800
commit55eb2fa3baaa571a616250ee8a89e98b4d82d49c (patch)
tree0aafe931e1ce598327895bc797f5c09149932676
parent0d7d4659b1120e98b9a42ad9abbe440cfe026efc (diff)
fix has_features
-rw-r--r--tests/apis/check_xxx/xmake.lua2
-rw-r--r--xmake/core/project/option.lua3
-rw-r--r--xmake/modules/detect/tools/gcc/features.lua6
-rw-r--r--xmake/modules/lib/detect/has_features.lua2
4 files changed, 3 insertions, 10 deletions
diff --git a/tests/apis/check_xxx/xmake.lua b/tests/apis/check_xxx/xmake.lua
index 7089bef47..a2a5fa0b1 100644
--- a/tests/apis/check_xxx/xmake.lua
+++ b/tests/apis/check_xxx/xmake.lua
@@ -18,6 +18,6 @@ target("test")
configvar_check_links("HAS_PTHREAD", {"pthread", "m", "dl"})
configvar_check_csnippets("HAS_STATIC_ASSERT", "_Static_assert(1, \"\");")
configvar_check_cfuncs("HAS_SETJMP", "setjmp", {includes = {"signal.h", "setjmp.h"}})
- configvar_check_features("HAS_CONSTEXPR", "cxx_constexpr")
+ configvar_check_features("HAS_CONSTEXPR", "cxx_constexpr", {languages = "c++11"})
configvar_check_features("HAS_CONSEXPR_AND_STATIC_ASSERT", {"cxx_constexpr", "c_static_assert"}, {languages = "c++11"})
configvar_check_cflags("HAS_SSE2", "-msse2")
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index f19e576a5..36a460313 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -123,6 +123,7 @@ function _instance:_do_check()
self._core_tool_compiler = self._core_tool_compiler or sandbox_module.import("core.tool.compiler", {anonymous = true})
-- all features are supported?
+ features = table.wrap(features)
local features_supported = self._core_tool_compiler.has_features(features, {target = self})
if features_supported and #features_supported == #features then
passed = true
@@ -130,7 +131,7 @@ function _instance:_do_check()
-- trace
if baseoption.get("verbose") or baseoption.get("diagnosis") then
- for _, feature in ipairs(table.wrap(features)) do
+ for _, feature in ipairs(features) do
utils.cprint("${dim}checking for the feature(%s) ... %s", feature, passed and "${color.success}${text.success}" or "${color.nothing}${text.nothing}")
end
end
diff --git a/xmake/modules/detect/tools/gcc/features.lua b/xmake/modules/detect/tools/gcc/features.lua
index ad4cb3214..bbb7e386b 100644
--- a/xmake/modules/detect/tools/gcc/features.lua
+++ b/xmake/modules/detect/tools/gcc/features.lua
@@ -41,11 +41,7 @@ function _get_macro_defines(snippets, extension, opt)
end
end
end
-
- -- remove files
os.tryrm(sourcefile)
-
- -- ok?
return results
end
@@ -111,8 +107,6 @@ function check_features(opt)
end
end
end
-
- -- ok?
return results
end
diff --git a/xmake/modules/lib/detect/has_features.lua b/xmake/modules/lib/detect/has_features.lua
index 12553ea71..e55f2e21f 100644
--- a/xmake/modules/lib/detect/has_features.lua
+++ b/xmake/modules/lib/detect/has_features.lua
@@ -52,7 +52,5 @@ function main(name, features, opt)
table.insert(results, feature)
end
end
-
- -- ok?
return results
end