summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-04-23 20:20:45 +0800
committerruki <[email protected]>2016-04-23 20:20:45 +0800
commita40e8b5d84255edae664fab9b7192d15fedf92ba (patch)
tree3c27772f0bfa088c190a9d5a758b141179081974
parent48a228f6bb2e4870bf0e4952c0c752ddeae72219 (diff)
add arguments for check arch
-rw-r--r--xmake/core/platform/checker.lua24
-rw-r--r--xmake/platforms/checker.lua17
-rw-r--r--xmake/platforms/iphoneos/checker.lua2
3 files changed, 21 insertions, 22 deletions
diff --git a/xmake/core/platform/checker.lua b/xmake/core/platform/checker.lua
index 5a03bc132..4cbb70243 100644
--- a/xmake/core/platform/checker.lua
+++ b/xmake/core/platform/checker.lua
@@ -32,14 +32,26 @@ local global = require("project/global")
local sandbox = require("sandbox/sandbox")
local platform = require("platform/platform")
--- check the list
-function checker._checklist(funclist, ...)
+-- check it
+function checker._check(callers, ...)
-- check all
- for _, func in ipairs(table.wrap(funclist)) do
+ for _, caller in ipairs(table.wrap(callers)) do
+
+ -- has arguments?
+ local args = nil
+ if type(caller) == "table" then
+ if #caller > 1 then
+ args = caller[2]
+ end
+ caller = caller[1]
+ end
+
+ -- check
+ assert(type(caller) == "function")
-- call it
- local ok, errors = sandbox.load(func, ...)
+ local ok, errors = sandbox.load(caller, ..., args)
if not ok then
return false, errors
end
@@ -84,7 +96,7 @@ function checker.check(name)
end
-- check it
- return checker._checklist(module.get("config"), config)
+ return checker._check(module.get("config"), config)
-- check the global configure?
elseif name == "global" then
@@ -108,7 +120,7 @@ function checker.check(name)
end
-- check it
- local ok, errors = checker._checklist(module.get("global"), global)
+ local ok, errors = checker._check(module.get("global"), global)
if not ok then
return false, errors
end
diff --git a/xmake/platforms/checker.lua b/xmake/platforms/checker.lua
index a36845f21..88306ffb2 100644
--- a/xmake/platforms/checker.lua
+++ b/xmake/platforms/checker.lua
@@ -24,27 +24,14 @@
import("core.tool.tool")
-- check the architecture
-function check_arch(config)
+function check_arch(config, default)
-- get the architecture
local arch = config.get("arch")
if not arch then
- -- the default architecture
- local archs =
- {
- macosx = os.arch()
- , linux = os.arch()
- , windows = os.arch()
- , iphoneos = "armv7"
- , iphonesimulator = os.arch()
- , watchos = "armv7"
- , watchsimulator = os.arch()
- , android = "armv7-a"
- }
-
-- init the default architecture
- config.set("arch", archs[config.get("plat")])
+ config.set("arch", default or os.arch())
-- trace
print("checking for the architecture ... %s", config.get("arch"))
diff --git a/xmake/platforms/iphoneos/checker.lua b/xmake/platforms/iphoneos/checker.lua
index f79b0ee55..b497b0d30 100644
--- a/xmake/platforms/iphoneos/checker.lua
+++ b/xmake/platforms/iphoneos/checker.lua
@@ -64,7 +64,7 @@ function init()
-- init the check list of config
_g.config =
{
- checker.check_arch
+ { checker.check_arch, "armv7" }
, checker.check_xcode
, checker.check_xcode_sdkver
, checker.check_target_minver