diff options
| author | SirLynix <[email protected]> | 2025-05-07 19:14:13 +0200 |
|---|---|---|
| committer | SirLynix <[email protected]> | 2025-05-07 19:14:13 +0200 |
| commit | c05d4bf0adc8a4d8a320b960d6383832775f13de (patch) | |
| tree | 340317b895100a0a8ac67cada55c03d04118ba7d /xmake/toolchains/rust/xmake.lua | |
| parent | 7301a531f1581e5b22897c13c66d2704c493dbd9 (diff) | |
cargo: fix package cross-compilation
Diffstat (limited to 'xmake/toolchains/rust/xmake.lua')
| -rw-r--r-- | xmake/toolchains/rust/xmake.lua | 56 |
1 files changed, 6 insertions, 50 deletions
diff --git a/xmake/toolchains/rust/xmake.lua b/xmake/toolchains/rust/xmake.lua index 8a1edce09..628c55727 100644 --- a/xmake/toolchains/rust/xmake.lua +++ b/xmake/toolchains/rust/xmake.lua @@ -28,58 +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" + local opt = {} + if toolchain:config("appledev") == "simulator" then + opt.apple_sim = true end - - 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 - end - + + local target = import("private.tools.rust.target_triple")(toolchain:plat(), toolchain:arch(), opt) if target then + toolchain:add("rcflags", "--verbose") toolchain:add("rcflags", "--target=" .. target) else toolchain:set("rcshflags", "") |
