diff options
| author | ruki <[email protected]> | 2016-04-17 20:53:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-04-17 20:53:16 +0800 |
| commit | 9495e08a20c2aeda6b54a4b06b17057056c79ec9 (patch) | |
| tree | 19471626f17c12931185f73ca5031da13fe94313 | |
| parent | b6520ecb79a870b48e2609d114c415b808405f61 (diff) | |
simplify checker
| -rw-r--r-- | xmake/platforms/checker.lua | 75 | ||||
| -rw-r--r-- | xmake/platforms/macosx/checker.lua | 57 |
2 files changed, 77 insertions, 55 deletions
diff --git a/xmake/platforms/checker.lua b/xmake/platforms/checker.lua index c808bbdc8..cd0383782 100644 --- a/xmake/platforms/checker.lua +++ b/xmake/platforms/checker.lua @@ -80,6 +80,81 @@ function check_xcode(config) end end +-- check the xcode sdk version +function check_xcode_sdkver(config) + + -- get plat + local plat = config.get("plat") + + -- the xcode sdk directories + local xcode_sdkdirs = + { + macosx = "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk" + , iphoneos = "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk" + , iphonesimulator = "/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk" + , watchos = "/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS*.sdk" + , watchsimulator = "/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator*.sdk" + } + + -- get the xcode sdk version + local xcode_sdkver = config.get("xcode_sdkver") + if not xcode_sdkver then + + -- attempt to match the directory + if not xcode_sdkver then + local dirs = os.match(config.get("xcode_dir") .. xcode_sdkdirs[plat], true) + for _, dir in ipairs(dirs) do + xcode_sdkver = string.match(dir, "%d+%.%d+") + if xcode_sdkver then break end + end + end + + -- check ok? update it + if xcode_sdkver then + + -- save it + config.set("xcode_sdkver", xcode_sdkver) + + -- trace + print("checking for the Xcode SDK version for %s ... %s", plat, xcode_sdkver) + else + -- failed + print("checking for the Xcode SDK version for %s ... no", plat) + print("please run:") + print(" - xmake config --xcode_sdkver=xxx") + print("or - xmake global --xcode_sdkver=xxx") + raise() + end + end +end + +-- check the target minimal version +function check_target_minver(config) + + -- get the target minimal version + local target_minver = config.get("target_minver") + if not target_minver then + + -- TODO + -- the default versions + local versions = + { + macosx = "10.9" + , iphoneos = "7.0" + , iphonesimulator = "7.0" + , watchos = "7.0" + , watchsimulator = "7.0" + } + + -- init the default target minimal version + config.set("target_minver", versions[config.get("plat")]) + + -- trace + print("checking for the target minimal version ... %s", config.get("target_minver")) + + end +end + -- check the make function check_make(config) diff --git a/xmake/platforms/macosx/checker.lua b/xmake/platforms/macosx/checker.lua index 3e1dca563..544363732 100644 --- a/xmake/platforms/macosx/checker.lua +++ b/xmake/platforms/macosx/checker.lua @@ -24,59 +24,6 @@ import("core.tool.tool") import("platforms.checker", {rootdir = os.programdir()}) --- check the xcode sdk version -function _check_xcode_sdkver(config) - - -- get the xcode sdk version - local xcode_sdkver = config.get("xcode_sdkver") - if not xcode_sdkver then - - -- attempt to match the directory - if not xcode_sdkver then - local dirs = os.match(config.get("xcode_dir") .. "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk", true) - if dirs then - for _, dir in ipairs(dirs) do - xcode_sdkver = string.match(dir, "%d+%.%d+") - if xcode_sdkver then break end - end - end - end - - -- check ok? update it - if xcode_sdkver then - - -- save it - config.set("xcode_sdkver", xcode_sdkver) - - -- trace - print("checking for the Xcode SDK version for %s ... %s", config.get("plat"), xcode_sdkver) - else - -- failed - print("checking for the Xcode SDK version for %s ... no", config.get("plat")) - print("please run:") - print(" - xmake config --xcode_sdkver=xxx") - print("or - xmake global --xcode_sdkver=xxx") - raise() - end - end -end - --- check the target minimal version -function _check_target_minver(config) - - -- get the target minimal version - local target_minver = config.get("target_minver") - if not target_minver then - - -- init the default target minimal version - config.set("target_minver", "10.9") - - -- trace - print("checking for the target minimal version ... %s", config.get("target_minver")) - - end -end - -- check the toolchains function _check_toolchains(config) @@ -108,8 +55,8 @@ function init() { checker.check_arch , checker.check_xcode - , _check_xcode_sdkver - , _check_target_minver + , checker.check_xcode_sdkver + , checker.check_target_minver , checker.check_make , checker.check_ccache , _check_toolchains |
