get more heavy-handed with compilation requirements

This commit is contained in:
Emil Lerch 2024-05-08 15:46:33 -07:00
parent e1761cc95e
commit 0c4d5808b8
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -78,6 +78,10 @@ pub fn build(b: *std.Build) void {
} }
pub fn configureBuild(b: *std.Build, cs: *std.Build.Step.Compile, function_name: []const u8) !void { pub fn configureBuild(b: *std.Build, cs: *std.Build.Step.Compile, function_name: []const u8) !void {
if (cs.rootModuleTarget().os.tag != .wasi) {
std.log.err("Error: Cloudflare builds require compilation with -Dtarget=wasm32-wasi", .{});
return error.WasiCompilationRequired;
}
const script = @embedFile("index.js"); const script = @embedFile("index.js");
const wasm_name = try std.fmt.allocPrint(b.allocator, "{s}.wasm", .{cs.name}); const wasm_name = try std.fmt.allocPrint(b.allocator, "{s}.wasm", .{cs.name});
const deploy_cmd = CloudflareDeployStep.create( const deploy_cmd = CloudflareDeployStep.create(