use WASI_ROOT env var to specify witx paths to wiggle macros

This commit is contained in:
Pat Hickey
2020-08-28 15:42:51 -07:00
parent 91dac9c7e8
commit 22b427baa0
2 changed files with 4 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
use crate::WasiCtx; use crate::WasiCtx;
wiggle::from_witx!({ wiggle::from_witx!({
witx: ["WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx"], witx: ["$WASI_ROOT/phases/snapshot/witx/wasi_snapshot_preview1.witx"],
ctx: WasiCtx, ctx: WasiCtx,
}); });

View File

@@ -9,8 +9,9 @@ pub use wasi_common::{WasiCtx, WasiCtxBuilder};
wasmtime_wiggle::wasmtime_integration!({ wasmtime_wiggle::wasmtime_integration!({
// The wiggle code to integrate with lives here: // The wiggle code to integrate with lives here:
target: wasi_common::wasi, target: wasi_common::wasi,
// This must be the same witx document as used above: // This must be the same witx document as used above. This should be ensured by
witx: ["../wasi-common/WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx"], // the `WASI_ROOT` env variable, which is set in wasi-common's `build.rs`.
witx: ["$WASI_ROOT/phases/snapshot/witx/wasi_snapshot_preview1.witx"],
// This must be the same ctx type as used for the target: // This must be the same ctx type as used for the target:
ctx: WasiCtx, ctx: WasiCtx,
// This macro will emit a struct to represent the instance, // This macro will emit a struct to represent the instance,