Allow build on Linux

This commit is contained in:
Kenneth Bruen 2024-02-21 19:07:32 +01:00
parent cf9f72459d
commit 29ad865fa6
Signed by: kbruen
GPG key ID: C1980A470C3EE5B1
2 changed files with 20 additions and 8 deletions

View file

@ -31,7 +31,11 @@ pub fn build(b: *std.Build) void {
// exe.linkSystemLibrary("raylib"); // exe.linkSystemLibrary("raylib");
exe.linkSystemLibrary("curl"); exe.linkSystemLibrary("curl");
exe.addObjectFile(.{ exe.addObjectFile(.{
.cwd_relative = "/opt/homebrew/Cellar/raylib/5.0/lib/libraylib.a", .cwd_relative = switch (target.result.os.tag) {
.macos => "/opt/homebrew/Cellar/raylib/5.0/lib/libraylib.a",
.linux => "./libraylib.a",
else => @panic("Unsupported platform"),
},
}); });
// exe.addObjectFile(.{ // exe.addObjectFile(.{
// .cwd_relative = "/opt/homebrew/Cellar/curl/8.5.0/lib/libcurl.a", // .cwd_relative = "/opt/homebrew/Cellar/curl/8.5.0/lib/libcurl.a",
@ -40,12 +44,20 @@ pub fn build(b: *std.Build) void {
.cwd_relative = "/opt/homebrew/Cellar/raylib/5.0/include", .cwd_relative = "/opt/homebrew/Cellar/raylib/5.0/include",
}); });
// Raylib dependencies // Raylib dependencies
exe.linkFramework("Foundation"); switch (target.result.os.tag) {
exe.linkFramework("CoreVideo"); .macos => {
exe.linkFramework("IOKit"); exe.linkFramework("Foundation");
exe.linkFramework("Cocoa"); exe.linkFramework("CoreVideo");
exe.linkFramework("GLUT"); exe.linkFramework("IOKit");
exe.linkFramework("OpenGL"); exe.linkFramework("Cocoa");
exe.linkFramework("GLUT");
exe.linkFramework("OpenGL");
},
.linux => {
exe.linkSystemLibrary("c");
},
else => @panic("Unsupported platform"),
}
// This declares intent for the executable to be installed into the // This declares intent for the executable to be installed into the
// standard location when the user invokes the "install" step (the default // standard location when the user invokes the "install" step (the default

View file

@ -4,7 +4,7 @@ const rl = raylib.rl;
const AppState = @import("state.zig"); const AppState = @import("state.zig");
const Curl = @import("curl.zig"); const Curl = @import("curl.zig");
const C = @cImport({ const C = @cImport({
@cDefine("_XOPEN_SOURE", ""); @cDefine("_XOPEN_SOURCE", "");
@cInclude("time.h"); @cInclude("time.h");
}); });