Add .enable_wasmtime build flag

master
Benjamin Feng 2019-11-20 00:56:34 -06:00 committed by Benjamin Feng
parent 218f9ff34e
commit d27721f58c
2 changed files with 16 additions and 0 deletions

View File

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

View File

@ -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;
}
};