extern crate cc;
use std::fs::read_dir;
use std::path::Path;
const SCUDO_RUST_WRAPPER: &str = "src/scudo_rust_wrapper.cpp";
fn main() {
println!("cargo:rerun-if-changed={}", SCUDO_RUST_WRAPPER);
let scudo_dir = Path::new("scudo-standalone");
let scudo_cpp_files = read_dir(scudo_dir).unwrap().filter_map(|e| {
let entry = e.unwrap();
let path = entry.path();
let filename = path.file_name().unwrap().to_str().unwrap();
if filename.ends_with("cpp") && !filename.starts_with("wrapper") {
Some(path)
} else {
None
}
});
cc::Build::new()
.files(scudo_cpp_files)
.file(SCUDO_RUST_WRAPPER)
.include(scudo_dir)
.include(scudo_dir.join("include"))
.cpp(true)
.pic(true) .shared_flag(true)
.compile("scudo");
}