authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-02 23:47:37+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-02 23:58:55+02:00
logc3f2222a59af4c189562b63c45ead23b02cda5cc
treed2a5850ff4e1c10704017f3c68473ce15b1588a1
parent11db7eaf4efd0305c294a53c74e022e2231f67d3
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.zig.system: Make getExternalExecutor() less opinionated about Wasmtime.

Wasmtime supports both wasm32 and wasm64, and can run freestanding WASM binaries just fine (although the usefulness of the latter is fairly limited).

1 files changed, 4 insertions(+), 9 deletions(-)

lib/std/zig/system.zig+4-9
......@@ -125,6 +125,10 @@ pub fn getExternalExecutor(
125125 };
126126 }
127127
128 if (options.allow_wasmtime and candidate.cpu.arch.isWasm()) {
129 return Executor{ .wasmtime = "wasmtime" };
130 }
131
128132 switch (candidate.os.tag) {
129133 .windows => {
130134 if (options.allow_wine) {
......@@ -142,15 +146,6 @@ pub fn getExternalExecutor(
142146 }
143147 return bad_result;
144148 },
145 .wasi => {
146 if (options.allow_wasmtime) {
147 switch (candidate.ptrBitWidth()) {
148 32 => return Executor{ .wasmtime = "wasmtime" },
149 else => return bad_result,
150 }
151 }
152 return bad_result;
153 },
154149 .macos => {
155150 if (options.allow_darling) {
156151 // This check can be loosened once darling adds a QEMU-based emulation