Skip to content

Commit 8406d12

Browse files
committed
add support for macos
1 parent 77a5e7b commit 8406d12

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

build.zig

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,26 @@ fn addPhysfs(
8282
.target = target,
8383
.optimize = optimize,
8484
});
85+
var files = std.ArrayList([]const u8).init(b.allocator);
86+
files.appendSlice(&.{
87+
"src/physfs.c",
88+
"src/physfs_archiver_dir.c",
89+
"src/physfs_archiver_unpacked.c",
90+
"src/physfs_archiver_zip.c",
91+
"src/physfs_byteorder.c",
92+
"src/physfs_unicode.c",
93+
"src/physfs_platform_posix.c",
94+
"src/physfs_platform_unix.c",
95+
"src/physfs_platform_windows.c",
96+
"src/physfs_platform_haiku.cpp",
97+
"src/physfs_platform_android.c",
98+
}) catch @panic("OOM");
99+
if (target.result.isDarwin()) {
100+
files.append("src/physfs_platform_apple.m") catch @panic("OOM");
101+
}
85102
lib.addCSourceFiles(.{
86103
.root = root,
87-
.files = &.{
88-
"src/physfs.c",
89-
"src/physfs_archiver_dir.c",
90-
"src/physfs_archiver_unpacked.c",
91-
"src/physfs_archiver_zip.c",
92-
"src/physfs_byteorder.c",
93-
"src/physfs_unicode.c",
94-
"src/physfs_platform_posix.c",
95-
"src/physfs_platform_unix.c",
96-
"src/physfs_platform_windows.c",
97-
"src/physfs_platform_haiku.cpp",
98-
"src/physfs_platform_android.c",
99-
},
104+
.files = files.toOwnedSlice() catch @panic("OOM"),
100105
.flags = &.{
101106
"-DPHYSFS_SUPPORTS_DEFAULT=0",
102107
"-DPHYSFS_SUPPORTS_ZIP=1",

0 commit comments

Comments
 (0)