Match zig build defaults to cmake

This commit is contained in:
Brandon Dyck 2021-12-12 16:20:27 -07:00
parent 35c01159c2
commit a44b41f779

View File

@ -65,12 +65,12 @@ pub fn build(b: *std.build.Builder) !void {
try c_sources.append("src/windows/WinMiniFB.c"); try c_sources.append("src/windows/WinMiniFB.c");
lib.linkSystemLibrary("gdi32"); lib.linkSystemLibrary("gdi32");
switch (use_backend) { switch (use_backend) {
.gdi, .default => {}, .opengl, .default => {
.opengl => {
try c_flags.append("-DUSE_OPENGL_API"); try c_flags.append("-DUSE_OPENGL_API");
try c_sources.append("src/gl/MiniFB_GL.c"); try c_sources.append("src/gl/MiniFB_GL.c");
lib.linkSystemLibraryName("opengl32"); lib.linkSystemLibraryName("opengl32");
}, },
.gdi => {},
else => { else => {
return ConfigError.BackendNotSupported; return ConfigError.BackendNotSupported;
} }
@ -80,11 +80,7 @@ pub fn build(b: *std.build.Builder) !void {
try c_sources.append("src/MiniFB_linux.c"); try c_sources.append("src/MiniFB_linux.c");
lib.linkSystemLibrary("rt"); lib.linkSystemLibrary("rt");
switch (use_backend) { switch (use_backend) {
.x11, .default => { .opengl, .default => {
try c_sources.append("src/x11/X11MiniFB.c");
lib.linkSystemLibrary("X11");
},
.opengl => {
try c_sources.append("src/x11/X11MiniFB.c"); try c_sources.append("src/x11/X11MiniFB.c");
lib.linkSystemLibrary("X11"); lib.linkSystemLibrary("X11");
@ -92,6 +88,10 @@ pub fn build(b: *std.build.Builder) !void {
try c_sources.append("src/gl/MiniFB_GL.c"); try c_sources.append("src/gl/MiniFB_GL.c");
lib.linkSystemLibrary("GL"); lib.linkSystemLibrary("GL");
}, },
.x11 => {
try c_sources.append("src/x11/X11MiniFB.c");
lib.linkSystemLibrary("X11");
},
.wayland => { .wayland => {
try c_sources.append("src/wayland/WaylandMiniFB.c"); try c_sources.append("src/wayland/WaylandMiniFB.c");
lib.linkSystemLibrary("wayland-client"); lib.linkSystemLibrary("wayland-client");