summaryrefslogtreecommitdiff
path: root/xmake/actions
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
parentda7bc7414f499ec3420c1d1e062a8913b88935b7 (diff)
load config
Diffstat (limited to 'xmake/actions')
-rwxr-xr-xxmake/actions/config/main.lua29
-rwxr-xr-xxmake/actions/global/xmake.lua7
2 files changed, 28 insertions, 8 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
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index d93b6e524..35b36cda6 100755
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -33,6 +33,9 @@ task("global")
import("core.base.option")
import("core.project.global")
+ -- load configure
+ global.load()
+
-- clean the cached configure?
if option.get("clean") then
@@ -40,7 +43,7 @@ task("global")
global.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
global.set(name, value)
@@ -49,7 +52,7 @@ task("global")
-- merge the default options
for name, value in pairs(option.defaults()) do
- if name ~= "verbose" and name ~= "clean" then
+ if name ~= "verbose" and name ~= "clean" and global.get(name) == nil then
global.set(name, value)
end
end