summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-18 22:41:04 +0800
committerruki <[email protected]>2020-05-18 10:06:27 +0800
commit8405406c0519338e1cfb75746e4b31ca5b6c3cc7 (patch)
treeb336f555b1980b7d313d49dbacb948b563e2153b
parent937bd96c26edc111a3226a4feb2a6748041ab461 (diff)
improve to check xcode toolchain
-rw-r--r--xmake/platforms/macosx/check.lua1
-rw-r--r--xmake/toolchains/xcode/check.lua26
2 files changed, 25 insertions, 2 deletions
diff --git a/xmake/platforms/macosx/check.lua b/xmake/platforms/macosx/check.lua
index ff552ad6b..2158dc25a 100644
--- a/xmake/platforms/macosx/check.lua
+++ b/xmake/platforms/macosx/check.lua
@@ -155,6 +155,7 @@ function main(platform)
table.remove(toolchains, idx)
end
end
+ assert(#toolchains > 0, "toolchains not found!")
--[[
-- only check the given config name?
diff --git a/xmake/toolchains/xcode/check.lua b/xmake/toolchains/xcode/check.lua
index 0e34232a6..925db3870 100644
--- a/xmake/toolchains/xcode/check.lua
+++ b/xmake/toolchains/xcode/check.lua
@@ -19,11 +19,33 @@
--
-- imports
+import("core.base.option")
import("core.project.config")
-import("private.platform.check_xcode")
+import("detect.sdks.find_xcode")
-- main entry
function main(toolchain)
- check_xcode(config, true)
+
+ -- find xcode
+ local xcode = find_xcode(config.get("xcode"), {force = not optional, verbose = true, plat = config.get("plat"), arch = config.get("arch")})
+ if xcode then
+ config.set("xcode", xcode.sdkdir, {force = true, readonly = true})
+ else
+ return false
+ end
+
+ -- save target minver
+ local xcode_sdkver = config.get("xcode_sdkver")
+ local target_minver = config.get("target_minver")
+ if xcode_sdkver and not target_minver then
+ target_minver = xcode_sdkver
+ if is_plat("macosx") then
+ local macos_ver = macos.version()
+ if macos_ver then
+ target_minver = macos_ver:major() .. "." .. macos_ver:minor()
+ end
+ end
+ config.set("target_minver", target_minver)
+ end
return true
end