chore: update

This commit is contained in:
skdhg committed 2023-08-11 17:33:07 +05:45
1 parent 9077961fe5
commit 7935696892
4 files changed
+154 -143

No files matched your search

+17 -2
View File
@@ -2,9 +2,9 @@
extern crate napi_build;
use bindgen;
use std::path::PathBuf;
use std::{env, fmt::Display, path::Path};
use bindgen;
const fn rustc_linking_word(is_static_link: bool) -> &'static str {
if is_static_link {
@@ -45,7 +45,22 @@ fn build_opus(is_static: bool) {
);
println!("cargo:info=Building Opus via CMake.");
let opus_build_dir = cmake::build(opus_path);
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}"));
}
let opus_build_dir = cmake_config.build();
link_opus(is_static, opus_build_dir.display())
}