-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.rs
More file actions
32 lines (27 loc) · 1.03 KB
/
Copy pathbuild.rs
File metadata and controls
32 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
extern crate bindgen;
use std::env;
use std::path::PathBuf;
fn main() {
println!("cargo:rerun-if-changed=sqlite3/sqlite3.h");
println!("cargo:rerun-if-changed=sqlite3/sqlite3ext.h");
let vars = bindgen::Builder::default()
.header("sqlite3/sqlite3ext.h")
.allowlist_item("SQLITE_.*")
.use_core()
.default_macro_constant_type(bindgen::MacroTypeVariation::Signed)
.generate()
.expect("Unable to generate bindings");
let bindings = bindgen::Builder::default()
.header("sqlite3/sqlite3ext.h")
.blocklist_item("SQLITE_.*")
.use_core()
.default_macro_constant_type(bindgen::MacroTypeVariation::Signed)
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR should be defined"));
vars.write_to_file(out_path.join("vars.rs"))
.expect("Couldn't write vars!");
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}