use bindgen;
use std::{env, fs, path::{Path, PathBuf}};
fn main() {
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
fs::copy(
"./SpeechSDK/lib/x64/libMicrosoft.CognitiveServices.Speech.core.so",
Path::new(&out_path).join(
"libMicrosoft.CognitiveServices.Speech.core.so"
)
).unwrap();
println!("cargo:rustc-link-search=native={}", out_path.display());
println!(
"cargo:rustc-link-lib=dylib=Microsoft.CognitiveServices.Speech.core"
);
let bindings = bindgen::Builder::default()
.header("c_api/wrapper.h")
.clang_arg("-ISpeechSDK/include/c_api/")
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}