servicepoint/crates/servicepoint_binding_c/examples/lang_c/build.rs

18 lines
533 B
Rust
Raw Permalink Normal View History

const SP_INCLUDE: &str = "DEP_SERVICEPOINT_INCLUDE";
fn main() {
2024-05-30 21:55:55 +02:00
println!("cargo::rerun-if-changed=src/main.c");
println!("cargo::rerun-if-changed=build.rs");
println!("cargo::rerun-if-env-changed={SP_INCLUDE}");
2024-05-26 11:40:52 +02:00
let sp_include =
std::env::var_os(SP_INCLUDE).unwrap().into_string().unwrap();
2024-05-26 11:40:52 +02:00
// this builds a lib, this is only to check that the example compiles
let mut cc = cc::Build::new();
cc.file("src/main.c");
cc.include(&sp_include);
cc.opt_level(2);
2024-05-26 11:40:52 +02:00
cc.compile("lang_c");
}