Commit d27721f58c
Changed files (2)
lib
lib/std/build.zig
@@ -1064,6 +1064,9 @@ pub const LibExeObjStep = struct {
/// Uses system QEMU installation to run cross compiled foreign architecture build artifacts.
enable_qemu: bool = false,
+ /// Uses system Wasmtime installation to run cross compiled wasm/wasi build artifacts.
+ enable_wasmtime: bool = false,
+
/// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc,
/// this will be the directory $glibc-build-dir/install/glibcs
/// Given the example of the aarch64 target, this is the directory
@@ -1863,6 +1866,11 @@ pub const LibExeObjStep = struct {
try zig_args.append(bin_name);
try zig_args.append("--test-cmd-bin");
},
+ .wasmtime => |bin_name| if (self.enable_wasmtime) {
+ try zig_args.append("--test-cmd");
+ try zig_args.append(bin_name);
+ try zig_args.append("--test-cmd-bin");
+ },
}
for (self.packages.toSliceConst()) |pkg| {
zig_args.append("--pkg-begin") catch unreachable;
lib/std/target.zig
@@ -611,6 +611,7 @@ pub const Target = union(enum) {
native,
qemu: []const u8,
wine: []const u8,
+ wasmtime: []const u8,
unavailable,
};
@@ -649,6 +650,13 @@ pub const Target = union(enum) {
}
}
+ if (self.isWasm()) {
+ switch (self.getArchPtrBitWidth()) {
+ 32 => return Executor{ .wasmtime = "wasmtime" },
+ else => return .unavailable,
+ }
+ }
+
return .unavailable;
}
};