Merge pull request #537 from kpcyrd/bundled-windows

Add bundled-windows feature
This commit is contained in:
gwenn 2019-06-21 18:03:04 +02:00 committed by GitHub
commit b632c0f8be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -14,6 +14,7 @@ categories = ["external-ffi-bindings"]
[features] [features]
default = ["min_sqlite_version_3_6_8"] default = ["min_sqlite_version_3_6_8"]
bundled = ["cc"] bundled = ["cc"]
bundled-windows = ["cc"]
buildtime_bindgen = ["bindgen", "pkg-config", "vcpkg"] buildtime_bindgen = ["bindgen", "pkg-config", "vcpkg"]
sqlcipher = [] sqlcipher = []
min_sqlite_version_3_6_8 = ["pkg-config", "vcpkg"] min_sqlite_version_3_6_8 = ["pkg-config", "vcpkg"]

View File

@ -5,7 +5,7 @@ fn main() {
let out_dir = env::var("OUT_DIR").unwrap(); let out_dir = env::var("OUT_DIR").unwrap();
let out_path = Path::new(&out_dir).join("bindgen.rs"); let out_path = Path::new(&out_dir).join("bindgen.rs");
if cfg!(feature = "sqlcipher") { if cfg!(feature = "sqlcipher") {
if cfg!(feature = "bundled") { if cfg!(any(feature = "bundled", all(windows, feature="bundled-windows"))) {
println!( println!(
"cargo:warning={}", "cargo:warning={}",
"Builds with bundled SQLCipher are not supported. Searching for SQLCipher to link against. \ "Builds with bundled SQLCipher are not supported. Searching for SQLCipher to link against. \
@ -15,18 +15,18 @@ fn main() {
} else { } else {
// This can't be `cfg!` without always requiring our `mod build_bundled` (and // This can't be `cfg!` without always requiring our `mod build_bundled` (and
// thus `cc`) // thus `cc`)
#[cfg(feature = "bundled")] #[cfg(any(feature = "bundled", all(windows, feature="bundled-windows")))]
{ {
build_bundled::main(&out_dir, &out_path) 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) build_linked::main(&out_dir, &out_path)
} }
} }
} }
#[cfg(feature = "bundled")] #[cfg(any(feature = "bundled", all(windows, feature="bundled-windows")))]
mod build_bundled { mod build_bundled {
use cc; use cc;
use std::env; use std::env;
@ -142,7 +142,7 @@ mod build_linked {
pub fn main(_out_dir: &str, out_path: &Path) { pub fn main(_out_dir: &str, out_path: &Path) {
let header = find_sqlite(); 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 // We can only get here if `bundled` and `sqlcipher` were both
// specified (and `builtime_bindgen` was not). In order to keep // specified (and `builtime_bindgen` was not). In order to keep
// `rusqlite` relatively clean we hide the fact that `bundled` can // `rusqlite` relatively clean we hide the fact that `bundled` can