#zig build wasm target
1 messages · Page 1 of 1 (latest)
sure:
const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// MARK: - Client ----------------------------------------------------------
const client = b.addSharedLibrary(.{
.name = "client",
.root_source_file = .{ .path = "client/main.zig" },
.target = .{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
.abi = .none
},
.optimize = .ReleaseSafe // Change for debugging!
});
client.rdynamic = true;
client.strip = true;
error:
/Users/teampuzel/Projects/WebGame/build.zig:12:14: error: no field named 'cpu_arch' in struct 'Build.ResolvedTarget'
.cpu_arch = .wasm32,
^~~~~~~~
The target field seems to be of some ResolvedTarget type instead of Target now
It's code from many months ago and Zig seems to have changed quite a bit
try
b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
}),
thanks, now it's complaining that there's no field named strip
you dont want to be using addSharedLibrary anyways
you want to use addExecutable and do exe.entry = .disabled
mhm
I'm pretty sure it didn't work with executables before
well if you're seeing ResolvedTarget, that means youre in a pretty modern master branch build
the change that made wasm work that way happened quite a while ago
well, the last time I compiled this project seems to have been in September, so it was a while ago :D
strip is now in client.root_module but you can put it right in the addExecutable struct