diff --git a/README.md b/README.md index 2432015..6ae8587 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,12 @@ cd temporalz ```bash zig build run + +# Node.js +zig build run -Dtarget=wasm32-freestanding + +# wasmtime +zig build run -Dtarget=wasm32-wasi ``` #### Run Tests diff --git a/example/build.zig b/example/build.zig index 5b93c18..b121d51 100644 --- a/example/build.zig +++ b/example/build.zig @@ -20,7 +20,7 @@ pub fn build(b: *std.Build) void { }); exe.root_module.addImport("temporalz", temporalz.module("temporalz")); b.installArtifact(exe); - b.enable_wasmtime = true; + b.enable_wasmtime = true; // This doesn't work since Zig 0.17.0 release const run_step = b.step("run", "Run the app"); switch (target.result.os.tag) { @@ -29,6 +29,12 @@ pub fn build(b: *std.Build) void { run_cmd.step.dependOn(b.getInstallStep()); run_step.dependOn(&run_cmd.step); }, + .wasi => { + const run_cmd = b.addSystemCommand(&.{"wasmtime"}); + run_cmd.addFileArg(exe.getEmittedBin()); + run_cmd.step.dependOn(b.getInstallStep()); + run_step.dependOn(&run_cmd.step); + }, else => { const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep());