@@ -21,13 +21,20 @@ fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zi
21
21
// zig's mingw headers do not include pthread.h
22
22
if (std .mem .eql (u8 , "core_loading_thread" , name ) and target .getOsTag () == .windows ) continue ;
23
23
24
- const exe = b .addExecutable (name , path );
24
+ const exe = b .addExecutable (name , null );
25
+ exe .addCSourceFile (path , switch (target .getOsTag ()) {
26
+ .windows = > &[_ ][]const u8 {},
27
+ .linux = > &[_ ][]const u8 {},
28
+ .macos = > &[_ ][]const u8 {"-DPLATFORM_DESKTOP" },
29
+ else = > @panic ("Unsupported OS" ),
30
+ });
25
31
exe .setTarget (target );
26
32
exe .setBuildMode (mode );
27
33
exe .linkLibC ();
28
34
exe .addObjectFile (switch (target .getOsTag ()) {
29
35
.windows = > "../src/raylib.lib" ,
30
36
.linux = > "../src/libraylib.a" ,
37
+ .macos = > "../src/libraylib.a" ,
31
38
else = > @panic ("Unsupported OS" ),
32
39
});
33
40
@@ -49,6 +56,14 @@ fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zi
49
56
exe .linkSystemLibrary ("m" );
50
57
exe .linkSystemLibrary ("X11" );
51
58
},
59
+ .macos = > {
60
+ exe .linkFramework ("Foundation" );
61
+ exe .linkFramework ("Cocoa" );
62
+ exe .linkFramework ("OpenGL" );
63
+ exe .linkFramework ("CoreAudio" );
64
+ exe .linkFramework ("CoreVideo" );
65
+ exe .linkFramework ("IOKit" );
66
+ },
52
67
else = > {
53
68
@panic ("Unsupported OS" );
54
69
},
0 commit comments