summaryrefslogtreecommitdiff
path: root/xmake/toolchains/xcode/check.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-23 22:37:44 +0800
committerGitHub <[email protected]>2020-06-23 22:37:44 +0800
commitc18d15eb89116a0f3ce96bd56f3ccf861849f6ec (patch)
tree52b63db3274349f9a41872414208c7c30058cfd7 /xmake/toolchains/xcode/check.lua
parent53df324acd9c7432336a5894ceef578daa1ce38d (diff)
parent18bded45c229f5580c13fc8b4afc5edb6f18819a (diff)
Merge pull request #857 from xmake-io/toolchain
Improve toolchain to support host and cross toolchains at same time
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