Skip to content

Commit de748df

Browse files
Fixed broken build.zig files. Now works with latest stable compiler (as of commit, latest is 0.10.1) (#3045)
Co-authored-by: Talha Qamar <qamartalha@proton.me>
1 parent 5573f0f commit de748df

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const std = @import("std");
22
const raylib = @import("src/build.zig");
33

4-
pub fn build(b: *std.Build) void {
4+
pub fn build(b: *std.build.Builder) void {
55
raylib.build(b);
66
}

src/build.zig

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
const std = @import("std");
22

3-
pub fn addRaylib(b: *std.Build, target: std.zig.CrossTarget, optimize: std.builtin.OptimizeMode) *std.Build.CompileStep {
3+
pub fn addRaylib(b: *std.build.Builder, target: std.zig.CrossTarget) *std.build.LibExeObjStep {
44
const raylib_flags = &[_][]const u8{
55
"-std=gnu99",
66
"-D_GNU_SOURCE",
77
"-DGL_SILENCE_DEPRECATION=199309L",
88
"-fno-sanitize=undefined", // https://github.com/raysan5/raylib/issues/1891
99
};
1010

11-
const raylib = b.addStaticLibrary(.{
12-
.name = "raylib",
13-
.target = target,
14-
.optimize = optimize,
15-
});
11+
const raylib = b.addStaticLibrary("raylib", null);
1612
raylib.linkLibC();
1713

1814
raylib.addIncludePath(srcdir ++ "/external/glfw/include");
@@ -103,7 +99,7 @@ pub fn addRaylib(b: *std.Build, target: std.zig.CrossTarget, optimize: std.built
10399
return raylib;
104100
}
105101

106-
pub fn build(b: *std.Build) void {
102+
pub fn build(b: *std.build.Builder) void {
107103
// Standard target options allows the person running `zig build` to choose
108104
// what target to build for. Here we do not override the defaults, which
109105
// means any target is allowed, and the default is native. Other options
@@ -112,10 +108,10 @@ pub fn build(b: *std.Build) void {
112108
// Standard optimization options allow the person running `zig build` to select
113109
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not
114110
// set a preferred release mode, allowing the user to decide how to optimize.
115-
const optimize = b.standardOptimizeOption(.{});
111+
// const optimize = b.standardReleaseOptions();
116112

117-
const lib = addRaylib(b, target, optimize);
118-
lib.installHeader("src/raylib.h", "raylib.h");
113+
const lib = addRaylib(b, target);
114+
b.installFile("src/raylib.h", "raylib.h");
119115
b.installArtifact(lib);
120116
}
121117

0 commit comments

Comments
 (0)