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(...@@ -125,6 +125,10 @@ pub fn getExternalExecutor(
125 };125 };
126 }126 }
127127
128 if (options.allow_wasmtime and candidate.cpu.arch.isWasm()) {
129 return Executor{ .wasmtime = "wasmtime" };
130 }
131
128 switch (candidate.os.tag) {132 switch (candidate.os.tag) {
129 .windows => {133 .windows => {
130 if (options.allow_wine) {134 if (options.allow_wine) {
...@@ -142,15 +146,6 @@ pub fn getExternalExecutor(...@@ -142,15 +146,6 @@ pub fn getExternalExecutor(
142 }146 }
143 return bad_result;147 return bad_result;
144 },148 },
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 },
154 .macos => {149 .macos => {
155 if (options.allow_darling) {150 if (options.allow_darling) {
156 // This check can be loosened once darling adds a QEMU-based emulation151 // This check can be loosened once darling adds a QEMU-based emulation