summaryrefslogtreecommitdiff
path: root/xmake/toolchains/xcode/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-18 22:59:45 +0800
committerruki <[email protected]>2020-05-18 11:58:35 +0800
commitfb7bc83c06972744d6f2c5139b5bc079e06b7b11 (patch)
tree7921ddc136e7d017b0610f2c4b6a079253723063 /xmake/toolchains/xcode/xmake.lua
parent7d9b0c0be46aa7ed53578e4f39717cfac76aa1eb (diff)
add as to xcode toolchain
Diffstat (limited to 'xmake/toolchains/xcode/xmake.lua')
-rw-r--r--xmake/toolchains/xcode/xmake.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/xmake/toolchains/xcode/xmake.lua b/xmake/toolchains/xcode/xmake.lua
index f20fabe1f..aed4a44e9 100644
--- a/xmake/toolchains/xcode/xmake.lua
+++ b/xmake/toolchains/xcode/xmake.lua
@@ -28,16 +28,16 @@ toolchain("xcode")
on_load(function (toolchain)
-- get cross
- local cross
+ local cross, arch, simulator
if is_plat("macosx") then
cross = "xcrun -sdk macosx "
elseif is_plat("iphoneos") then
- local arch = get_config("arch") or os.arch()
- local simulator = (arch == "i386" or arch == "x86_64")
+ arch = get_config("arch") or os.arch()
+ simulator = (arch == "i386" or arch == "x86_64")
cross = simulator and "xcrun -sdk iphonesimulator " or "xcrun -sdk iphoneos "
elseif is_plat("watchos") then
- local arch = get_config("arch") or os.arch()
- local simulator = (arch == "i386")
+ arch = get_config("arch") or os.arch()
+ simulator = (arch == "i386")
cross = simulator and "xcrun -sdk watchsimulator " or "xcrun -sdk watchos "
else
raise("unknown platform for xcode!")
@@ -46,7 +46,6 @@ toolchain("xcode")
-- set toolsets
toolchain:set("toolsets", "cc", cross .. "clang")
toolchain:set("toolsets", "cxx", cross .. "clang", cross .. "clang++")
- toolchain:set("toolsets", "as", cross .. "clang")
toolchain:set("toolsets", "ld", cross .. "clang++", cross .. "clang")
toolchain:set("toolsets", "sh", cross .. "clang++", cross .. "clang")
toolchain:set("toolsets", "ar", cross .. "ar")
@@ -58,6 +57,16 @@ toolchain("xcode")
toolchain:set("toolsets", "sc", cross .. "swiftc", "swiftc")
toolchain:set("toolsets", "scld", cross .. "swiftc", "swiftc")
toolchain:set("toolsets", "scsh", cross .. "swiftc", "swiftc")
+ if arch then
+ toolchain:set("toolsets", "cpp", cross .. "clang -arch " .. arch .. " -E")
+ end
+ if is_plat("macosx") then
+ toolchain:set("toolsets", "as", cross .. "clang")
+ elseif simulator then
+ toolchain:set("toolsets", "as", cross .. "clang")
+ else
+ toolchain:set("toolsets", "as", path.join(os.programdir(), "scripts", "gas-preprocessor.pl " .. cross) .. "clang")
+ end
-- load configurations
import("load_" .. get_config("plat"))(toolchain)