mirror of
https://github.com/isar/rusqlite.git
synced 2025-08-20 12:59:28 +08:00
@@ -22,6 +22,10 @@ min_sqlite_version_3_7_7 = ["pkg-config", "vcpkg"]
|
||||
min_sqlite_version_3_7_16 = ["pkg-config", "vcpkg"]
|
||||
# sqlite3_unlock_notify >= 3.6.12
|
||||
unlock_notify = []
|
||||
# 3.13.0
|
||||
preupdate_hook = []
|
||||
# 3.13.0
|
||||
session = ["preupdate_hook"]
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = { version = "0.46", optional = true }
|
||||
|
@@ -54,6 +54,12 @@ mod build {
|
||||
if cfg!(feature = "unlock_notify") {
|
||||
cfg.flag("-DSQLITE_ENABLE_UNLOCK_NOTIFY");
|
||||
}
|
||||
if cfg!(feature = "preupdate_hook") {
|
||||
cfg.flag("-DSQLITE_ENABLE_PREUPDATE_HOOK");
|
||||
}
|
||||
if cfg!(feature = "session") {
|
||||
cfg.flag("-DSQLITE_ENABLE_SESSION");
|
||||
}
|
||||
cfg.compile("libsqlite3.a");
|
||||
|
||||
println!("cargo:lib_dir={}", out_dir);
|
||||
@@ -237,10 +243,22 @@ mod bindings {
|
||||
pub fn write_to_out_dir(header: HeaderLocation, out_path: &Path) {
|
||||
let header: String = header.into();
|
||||
let mut output = Vec::new();
|
||||
bindgen::builder()
|
||||
let mut bindings = bindgen::builder()
|
||||
.header(header.clone())
|
||||
.parse_callbacks(Box::new(SqliteTypeChooser))
|
||||
.rustfmt_bindings(true)
|
||||
.rustfmt_bindings(true);
|
||||
|
||||
if cfg!(feature = "unlock_notify") {
|
||||
bindings = bindings.clang_arg("-DSQLITE_ENABLE_UNLOCK_NOTIFY");
|
||||
}
|
||||
if cfg!(feature = "preupdate_hook") {
|
||||
bindings = bindings.clang_arg("-DSQLITE_ENABLE_PREUPDATE_HOOK");
|
||||
}
|
||||
if cfg!(feature = "session") {
|
||||
bindings = bindings.clang_arg("-DSQLITE_ENABLE_SESSION");
|
||||
}
|
||||
|
||||
bindings
|
||||
.generate()
|
||||
.expect(&format!("could not run bindgen on header {}", header))
|
||||
.write(Box::new(&mut output))
|
||||
|
Reference in New Issue
Block a user