summaryrefslogtreecommitdiff
path: root/xmake/toolchains/xcode/check.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/toolchains/xcode/check.lua')
-rw-r--r--xmake/toolchains/xcode/check.lua25
1 files changed, 20 insertions, 5 deletions
diff --git a/xmake/toolchains/xcode/check.lua b/xmake/toolchains/xcode/check.lua
index 925db3870..e49957b17 100644
--- a/xmake/toolchains/xcode/check.lua
+++ b/xmake/toolchains/xcode/check.lua
@@ -27,7 +27,7 @@ import("detect.sdks.find_xcode")
function main(toolchain)
-- find xcode
- local xcode = find_xcode(config.get("xcode"), {force = not optional, verbose = true, plat = config.get("plat"), arch = config.get("arch")})
+ local xcode = find_xcode(config.get("xcode"), {force = not optional, verbose = true, plat = toolchain:plat(), arch = toolchain:arch()})
if xcode then
config.set("xcode", xcode.sdkdir, {force = true, readonly = true})
else
@@ -35,17 +35,32 @@ function main(toolchain)
end
-- save target minver
- local xcode_sdkver = config.get("xcode_sdkver")
- local target_minver = config.get("target_minver")
+ --
+ -- @note we need to differentiate the version for the system,
+ -- because the xcode toolchain of iphoneos/macosx may need to be used at the same time.
+ --
+ -- e.g.
+ --
+ -- target("test")
+ -- set_toolchains("xcode", {plat = os.host(), arch = os.arch()})
+ --
+ local xcode_sdkver = toolchain:is_plat(config.plat()) and config.get("xcode_sdkver")
+ if not xcode_sdkver then
+ xcode_sdkver = config.get("xcode_sdkver_" .. toolchain:plat())
+ end
+ local target_minver = toolchain:is_plat(config.plat()) and config.get("target_minver")
+ if not target_minver then
+ target_minver = config.get("target_minver_" .. toolchain:plat())
+ end
if xcode_sdkver and not target_minver then
target_minver = xcode_sdkver
- if is_plat("macosx") then
+ if toolchain: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)
+ config.set("target_minver_" .. toolchain:plat(), target_minver)
end
return true
end