Skip to content

Commit

Permalink
Fixed broken build.zig files. Now works with latest stable compiler (…
Browse files Browse the repository at this point in the history
…as of commit, latest is 0.10.1) (#3045)

Co-authored-by: Talha Qamar <[email protected]>
  • Loading branch information
Gamer-Kold and Gamer-Kold authored May 6, 2023
1 parent 5573f0f commit de748df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const std = @import("std");
const raylib = @import("src/build.zig");

pub fn build(b: *std.Build) void {
pub fn build(b: *std.build.Builder) void {
raylib.build(b);
}
16 changes: 6 additions & 10 deletions src/build.zig
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
const std = @import("std");

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

const raylib = b.addStaticLibrary(.{
.name = "raylib",
.target = target,
.optimize = optimize,
});
const raylib = b.addStaticLibrary("raylib", null);
raylib.linkLibC();

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

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

const lib = addRaylib(b, target, optimize);
lib.installHeader("src/raylib.h", "raylib.h");
const lib = addRaylib(b, target);
b.installFile("src/raylib.h", "raylib.h");
b.installArtifact(lib);
}

Expand Down

0 comments on commit de748df

Please sign in to comment.