cvode-rust-wrap/cvode-5-sys/build.rs
2021-05-15 11:36:24 +02:00

24 lines
690 B
Rust

use bindgen::builder;
use std::env;
use std::path::Path;
fn main() -> anyhow::Result<()> {
for lib in &["sundials_cvodes", "sundials_nvecserial"] {
println!("cargo:rustc-link-lib={}", lib);
}
let out_dir = env::var_os("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("generated.rs");
let bindings = builder()
.header("src/include.h")
.generate()
.map_err(|()| anyhow::anyhow!("Couldn't generate bindings."))?;
// Write the generated bindings to an output file.
bindings.write_to_file(dest_path)?;
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/include.h");
Ok(())
}