summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-30 16:01:56 +0800
committerruki <[email protected]>2017-06-30 16:01:56 +0800
commit871af6a0239ee82fb269efa022a0ce7cda4dd866 (patch)
tree47ba2573889b721f5fdb37aee0d76fdad193f611
parent4e283aa257fec00eb9a8e994bf976cc03491fdc2 (diff)
disable cache for has_cxsnippets
-rw-r--r--xmake/core/project/option.lua2
-rw-r--r--xmake/modules/lib/detect/has_cxsnippets.lua22
2 files changed, 3 insertions, 21 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index 2b0746281..93be29349 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -88,7 +88,7 @@ function option:_check_cx(kind)
self._has_cxsnippets = self._has_cxsnippets or import("lib.detect.has_cxsnippets")
-- get the tool name from the program
- local ok, results_or_errors = sandbox.load(self._has_cxsnippets, snippets, {name = self:name(), target = self, sourcekind = sourcekind, types = types, funcs = funcs, includes = includes})
+ local ok, results_or_errors = sandbox.load(self._has_cxsnippets, snippets, {target = self, sourcekind = sourcekind, types = types, funcs = funcs, includes = includes})
if not ok then
return false, results_or_errors
end
diff --git a/xmake/modules/lib/detect/has_cxsnippets.lua b/xmake/modules/lib/detect/has_cxsnippets.lua
index 233c43d83..59ef12872 100644
--- a/xmake/modules/lib/detect/has_cxsnippets.lua
+++ b/xmake/modules/lib/detect/has_cxsnippets.lua
@@ -118,7 +118,7 @@ end
-- @param snippets the snippets
-- @param opt the argument options
-- .e.g
--- { name = "", verbose = false, target = [target|option], sourcekind = "[cc|cxx]"
+-- { verbose = false, target = [target|option], sourcekind = "[cc|cxx]"
-- , types = {"wchar_t", "char*"}, includes = "stdio.h", funcs = {"sigsetjmp", "sigsetjmp((void*)0, 0)"}}
--
-- funcs:
@@ -142,19 +142,6 @@ function main(snippets, opt)
-- init snippets
snippets = snippets or {}
- -- init cache and key
- local key = opt.name
- local results = _g._RESULTS or {}
-
- -- get result from the cache first
- if key ~= nil then
- key = key .. (opt.sourcekind or "")
- local ok = results[key]
- if ok ~= nil then
- return ok
- end
- end
-
-- get links
local links = table.wrap(opt.links)
if opt.target then
@@ -188,6 +175,7 @@ function main(snippets, opt)
local binaryfile = os.tmpfile() .. ".b"
io.writefile(sourcefile, sourcecode)
+ -- @note cannot cache result, all conditions will be changed
-- attempt to compile it
local ok = try
{
@@ -233,12 +221,6 @@ function main(snippets, opt)
end
end
- -- save result to cache
- if key ~= nil then
- results[key] = ifelse(ok, ok, false)
- _g._RESULTS = results
- end
-
-- ok?
return ok
end