summaryrefslogtreecommitdiff
path: root/xmake/toolchains
diff options
context:
space:
mode:
authorruki <[email protected]>2025-05-09 06:52:20 +0800
committerGitHub <[email protected]>2025-05-09 06:52:20 +0800
commit0d2657c847d01fda61cac80c5a26d02ebe70cab2 (patch)
treef95cc874a6aae7535250bc5507f1c700fae1a936 /xmake/toolchains
parenta3df7afcefd2e8fe195cf011f2fad3681d367cc5 (diff)
parentef19045debacfb8c617a2959249d987d59f4f2e7 (diff)
Merge pull request #6402 from SirLynix/rust-cross
cargo: fix package cross-compilation
Diffstat (limited to 'xmake/toolchains')
-rw-r--r--xmake/toolchains/rust/xmake.lua55
1 files changed, 6 insertions, 49 deletions
diff --git a/xmake/toolchains/rust/xmake.lua b/xmake/toolchains/rust/xmake.lua
index 8a1edce09..a17dc3517 100644
--- a/xmake/toolchains/rust/xmake.lua
+++ b/xmake/toolchains/rust/xmake.lua
@@ -28,57 +28,14 @@ toolchain("rust")
set_toolset("rcar", "$(env RC)", "rustc")
on_load(function (toolchain)
- local target
- if toolchain:is_arch("x86_64", "x64") then
- target = "x86_64"
- elseif toolchain:is_arch("i386", "x86", "i686") then
- target = "i686"
- elseif toolchain:is_arch("arm64", "aarch64", "arm64-v8a") then
- target = "aarch64"
- elseif toolchain:is_arch("armeabi-v7a", "armv7-a") then
- target = "armv7"
- elseif toolchain:is_arch("armeabi", "armv5te") then
- target = "arm"
- elseif toolchain:is_arch("wasm32") then
- target = "wasm32"
- elseif toolchain:is_arch("wasm64") then
- target = "wasm64"
- end
+ import("private.tools.rust.target_triple")
- if target then
- if toolchain:is_plat("windows") then
- target = target .. "-pc-windows-msvc"
- elseif toolchain:is_plat("mingw") then
- target = target .. "-pc-windows-gnu"
- elseif toolchain:is_plat("linux") then
- target = target .. "-unknown-linux-gnu"
- elseif toolchain:is_plat("macosx") then
- target = target .. "-apple-darwin"
- elseif toolchain:is_plat("android") then
- target = target .. "-linux-"
- if toolchain:is_arch("armeabi-v7a", "armeabi", "armv7-a", "armv5te") then
- target = target .. "androideabi"
- else
- target = target .. "android"
- end
- elseif toolchain:is_plat("iphoneos", "appletvos", "watchos") then
- if toolchain:is_plat("iphoneos") then
- target = target .. "-apple-ios"
- elseif toolchain:is_plat("appletvos") then
- target = target .. "-apple-tvos"
- elseif toolchain:is_plat("watchos") then
- target = target .. "-apple-watchos"
- end
- if toolchain:config("appledev") == "simulator" then
- target = target .. "-sim"
- end
- elseif toolchain:is_plat("bsd") then
- target = target .. "-unknown-freebsd"
- elseif toolchain:is_plat("wasm") then
- target = target .. "-unknown-unknown"
- end
+ local opt = {}
+ if toolchain:config("appledev") == "simulator" then
+ opt.apple_sim = true
end
-
+
+ local target = target_triple(toolchain:plat(), toolchain:arch(), opt)
if target then
toolchain:add("rcflags", "--target=" .. target)
else