Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ pub fn build(b: *std.Build) void {
{
// TODO(mitchellh): support more complex features that are usually on
// with libgc like threading, parallelization, etc.
const cflags = [_][]const u8{};
const cflags_wasi = [_][]const u8{
"-D__wasi__",
"-D_WASI_EMULATED_SIGNAL",
"-Wl,wasi-emulated-signal",
};
const cflags = if (target.getOsTag() == .wasi) &cflags_wasi else &[_][]const u8{};
const libgc_srcs = [_][]const u8{
"alloc.c", "reclaim.c", "allchblk.c", "misc.c", "mach_dep.c", "os_dep.c",
"mark_rts.c", "headers.c", "mark.c", "obj_map.c", "blacklst.c", "finalize.c",
Expand All @@ -24,7 +29,7 @@ pub fn build(b: *std.Build) void {
gc.linkLibC();
gc.addIncludePath("vendor/bdwgc/include");
inline for (libgc_srcs) |src| {
gc.addCSourceFile("vendor/bdwgc/" ++ src, &cflags);
gc.addCSourceFile("vendor/bdwgc/" ++ src, cflags);
}

const gc_step = b.step("libgc", "build libgc");
Expand Down