From 73f1ef817f1029504975f241eea2f94e9c4a9fbe Mon Sep 17 00:00:00 2001 From: kpcyrd Date: Fri, 21 Jun 2019 06:31:13 +0200 Subject: [PATCH] Add bundled-windows feature --- libsqlite3-sys/Cargo.toml | 1 + libsqlite3-sys/build.rs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libsqlite3-sys/Cargo.toml b/libsqlite3-sys/Cargo.toml index f7337ef..9a7ce17 100644 --- a/libsqlite3-sys/Cargo.toml +++ b/libsqlite3-sys/Cargo.toml @@ -14,6 +14,7 @@ categories = ["external-ffi-bindings"] [features] default = ["min_sqlite_version_3_6_8"] bundled = ["cc"] +bundled-windows = ["cc"] buildtime_bindgen = ["bindgen", "pkg-config", "vcpkg"] sqlcipher = [] min_sqlite_version_3_6_8 = ["pkg-config", "vcpkg"] diff --git a/libsqlite3-sys/build.rs b/libsqlite3-sys/build.rs index 8c36224..90e337a 100644 --- a/libsqlite3-sys/build.rs +++ b/libsqlite3-sys/build.rs @@ -5,7 +5,7 @@ fn main() { let out_dir = env::var("OUT_DIR").unwrap(); let out_path = Path::new(&out_dir).join("bindgen.rs"); if cfg!(feature = "sqlcipher") { - if cfg!(feature = "bundled") { + if cfg!(any(feature = "bundled", all(windows, feature="bundled-windows"))) { println!( "cargo:warning={}", "Builds with bundled SQLCipher are not supported. Searching for SQLCipher to link against. \ @@ -15,18 +15,18 @@ fn main() { } else { // This can't be `cfg!` without always requiring our `mod build_bundled` (and // thus `cc`) - #[cfg(feature = "bundled")] + #[cfg(any(feature = "bundled", all(windows, feature="bundled-windows")))] { build_bundled::main(&out_dir, &out_path) } - #[cfg(not(feature = "bundled"))] + #[cfg(not(any(feature = "bundled", all(windows, feature="bundled-windows"))))] { build_linked::main(&out_dir, &out_path) } } } -#[cfg(feature = "bundled")] +#[cfg(any(feature = "bundled", all(windows, feature="bundled-windows")))] mod build_bundled { use cc; use std::env; @@ -142,7 +142,7 @@ mod build_linked { pub fn main(_out_dir: &str, out_path: &Path) { let header = find_sqlite(); - if cfg!(feature = "bundled") && !cfg!(feature = "buildtime_bindgen") { + if cfg!(any(feature = "bundled", all(windows, feature="bundled-windows"))) && !cfg!(feature = "buildtime_bindgen") { // We can only get here if `bundled` and `sqlcipher` were both // specified (and `builtime_bindgen` was not). In order to keep // `rusqlite` relatively clean we hide the fact that `bundled` can