Skip to content

Instantly share code, notes, and snippets.

@travisstaloch
Created January 25, 2024 06:47
Show Gist options
  • Save travisstaloch/ed5bb79a533f47d9649bd1000bec954f to your computer and use it in GitHub Desktop.
Save travisstaloch/ed5bb79a533f47d9649bd1000bec954f to your computer and use it in GitHub Desktop.
minimal build.zig for wasm, January 2024, zig version 0.12.0-dev.2158+4f2009de1
const std = @import("std");
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "lib",
.root_source_file = .{ .path = "src/lib.zig" },
.target = b.resolveTargetQuery(std.zig.CrossTarget.parse(
.{ .arch_os_abi = "wasm32-freestanding" },
) catch unreachable),
.optimize = optimize,
});
exe.entry = .disabled;
exe.rdynamic = true;
b.installArtifact(exe);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment