diff --git a/Cargo.toml b/Cargo.toml index 28d9d9e7c2..5731d55c56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,6 @@ wasmtime-jit = { path = "wasmtime-jit" } wasmtime-obj = { path = "wasmtime-obj" } wasmtime-wast = { path = "wasmtime-wast" } wasmtime-wasi = { path = "wasmtime-wasi" } -wasmtime-wasi-c = { path = "wasmtime-wasi-c" } docopt = "1.0.1" serde = "1.0.75" serde_derive = "1.0.75" @@ -43,6 +42,9 @@ wabt = "0.7" libc = "0.2.50" errno = "0.2.4" +[target.'cfg(unix)'.dependencies] +wasmtime-wasi-c = { path = "wasmtime-wasi-c" } + [workspace] [features] diff --git a/src/wasmtime.rs b/src/wasmtime.rs index c573e3a7de..e2730a9956 100644 --- a/src/wasmtime.rs +++ b/src/wasmtime.rs @@ -50,9 +50,11 @@ use std::process::exit; use wabt; use wasmtime_jit::{ActionOutcome, Context}; use wasmtime_wasi::instantiate_wasi; -use wasmtime_wasi_c::instantiate_wasi_c; use wasmtime_wast::instantiate_spectest; +#[cfg(unix)] +use wasmtime_wasi_c::instantiate_wasi_c; + static LOG_FILENAME_PREFIX: &str = "wasmtime.dbg."; const USAGE: &str = " @@ -235,7 +237,14 @@ fn main() { let wasi = if args.flag_wasi_common { instantiate_wasi("", global_exports, &preopen_dirs, &argv, &environ) } else { - instantiate_wasi_c("", global_exports, &preopen_dirs, &argv, &environ) + #[cfg(unix)] + { + instantiate_wasi_c("", global_exports, &preopen_dirs, &argv, &environ) + } + #[cfg(not(unix))] + { + unimplemented!("wasmtime-wasi-c requires a *nix") + } } .expect("instantiating wasi");