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 {...@@ -1064,6 +1064,9 @@ pub const LibExeObjStep = struct {
1064 /// Uses system QEMU installation to run cross compiled foreign architecture build artifacts.1064 /// Uses system QEMU installation to run cross compiled foreign architecture build artifacts.
1065 enable_qemu: bool = false,1065 enable_qemu: bool = false,
10661066
1067 /// Uses system Wasmtime installation to run cross compiled wasm/wasi build artifacts.
1068 enable_wasmtime: bool = false,
1069
1067 /// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc,1070 /// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc,
1068 /// this will be the directory $glibc-build-dir/install/glibcs1071 /// this will be the directory $glibc-build-dir/install/glibcs
1069 /// Given the example of the aarch64 target, this is the directory1072 /// Given the example of the aarch64 target, this is the directory
...@@ -1863,6 +1866,11 @@ pub const LibExeObjStep = struct {...@@ -1863,6 +1866,11 @@ pub const LibExeObjStep = struct {
1863 try zig_args.append(bin_name);1866 try zig_args.append(bin_name);
1864 try zig_args.append("--test-cmd-bin");1867 try zig_args.append("--test-cmd-bin");
1865 },1868 },
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 },
1866 }1874 }
1867 for (self.packages.toSliceConst()) |pkg| {1875 for (self.packages.toSliceConst()) |pkg| {
1868 zig_args.append("--pkg-begin") catch unreachable;1876 zig_args.append("--pkg-begin") catch unreachable;
lib/std/target.zig+8
...@@ -611,6 +611,7 @@ pub const Target = union(enum) {...@@ -611,6 +611,7 @@ pub const Target = union(enum) {
611 native,611 native,
612 qemu: []const u8,612 qemu: []const u8,
613 wine: []const u8,613 wine: []const u8,
614 wasmtime: []const u8,
614 unavailable,615 unavailable,
615 };616 };
616617
...@@ -649,6 +650,13 @@ pub const Target = union(enum) {...@@ -649,6 +650,13 @@ pub const Target = union(enum) {
649 }650 }
650 }651 }
651652
653 if (self.isWasm()) {
654 switch (self.getArchPtrBitWidth()) {
655 32 => return Executor{ .wasmtime = "wasmtime" },
656 else => return .unavailable,
657 }
658 }
659
652 return .unavailable;660 return .unavailable;
653 }661 }
654};662};