diff options
| author | ruki <[email protected]> | 2023-09-22 23:50:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-09-22 23:50:10 +0800 |
| commit | 2e99338c06e933f0bb02291bbd407182450ea045 (patch) | |
| tree | 10f1e5442fe798ca3e87268012f1e366cef65da6 | |
| parent | dabf929315f73beabf839fbd8f4b309b942e0b2c (diff) | |
improve bindir for xcode
| -rw-r--r-- | xmake/toolchains/xcode/check.lua | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/xmake/toolchains/xcode/check.lua b/xmake/toolchains/xcode/check.lua index e026ddb86..1c013d5d4 100644 --- a/xmake/toolchains/xcode/check.lua +++ b/xmake/toolchains/xcode/check.lua @@ -73,21 +73,26 @@ function main(toolchain) end -- 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 " + if xcode.sdkdir and os.isdir(xcode.sdkdir) then + local bindir = path.join(xcode.sdkdir, "Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin") + toolchain:config_set("bindir", bindir) 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)) + 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 end -- save xcode sysroot directory |
