From 9891ade3ae6b355fa4ed148e139d753aafc2d6dc Mon Sep 17 00:00:00 2001 From: Not-Nik Date: Thu, 28 May 2020 14:28:22 +1000 Subject: [PATCH] Make linking system raylib the first thing we do --- lib.zig | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib.zig b/lib.zig index d8e9c32..3de1e8c 100644 --- a/lib.zig +++ b/lib.zig @@ -6,12 +6,18 @@ pub fn Pkg(pkgdir: comptime []const u8) type { return struct { var ran_git = false; pub fn link(exe: *LibExeObjStep, system_lib: bool) void { + if (system_lib) { + exe.linkSystemLibrary("raylib"); + return; + } + const raylibFlags = &[_][]const u8{ "-std=c99", "-DPLATFORM_DESKTOP", "-D_POSIX_C_SOURCE", "-DGL_SILENCE_DEPRECATION", }; + const target_os = exe.target.toTarget().os.tag; switch (target_os) { .windows => { @@ -23,11 +29,8 @@ pub fn Pkg(pkgdir: comptime []const u8) type { exe.addIncludeDir(pkgdir ++ "/raylib/src/external/glfw/deps/mingw"); exe.addCSourceFile(pkgdir ++ "/raylib/src/rglfw.c", raylibFlags); }, - .macosx => if (system_lib) { - std.debug.warn("TODO: add libraries necessary for system_lib linking on macosx (maybe just glfw?)", .{}); - std.os.exit(1); - } else { - std.debug.warn("compiling raylib is unsupported on macosx\n", .{}); + .macosx => { + std.debug.warn("Compiling raylib is unsupported on macOS. Please add '-Dsystem-raylib=true' to your build command to use your system raylib.\n", .{}); std.os.exit(1); }, .freebsd, .openbsd, .netbsd, .dragonfly => { @@ -54,11 +57,6 @@ pub fn Pkg(pkgdir: comptime []const u8) type { } exe.linkLibC(); - if (system_lib) { - exe.linkSystemLibrary("raylib"); - return; - } - fetchSubmodules(exe.builder) catch std.debug.warn( \\Warning: