Skip to content

Commit

Permalink
Use latest zeptolibc, don't strip so Chrome can debug wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
ringtailsoftware committed Dec 6, 2024
1 parent 2705854 commit f90eb8e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
31 changes: 16 additions & 15 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fn addExample(b: *std.Build, comptime name: []const u8, flags: ?[]const []const
.root_source_file = b.path("src/" ++ name ++ "/" ++ name ++ ".zig"),
.target = target,
.optimize = optimize,
.strip = false,
});
exe.entry = .disabled;
exe.rdynamic = true;
Expand Down Expand Up @@ -41,10 +42,11 @@ fn addExample(b: *std.Build, comptime name: []const u8, flags: ?[]const []const
}

pub fn build(b: *std.Build) void {
const hosttarget = b.standardTargetOptions(.{});
optimize = b.standardOptimizeOption(.{});
target = b.resolveTargetQuery(std.zig.CrossTarget.parse(
.{ .arch_os_abi = "wasm32-freestanding" },
) catch unreachable);
) catch unreachable);

b.installFile("src/index.html", "index.html");
b.installFile("src/pcm-processor.js", "pcm-processor.js");
Expand All @@ -53,6 +55,19 @@ pub fn build(b: *std.Build) void {
b.installFile("src/coi-serviceworker.js", "coi-serviceworker.js");
b.installFile("src/unmute.js", "unmute.js");

addExample(b, "tinygl", &.{ "-Wall", "-fno-sanitize=undefined" }, &.{
"src/tinygl/TinyGL/src/api.c", "src/tinygl/TinyGL/src/specbuf.c", "src/tinygl/TinyGL/src/zmath.c",
"src/tinygl/TinyGL/src/arrays.c", "src/tinygl/TinyGL/src/image_util.c", "src/tinygl/TinyGL/src/misc.c",
"src/tinygl/TinyGL/src/texture.c", "src/tinygl/TinyGL/src/ztriangle.c", "src/tinygl/TinyGL/src/clear.c",
"src/tinygl/TinyGL/src/init.c", "src/tinygl/TinyGL/src/msghandling.c", "src/tinygl/TinyGL/src/vertex.c",
"src/tinygl/TinyGL/src/clip.c", "src/tinygl/TinyGL/src/light.c", "src/tinygl/TinyGL/src/zbuffer.c",
"src/tinygl/TinyGL/src/error.c", "src/tinygl/TinyGL/src/list.c", "src/tinygl/TinyGL/src/zdither.c",
"src/tinygl/TinyGL/src/get.c", "src/tinygl/TinyGL/src/matrix.c", "src/tinygl/TinyGL/src/select.c",
"src/tinygl/TinyGL/src/zline.c",
}, &.{
"src/tinygl/TinyGL/include", "src/tinygl/TinyGL/src",
});

addExample(b, "agnes", &.{"-Wall", "-fno-sanitize=undefined"}, &.{"src/agnes/agnes.c"}, null);

addExample(b, "sinetone", null, null, null);
Expand Down Expand Up @@ -87,24 +102,10 @@ pub fn build(b: *std.Build) void {
"src/doom/puredoom/w_wad.c", "src/doom/puredoom/wi_stuff.c", "src/doom/puredoom/z_zone.c",
}, null);

addExample(b, "tinygl", &.{ "-Wall", "-fno-sanitize=undefined" }, &.{
"src/tinygl/TinyGL/src/api.c", "src/tinygl/TinyGL/src/specbuf.c", "src/tinygl/TinyGL/src/zmath.c",
"src/tinygl/TinyGL/src/arrays.c", "src/tinygl/TinyGL/src/image_util.c", "src/tinygl/TinyGL/src/misc.c",
"src/tinygl/TinyGL/src/texture.c", "src/tinygl/TinyGL/src/ztriangle.c", "src/tinygl/TinyGL/src/clear.c",
"src/tinygl/TinyGL/src/init.c", "src/tinygl/TinyGL/src/msghandling.c", "src/tinygl/TinyGL/src/vertex.c",
"src/tinygl/TinyGL/src/clip.c", "src/tinygl/TinyGL/src/light.c", "src/tinygl/TinyGL/src/zbuffer.c",
"src/tinygl/TinyGL/src/error.c", "src/tinygl/TinyGL/src/list.c", "src/tinygl/TinyGL/src/zdither.c",
"src/tinygl/TinyGL/src/get.c", "src/tinygl/TinyGL/src/matrix.c", "src/tinygl/TinyGL/src/select.c",
"src/tinygl/TinyGL/src/zline.c",
}, &.{
"src/tinygl/TinyGL/include", "src/tinygl/TinyGL/src",
});

addExample(b, "mandelbrot", null, null, null);

addExample(b, "olive", &.{"-Wall"}, &.{"src/olive/olive.c/olive.c"}, null);

const hosttarget = b.standardTargetOptions(.{});
// web server
const serve_exe = b.addExecutable(.{
.name = "serve",
Expand Down
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
.hash = "12209083b0c43d0f68a26a48a7b26ad9f93b22c9cff710c78ddfebb47b89cfb9c7a4",
},
.zeptolibc = .{
.url = "git+https://github.com/ringtailsoftware/zeptolibc.git#4f99a19b8edcc0d9e334c7638da7eb3a67a14fdf",
.hash = "1220dd637d47941c3fcd3bbf99ff3c82202d5219f95d481f408327799238435f5add",
.url = "git+https://github.com/ringtailsoftware/zeptolibc.git#c718601f80e6a3de5280b88f348ba29a8f2711ab",
.hash = "122056709e3458c2d8a2af19d7d622e07ecda96c46d70a911145963362e048ee5ff7",
},
},
.paths = .{
Expand Down

0 comments on commit f90eb8e

Please sign in to comment.