diff --git a/Cargo.toml b/Cargo.toml index 76eef15..09a3589 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,6 +60,7 @@ bundled-windows = ["libsqlite3-sys/bundled-windows"] # Build bundled sqlite with -fsanitize=address with-asan = ["libsqlite3-sys/with-asan"] column_decltype = [] +wasm32-wasi-vfs = ["libsqlite3-sys/wasm32-wasi-vfs"] # Helper feature for enabling both `bundled` and most non-build-related optional # features or dependencies. This is useful for running tests / clippy / etc. New diff --git a/libsqlite3-sys/Cargo.toml b/libsqlite3-sys/Cargo.toml index a98c1ad..13ef456 100644 --- a/libsqlite3-sys/Cargo.toml +++ b/libsqlite3-sys/Cargo.toml @@ -32,6 +32,7 @@ preupdate_hook = ["buildtime_bindgen"] session = ["preupdate_hook", "buildtime_bindgen"] in_gecko = [] with-asan = [] +wasm32-wasi-vfs = [] [build-dependencies] bindgen = { version = "0.54", optional = true, default-features = false, features = ["runtime"] } diff --git a/libsqlite3-sys/build.rs b/libsqlite3-sys/build.rs index f10217d..8b1927b 100644 --- a/libsqlite3-sys/build.rs +++ b/libsqlite3-sys/build.rs @@ -111,10 +111,12 @@ mod build_bundled { } // Target wasm32-wasi can't compile the default VFS if env::var("TARGET") == Ok("wasm32-wasi".to_string()) { - cfg.file("sqlite3/wasm32-wasi-vfs.c") - .flag("-DSQLITE_OS_OTHER") + cfg.flag("-DSQLITE_OS_OTHER") // https://github.com/rust-lang/rust/issues/74393 .flag("-DLONGDOUBLE_TYPE=double"); + if cfg!(feature = "wasm32-wasi-vfs") { + cfg.file("sqlite3/wasm32-wasi-vfs.c"); + } } if cfg!(feature = "unlock_notify") { cfg.flag("-DSQLITE_ENABLE_UNLOCK_NOTIFY");