summaryrefslogtreecommitdiff
path: root/xmake/scripts/base/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-05-27 08:31:36 +0800
committerruki <[email protected]>2015-05-27 08:31:36 +0800
commit0e3df610b7db95590a9ad32eccfc7b2b2319b128 (patch)
tree306336b11034e115f68dd74df2b0d1ee9a6d44ee /xmake/scripts/base/main.lua
parentf4562609df7ac3f395e5178e76fcefa2c1ffa980 (diff)
modify platform interfaces
Diffstat (limited to 'xmake/scripts/base/main.lua')
-rw-r--r--xmake/scripts/base/main.lua40
1 files changed, 37 insertions, 3 deletions
diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua
index d65df8ad9..7d448fc57 100644
--- a/xmake/scripts/base/main.lua
+++ b/xmake/scripts/base/main.lua
@@ -398,6 +398,21 @@ function main._done_global()
-- load global configure
global.loadxconf()
+ -- wrap the global configure for more convenient to get and set values
+ local global_wrapped = {}
+ setmetatable(global_wrapped,
+ {
+ __index = function(tbl, key)
+ return global.get(key)
+ end,
+ __newindex = function(tbl, key, val)
+ global.set(key, val)
+ end
+ })
+
+ -- probe the global platform configure
+ platform.probe(global_wrapped, true)
+
-- done action
return action.done("global")
end
@@ -427,10 +442,29 @@ function main._done_option()
return false
end
- -- init platform
- if not platform.init() then
+ -- xmake config?
+ if options._ACTION == "config" then
+
+ -- wrap the global configure for more convenient to get and set values
+ local config_wrapped = {}
+ setmetatable(config_wrapped,
+ {
+ __index = function(tbl, key)
+ return config.get(key)
+ end,
+ __newindex = function(tbl, key, val)
+ config.set(key, val)
+ end
+ })
+
+ -- probe the current platform configure
+ platform.probe(config_wrapped, false)
+ end
+
+ -- make the current platform configure
+ if not platform.make() then
-- error
- utils.error("init platform: %s failed!", config.get("plat"))
+ utils.error("make platform configure: %s failed!", config.get("plat"))
return false
end