omit default clang include dir path

pull/1/head
Yuri Setiantoko 10 years ago
parent 8dd27d8059
commit f772e1db30

@ -66,16 +66,30 @@ fn main() {
// Add include CLANG_INCLUDE_DIR so that several issue in searching // Add include CLANG_INCLUDE_DIR so that several issue in searching
// clang include dir // clang include dir
bindgen::builder() match env::var("CLANG_INCLUDE_DIR") {
.emit_builtins() Ok(dir) => {
.header(mongo_h_path.to_str().unwrap()) bindgen::builder()
.clang_arg(format!("-I{}", bson_path.to_str().unwrap())) .emit_builtins()
.clang_arg(format!("-I{}", env::var("CLANG_INCLUDE_DIR") .header(mongo_h_path.to_str().unwrap())
.unwrap_or(String::from("/usr/lib/clang/3.6.1/include")))) .clang_arg(format!("-I{}", bson_path.to_str().unwrap()))
.generate() .clang_arg(format!("-I{}", dir))
.unwrap() .generate()
.write_to_file(&bindings_rs_path) .unwrap()
.unwrap(); .write_to_file(&bindings_rs_path)
.unwrap();
},
Err(_) => {
bindgen::builder()
.emit_builtins()
.header(mongo_h_path.to_str().unwrap())
.clang_arg(format!("-I{}", bson_path.to_str().unwrap()))
.generate()
.unwrap()
.write_to_file(&bindings_rs_path)
.unwrap();
}
}
} }
// Output to Cargo // Output to Cargo

Loading…
Cancel
Save