summaryrefslogtreecommitdiff
path: root/xmake/toolchains/xcode/check.lua
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 /xmake/toolchains/xcode/check.lua
parent937bd96c26edc111a3226a4feb2a6748041ab461 (diff)
improve to check xcode toolchain
Diffstat (limited to 'xmake/toolchains/xcode/check.lua')
-rw-r--r--xmake/toolchains/xcode/check.lua26
1 files changed, 24 insertions, 2 deletions
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