Fix build on android-x86 and rename function

... because we add ndk_compat and the function installs
android-specific dependencies.

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This commit is contained in:
Vasyl Gello 2023-11-01 11:37:39 +02:00
parent c8f8bfd6f0
commit 0805b00c50

View File

@ -41,7 +41,7 @@ fn build_manifest() {
} }
} }
fn install_oboe() { fn install_android_deps() {
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
if target_os != "android" { if target_os != "android" {
return; return;
@ -49,6 +49,8 @@ fn install_oboe() {
let mut target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap(); let mut target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if target_arch == "x86_64" { if target_arch == "x86_64" {
target_arch = "x64".to_owned(); target_arch = "x64".to_owned();
} else if target_arch == "x86" {
target_arch = "x86".to_owned();
} else if target_arch == "aarch64" { } else if target_arch == "aarch64" {
target_arch = "arm64".to_owned(); target_arch = "arm64".to_owned();
} else { } else {
@ -66,6 +68,7 @@ fn install_oboe() {
path.join("lib").to_str().unwrap() path.join("lib").to_str().unwrap()
) )
); );
println!("cargo:rustc-link-lib=ndk_compat");
println!("cargo:rustc-link-lib=oboe"); println!("cargo:rustc-link-lib=oboe");
println!("cargo:rustc-link-lib=c++"); println!("cargo:rustc-link-lib=c++");
println!("cargo:rustc-link-lib=OpenSLES"); println!("cargo:rustc-link-lib=OpenSLES");
@ -78,7 +81,7 @@ fn install_oboe() {
fn main() { fn main() {
hbb_common::gen_version(); hbb_common::gen_version();
install_oboe(); install_android_deps();
// there is problem with cfg(target_os) in build.rs, so use our workaround // there is problem with cfg(target_os) in build.rs, so use our workaround
// let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); // let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
// if target_os == "android" || target_os == "ios" { // if target_os == "android" || target_os == "ios" {