Skip to content

Commit

Permalink
fix: use switch instead of if-expression
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasanen committed Jul 13, 2024
1 parent 3415156 commit 37e7dca
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -300,24 +300,26 @@ fn linkMacOS(exe: *Compile, comptime library: Library) !void {
.SDL2_ttf => "sdl2_ttf",
});

if (library == .SDL2) {
exe.linkFramework("IOKit");
exe.linkFramework("Cocoa");
exe.linkFramework("CoreAudio");
exe.linkFramework("Carbon");
exe.linkFramework("Metal");
exe.linkFramework("QuartzCore");
exe.linkFramework("AudioToolbox");
exe.linkFramework("ForceFeedback");
exe.linkFramework("GameController");
exe.linkFramework("CoreHaptics");
exe.linkSystemLibrary("iconv");
} else if (library == .SDL2_ttf) {
exe.linkSystemLibrary("freetype");
exe.linkSystemLibrary("harfbuzz");
exe.linkSystemLibrary("bz2");
exe.linkSystemLibrary("zlib");
exe.linkSystemLibrary("graphite2");
switch (library) {
.SDL2 => {
exe.linkFramework("Cocoa");
exe.linkFramework("CoreAudio");
exe.linkFramework("Carbon");
exe.linkFramework("Metal");
exe.linkFramework("QuartzCore");
exe.linkFramework("AudioToolbox");
exe.linkFramework("ForceFeedback");
exe.linkFramework("GameController");
exe.linkFramework("CoreHaptics");
exe.linkSystemLibrary("iconv");
},
.SDL2_ttf => {
exe.linkSystemLibrary("freetype");
exe.linkSystemLibrary("harfbuzz");
exe.linkSystemLibrary("bz2");
exe.linkSystemLibrary("zlib");
exe.linkSystemLibrary("graphite2");
},
}
}

Expand Down

0 comments on commit 37e7dca

Please sign in to comment.