Remove unnecessary sysroot and platform configuration from build script.

This commit is contained in:
Josh Matthews 2018-09-20 15:42:04 -04:00 committed by GitHub
parent ac331c6663
commit 9d52fb88ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,36 +24,14 @@ fn android_main() {
env::var_os("ANDROID_NDK").expect("Please set the ANDROID_NDK environment variable");
let ndk_path = Path::new(&ndk_path);
let target = env::var("TARGET").unwrap();
let arch = if target.contains("arm") {
"arch-arm"
} else if target.contains("aarch64") {
"arch-arm64"
} else if target.contains("x86") || target.contains("i686") {
"arch-x86"
} else if target.contains("mips") {
"arch-mips"
} else {
panic!("Invalid target architecture {}", target);
};
let platform = if target.contains("aarch64") {
"android-21"
} else {
"android-18"
};
// compiling android_native_app_glue.c
let c_file = ndk_path
.join("sources")
.join("android")
.join("native_app_glue")
.join("android_native_app_glue.c");
let sysroot = ndk_path.join("platforms").join(platform).join(arch);
cc::Build::new()
.file(c_file)
.flag("--sysroot")
.flag(sysroot.to_str().unwrap())
.warnings(false)
.compile("android_native_app_glue");