More build.zig fixes for 0.12

This commit is contained in:
Not-Nik 2024-04-27 16:58:05 +02:00
parent 19f054bec5
commit a9f6ff9944
No known key found for this signature in database
GPG Key ID: E95F679E3CDD9784

View File

@ -16,7 +16,7 @@ fn link(
target: std.Build.ResolvedTarget,
optimize: std.builtin.Mode,
) void {
const lib = getRaylib(b, target.query, optimize);
const lib = getRaylib(b, target, optimize);
const target_os = exe.rootModuleTarget().os.tag;
switch (target_os) {
@ -61,11 +61,7 @@ fn link(
}
var _raylib_lib_cache: ?*std.Build.Step.Compile = null;
fn getRaylib(
b: *std.Build,
target: std.zig.CrossTarget,
optimize: std.builtin.Mode,
) *std.Build.Step.Compile {
fn getRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Step.Compile {
if (_raylib_lib_cache) |lib| return lib else {
const raylib = b.dependency("raylib", .{
.target = target,
@ -220,7 +216,7 @@ pub fn build(b: *std.Build) !void {
exe_lib.root_module.addImport("raylib", raylib);
exe_lib.root_module.addImport("raylib-math", raylib_math);
exe_lib.root_module.addImport("rlgl", rlgl);
const raylib_lib = getRaylib(b, target.query, optimize);
const raylib_lib = getRaylib(b, target, optimize);
// Note that raylib itself isn't actually added to the exe_lib
// output file, so it also needs to be linked with emscripten.
@ -236,7 +232,7 @@ pub fn build(b: *std.Build) !void {
} else {
const exe = b.addExecutable(.{
.name = ex.name,
.root_source_file = .{ .path = ex.path },
.root_source_file = b.path(ex.path),
.optimize = optimize,
.target = target,
});