Skip to content

Commit

Permalink
Fix build on android-x86 and rename function
Browse files Browse the repository at this point in the history
... because we add ndk_compat and the function installs
android-specific dependencies.

Signed-off-by: Vasyl Gello <[email protected]>
  • Loading branch information
basilgello committed Nov 1, 2023
1 parent c8f8bfd commit 0805b00
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ fn build_manifest() {
}
}

fn install_oboe() {
fn install_android_deps() {
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
if target_os != "android" {
return;
}
let mut target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if target_arch == "x86_64" {
target_arch = "x64".to_owned();
} else if target_arch == "x86" {
target_arch = "x86".to_owned();
} else if target_arch == "aarch64" {
target_arch = "arm64".to_owned();
} else {
Expand All @@ -66,6 +68,7 @@ fn install_oboe() {
path.join("lib").to_str().unwrap()
)
);
println!("cargo:rustc-link-lib=ndk_compat");
println!("cargo:rustc-link-lib=oboe");
println!("cargo:rustc-link-lib=c++");
println!("cargo:rustc-link-lib=OpenSLES");
Expand All @@ -78,7 +81,7 @@ fn install_oboe() {

fn main() {
hbb_common::gen_version();
install_oboe();
install_android_deps();
// 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();
// if target_os == "android" || target_os == "ios" {
Expand Down

0 comments on commit 0805b00

Please sign in to comment.