summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-03-09 13:12:16 +0800
committerruki <[email protected]>2017-03-09 13:12:16 +0800
commited39ed0419524b43830014bfe4ac788040f6de1b (patch)
tree62b94aaf05097bc2efc650041aa87cf1aeddac17
parent7ffea57f8fceaf7f4684057328457ab0b1a763e0 (diff)
add rust for android
-rw-r--r--xmake/platforms/android/check.lua6
-rw-r--r--xmake/platforms/android/load.lua15
2 files changed, 21 insertions, 0 deletions
diff --git a/xmake/platforms/android/check.lua b/xmake/platforms/android/check.lua
index 7962d1740..f19b97a24 100644
--- a/xmake/platforms/android/check.lua
+++ b/xmake/platforms/android/check.lua
@@ -136,6 +136,12 @@ function _check_toolchains(config)
checker.check_toolchain(config, "ex", cross, "ar", "the static library extractor")
checker.check_toolchain(config, "sh", cross, "g++", "the shared library linker")
checker.check_toolchain(config, "sh", cross, "gcc", "the shared library linker")
+
+ -- check for rust tools
+ checker.check_toolchain(config, "rc", "", "rustc", "the rust compiler")
+ checker.check_toolchain(config, "rc-ar", "", "rustc", "the rust static library archiver")
+ checker.check_toolchain(config, "rc-sh", "", "rustc", "the rust shared library linker")
+ checker.check_toolchain(config, "rc-ld", "", "rustc", "the rust linker")
end
-- check it
diff --git a/xmake/platforms/android/load.lua b/xmake/platforms/android/load.lua
index ad6e691c7..ff04b8168 100644
--- a/xmake/platforms/android/load.lua
+++ b/xmake/platforms/android/load.lua
@@ -101,6 +101,21 @@ function main()
end
end
+ -- init targets for rust
+ local targets =
+ {
+ ["armv5te"] = "arm-linux-androideabi"
+ , ["armv6"] = "arm-linux-androideabi"
+ , ["armv7-a"] = "arm-linux-androideabi"
+ , ["armv8-a"] = "arm-linux-androideabi"
+ , ["arm64-v8a"] = "aarch64-linux-android"
+ }
+
+ -- init flags for rust
+ _g.rcflags = { "--target=" .. targets[arch] }
+ _g["rc-shflags"] = { }
+ _g["rc-ldflags"] = { }
+
-- ok
return _g
end