summaryrefslogtreecommitdiff
path: root/xmake/toolchains/xcode
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-19 00:48:33 +0800
committerruki <[email protected]>2020-06-18 22:51:19 +0800
commit92dd2db73694ab13671db73194ab1e9fae1b9371 (patch)
tree1d4ae3f3c82999f6d67043a882d68286e8ea94b4 /xmake/toolchains/xcode
parent53df324acd9c7432336a5894ceef578daa1ce38d (diff)
improve the plat/arch of toolchain
Diffstat (limited to 'xmake/toolchains/xcode')
-rw-r--r--xmake/toolchains/xcode/check.lua4
-rw-r--r--xmake/toolchains/xcode/load_iphoneos.lua2
-rw-r--r--xmake/toolchains/xcode/load_macosx.lua2
-rw-r--r--xmake/toolchains/xcode/load_watchos.lua2
-rw-r--r--xmake/toolchains/xcode/xmake.lua14
5 files changed, 12 insertions, 12 deletions
diff --git a/xmake/toolchains/xcode/check.lua b/xmake/toolchains/xcode/check.lua
index 925db3870..d5f79ab27f 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
@@ -39,7 +39,7 @@ function main(toolchain)
local target_minver = config.get("target_minver")
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()
diff --git a/xmake/toolchains/xcode/load_iphoneos.lua b/xmake/toolchains/xcode/load_iphoneos.lua
index 3aeb78672..842064cb7 100644
--- a/xmake/toolchains/xcode/load_iphoneos.lua
+++ b/xmake/toolchains/xcode/load_iphoneos.lua
@@ -25,7 +25,7 @@ import("core.project.config")
function main(toolchain)
-- init architecture
- local arch = config.get("arch") or "arm64"
+ local arch = toolchain:arch()
local simulator = (arch == "i386" or arch == "x86_64")
-- init platform name
diff --git a/xmake/toolchains/xcode/load_macosx.lua b/xmake/toolchains/xcode/load_macosx.lua
index de7dddb1e..f2060ad68 100644
--- a/xmake/toolchains/xcode/load_macosx.lua
+++ b/xmake/toolchains/xcode/load_macosx.lua
@@ -25,7 +25,7 @@ import("core.project.config")
function main(toolchain)
-- init flags for architecture
- local arch = config.get("arch") or os.arch()
+ local arch = toolchain:arch()
local target_minver = config.get("target_minver")
-- init flags for the xcode sdk directory
diff --git a/xmake/toolchains/xcode/load_watchos.lua b/xmake/toolchains/xcode/load_watchos.lua
index 5048f4bb7..6730784b1 100644
--- a/xmake/toolchains/xcode/load_watchos.lua
+++ b/xmake/toolchains/xcode/load_watchos.lua
@@ -25,7 +25,7 @@ import("core.project.config")
function main(toolchain)
-- init architecture
- local arch = config.get("arch")
+ local arch = toolchain:arch()
local simulator = arch == "i386"
-- init platform name
diff --git a/xmake/toolchains/xcode/xmake.lua b/xmake/toolchains/xcode/xmake.lua
index 776c142af..7394c8a13 100644
--- a/xmake/toolchains/xcode/xmake.lua
+++ b/xmake/toolchains/xcode/xmake.lua
@@ -36,14 +36,14 @@ toolchain("xcode")
-- get cross
local cross, arch, simulator
- if is_plat("macosx") then
+ if toolchain:is_plat("macosx") then
cross = "xcrun -sdk macosx "
- elseif is_plat("iphoneos") then
- arch = get_config("arch") or os.arch()
+ elseif toolchain:is_plat("iphoneos") then
+ arch = toolchain:arch()
simulator = (arch == "i386" or arch == "x86_64")
cross = simulator and "xcrun -sdk iphonesimulator " or "xcrun -sdk iphoneos "
- elseif is_plat("watchos") then
- arch = get_config("arch") or os.arch()
+ elseif toolchain:is_plat("watchos") then
+ arch = toolchain:arch()
simulator = (arch == "i386")
cross = simulator and "xcrun -sdk watchsimulator " or "xcrun -sdk watchos "
else
@@ -67,7 +67,7 @@ toolchain("xcode")
if arch then
toolchain:set("toolset", "cpp", cross .. "clang -arch " .. arch .. " -E")
end
- if is_plat("macosx") then
+ if toolchain:is_plat("macosx") then
toolchain:set("toolset", "as", cross .. "clang")
elseif simulator then
toolchain:set("toolset", "as", cross .. "clang")
@@ -76,5 +76,5 @@ toolchain("xcode")
end
-- load configurations
- import("load_" .. get_config("plat"))(toolchain)
+ import("load_" .. toolchain:plat())(toolchain)
end)