Make the wasmtime-wasi-c dependency conditional on Unix.

This commit is contained in:
Dan Gohman
2019-05-21 05:44:29 -07:00
parent 06b6ec42b9
commit 635be8a032
2 changed files with 14 additions and 3 deletions

View File

@@ -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]

View File

@@ -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,8 +237,15 @@ fn main() {
let wasi = if args.flag_wasi_common {
instantiate_wasi("", global_exports, &preopen_dirs, &argv, &environ)
} else {
#[cfg(unix)]
{
instantiate_wasi_c("", global_exports, &preopen_dirs, &argv, &environ)
}
#[cfg(not(unix))]
{
unimplemented!("wasmtime-wasi-c requires a *nix")
}
}
.expect("instantiating wasi");
context.name_instance("wasi_unstable".to_owned(), wasi);