Skip to content

Commit

Permalink
Android support (with cargo-ndk)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yesterday17 committed Jul 2, 2023
1 parent b9941d2 commit 80542b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ fn build_opus(is_static: bool) {

println!("cargo:info=Building Opus via CMake.");
let mut cmake_config = cmake::Config::new(opus_path);

if let Ok(android_target) = env::var("CARGO_NDK_ANDROID_TARGET") {
cmake_config.define("ANDROID_ABI", android_target);

if let Ok(toolchain_file) = env::var("CARGO_NDK_CMAKE_TOOLCHAIN_PATH") {
cmake_config.define("CMAKE_TOOLCHAIN_FILE", toolchain_file);
}
}

if let Ok(value) = env::var("CMAKE_OSX_SYSROOT") {
cmake_config.configure_arg(format!("-DCMAKE_OSX_SYSROOT={value}"));
}
Expand Down

0 comments on commit 80542b5

Please sign in to comment.