summaryrefslogtreecommitdiff
path: root/xmake/toolchains/xcode/check.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-15 23:34:01 +0800
committerruki <[email protected]>2023-03-15 23:34:01 +0800
commitf25390857da29aa81bd47c3882fe205bf6569596 (patch)
treed8132ddc965595c3615631c5ee60795eb43f2e67 /xmake/toolchains/xcode/check.lua
parent01f609b7044a43206d1a05aaa1bdc318116ffad7 (diff)
improve xcode toolchain
Diffstat (limited to 'xmake/toolchains/xcode/check.lua')
-rw-r--r--xmake/toolchains/xcode/check.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/xmake/toolchains/xcode/check.lua b/xmake/toolchains/xcode/check.lua
index 63faaf8a6..31dae7343 100644
--- a/xmake/toolchains/xcode/check.lua
+++ b/xmake/toolchains/xcode/check.lua
@@ -22,6 +22,7 @@
import("core.base.option")
import("core.project.config")
import("detect.sdks.find_xcode")
+import("private.utils.executable_path")
-- main entry
function main(toolchain)
@@ -90,6 +91,25 @@ function main(toolchain)
if xcode_sysroot then
toolchain:config_set("xcode_sysroot", xcode_sysroot)
end
+ toolchain:config_set("simulator", simulator)
+
+ -- get xcode bin directory
+ local cross
+ if toolchain:is_plat("macosx") then
+ cross = "xcrun -sdk macosx "
+ elseif toolchain:is_plat("iphoneos") then
+ cross = simulator and "xcrun -sdk iphonesimulator " or "xcrun -sdk iphoneos "
+ elseif toolchain:is_plat("watchos") then
+ cross = simulator and "xcrun -sdk watchsimulator " or "xcrun -sdk watchos "
+ elseif toolchain:is_plat("appletvos") then
+ cross = simulator and "xcrun -sdk appletvsimulator " or "xcrun -sdk appletvos "
+ else
+ raise("unknown platform for xcode!")
+ end
+ local xc_clang = executable_path(cross .. "clang")
+ if xc_clang then
+ toolchain:config_set("bindir", path.directory(xc_clang))
+ end
-- save target minver
--