summaryrefslogtreecommitdiff
path: root/xmake/actions/config/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-03-15 21:01:32 +0800
committerruki <[email protected]>2016-03-15 21:01:32 +0800
commitef9342cfecbcbf2f95220e08132e6530bf754f5f (patch)
treeeef4c52c57fb3fafe549d3962d1fed102e0b1ec6 /xmake/actions/config/main.lua
parentda7bc7414f499ec3420c1d1e062a8913b88935b7 (diff)
load config
Diffstat (limited to 'xmake/actions/config/main.lua')
-rwxr-xr-xxmake/actions/config/main.lua29
1 files changed, 23 insertions, 6 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index 6e60c4793..84aa468fb 100755
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -23,10 +23,22 @@
-- imports
import("core.base.option")
import("core.project.config")
+import("core.project.global")
+
+-- filter option
+function _option_filter(name)
+ return name and name ~= "target" and name ~= "file" and name ~= "project" and name ~= "verbose" and name ~= "clean"
+end
-- main
function main()
+ -- load global configure
+ global.load()
+
+ -- load project configure
+ config.load(option.get("target"))
+
-- clean the cached configure?
if option.get("clean") then
@@ -34,23 +46,28 @@ function main()
config.clean()
end
- --[[
- -- merge the options
+ -- override the configure for the current options
for name, value in pairs(option.options()) do
- if name ~= "verbose" and name ~= "clean" then
+ if _option_filter(name) then
+ config.set(name, value)
+ end
+ end
+
+ -- merge the global configure
+ for name, value in pairs(global.options()) do
+ if config.get(name) == nil then
config.set(name, value)
end
end
-- merge the default options
for name, value in pairs(option.defaults()) do
- if name ~= "verbose" and name ~= "clean" then
+ if _option_filter(name) and config.get(name) == nil then
config.set(name, value)
end
end
- ]]
-- probe the configure with value: "auto"
--- config.probe()
+ config.probe()
end