authorgravatar for contact@fengb.meBenjamin Feng <contact@fengb.me> 2019-11-20 00:56:34-06:00
committergravatar for benjamin.feng@glassdoor.comBenjamin Feng <benjamin.feng@glassdoor.com> 2019-11-20 12:06:21-06:00
logd27721f58cfeff5fcd805125875e9c55b54b65bd
tree781c2e2111294e4bb9b9f2e1601c6ff096f2639a
parent218f9ff34e94511489d42f41831bc249464ed853

Add .enable_wasmtime build flag


2 files changed, 16 insertions(+), 0 deletions(-)

lib/std/build.zig+8
......@@ -1064,6 +1064,9 @@ pub const LibExeObjStep = struct {
10641064 /// Uses system QEMU installation to run cross compiled foreign architecture build artifacts.
10651065 enable_qemu: bool = false,
10661066
1067 /// Uses system Wasmtime installation to run cross compiled wasm/wasi build artifacts.
1068 enable_wasmtime: bool = false,
1069
10671070 /// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc,
10681071 /// this will be the directory $glibc-build-dir/install/glibcs
10691072 /// Given the example of the aarch64 target, this is the directory
......@@ -1863,6 +1866,11 @@ pub const LibExeObjStep = struct {
18631866 try zig_args.append(bin_name);
18641867 try zig_args.append("--test-cmd-bin");
18651868 },
1869 .wasmtime => |bin_name| if (self.enable_wasmtime) {
1870 try zig_args.append("--test-cmd");
1871 try zig_args.append(bin_name);
1872 try zig_args.append("--test-cmd-bin");
1873 },
18661874 }
18671875 for (self.packages.toSliceConst()) |pkg| {
18681876 zig_args.append("--pkg-begin") catch unreachable;
lib/std/target.zig+8
......@@ -611,6 +611,7 @@ pub const Target = union(enum) {
611611 native,
612612 qemu: []const u8,
613613 wine: []const u8,
614 wasmtime: []const u8,
614615 unavailable,
615616 };
616617
......@@ -649,6 +650,13 @@ pub const Target = union(enum) {
649650 }
650651 }
651652
653 if (self.isWasm()) {
654 switch (self.getArchPtrBitWidth()) {
655 32 => return Executor{ .wasmtime = "wasmtime" },
656 else => return .unavailable,
657 }
658 }
659
652660 return .unavailable;
653661 }
654662};