diff options
| author | ruki <[email protected]> | 2023-11-11 22:23:08 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-11 22:23:08 +0800 |
| commit | e6504c8d0a4d42d2a57b68f9d25a0cbbb2c8289e (patch) | |
| tree | e83b35429d67134df6d00743b71dc74437ca6bb0 | |
| parent | f205de61c97bad8457838272b33c37d876063851 (diff) | |
fix target for rust
| -rw-r--r-- | xmake/toolchains/ndk/load.lua | 14 | ||||
| -rw-r--r-- | xmake/toolchains/rust/xmake.lua | 13 |
2 files changed, 13 insertions, 14 deletions
diff --git a/xmake/toolchains/ndk/load.lua b/xmake/toolchains/ndk/load.lua index 325c2f807..2b5b7b8f5 100644 --- a/xmake/toolchains/ndk/load.lua +++ b/xmake/toolchains/ndk/load.lua @@ -322,20 +322,6 @@ function main(toolchain) toolchain:add("target.on_ldflags", target_on_xxflags) toolchain:add("target.on_shflags", target_on_xxflags) - -- init targets for rust - local targets_rust = - { - ["armv5te"] = "arm-linux-androideabi" -- deprecated - , ["armv7-a"] = "arm-linux-androideabi" -- deprecated - , ["armeabi"] = "arm-linux-androideabi" -- removed in ndk r17 - , ["armeabi-v7a"] = "arm-linux-androideabi" - , ["arm64-v8a"] = "aarch64-linux-android" - } - - -- init flags for rust - if targets_rust[arch] then - toolchain:add("rcflags", "--target=" .. targets_rust[arch]) - end local rcshflags = table.copy(toolchain:get("shflags")) local rcldflags = table.copy(toolchain:get("ldflags")) for _, link in ipairs(toolchain:get("syslinks")) do diff --git a/xmake/toolchains/rust/xmake.lua b/xmake/toolchains/rust/xmake.lua index e997eaa21..210e1b727 100644 --- a/xmake/toolchains/rust/xmake.lua +++ b/xmake/toolchains/rust/xmake.lua @@ -29,8 +29,21 @@ toolchain("rust") set_toolset("rcar", "$(env RC)", "rustc") on_load(function (toolchain) + -- e.g. x86_64-pc-windows-msvc, aarch64-unknown-none local arch = toolchain:arch() + if toolchain:is_plat("android") then + local targets = { + ["armv5te"] = "arm-linux-androideabi" -- deprecated + , ["armv7-a"] = "arm-linux-androideabi" -- deprecated + , ["armeabi"] = "arm-linux-androideabi" -- removed in ndk r17 + , ["armeabi-v7a"] = "arm-linux-androideabi" + , ["arm64-v8a"] = "aarch64-linux-android" + } + if targets[arch] then + arch = targets[arch] + end + end if arch and #arch:split("%-") > 1 then toolchain:add("rcshflags", "--target=" .. arch) toolchain:add("rcldflags", "--target=" .. arch) |
