summaryrefslogtreecommitdiff
path: root/xmake/core/project/project.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-06-09 20:27:48 +0800
committerruki <[email protected]>2016-06-09 20:27:48 +0800
commitcb9ce25dd0e7669189124a89bf6171190707b13e (patch)
tree52a7953866430eb2c85eba180140c7195e26ac28 /xmake/core/project/project.lua
parent2429c51cf05dd13bc481704ad0a59e1bcef03ade (diff)
improve the macro plugin
Diffstat (limited to 'xmake/core/project/project.lua')
-rw-r--r--xmake/core/project/project.lua58
1 files changed, 3 insertions, 55 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index fb32e3623..2319d2a98 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -539,64 +539,12 @@ function project.check()
-- enter toolchains environment
environment.enter("toolchains")
-
- -- the source file path
- local cfile = path.join(os.tmpdir(), "__checking.c")
- local cxxfile = path.join(os.tmpdir(), "__checking.cpp")
-
- -- the object file path
- local objectfile = path.join(os.tmpdir(), target.filename("__checking", "object"))
-
- -- the target file path
- local targetfile = path.join(os.tmpdir(), target.filename("__checking", "binary"))
-
- -- make all options
- for name, opt in pairs(options) do
-
- -- need check?
- if config.get(name) == nil then
-
- -- enable it?
- local enable = opt:get("enable")
- if enable ~= nil and enable then
-
- -- enable this option
- config.set(name, true)
-
- -- save this option to configure
- opt:save()
- -- check option
- elseif enable == nil and opt:check(cfile, cxxfile, objectfile, targetfile) then
-
- -- enable this option
- config.set(name, true)
-
- -- save this option to configure
- opt:save()
- else
-
- -- disable this option
- config.set(name, false)
-
- -- clear this option to configure
- opt:clear()
- end
-
- -- no check
- elseif config.get(name) then
-
- -- save this option to configure directly
- opt:save()
- end
+ -- check all options
+ for _, opt in pairs(options) do
+ opt:check()
end
- -- remove files
- os.rm(cfile)
- os.rm(cxxfile)
- os.rm(objectfile)
- os.rm(targetfile)
-
-- leave toolchains environment
environment.leave("toolchains")