diff options
| author | Gamer-Kold <[email protected]> | 2023-05-15 14:23:36 +0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-15 11:23:36 +0200 |
| commit | 6b92d71ea1c4e3072b26f25e7b8bd1d1aa8e781f (patch) | |
| tree | ba40790534915169712501af0a16809a7d386e35 | |
| parent | 26a3536958e9d4d641edbff0530c41625871b6be (diff) | |
| download | raylib-6b92d71ea1c4e3072b26f25e7b8bd1d1aa8e781f.tar.gz raylib-6b92d71ea1c4e3072b26f25e7b8bd1d1aa8e781f.zip | |
Reverted commits that deprecated the build.zig files, and added a note to all of them stating version of zig they were using (#3060)
* Revert "Fixed broken build.zig files. Now works with latest stable compiler (as of commit, latest is 0.10.1) (#3045)"
This reverts commit de748dfffefeba1ba9bcf0c90c538d32c9cb2020 so that zig
build script works with master branch of zig.
* Added a note to build.zig files that denotes what version of zig they have been tested with.
* Standardised the note in the build.zig files
| -rw-r--r-- | build.zig | 3 | ||||
| -rw-r--r-- | examples/build.zig | 1 | ||||
| -rw-r--r-- | src/build.zig | 15 |
3 files changed, 11 insertions, 8 deletions
@@ -1,6 +1,7 @@ const std = @import("std"); const raylib = @import("src/build.zig"); -pub fn build(b: *std.build.Builder) void { +// This has been tested to work with zig master branch as of commit 87de821 or May 14 2023 +pub fn build(b: *std.Build) void { raylib.build(b); } diff --git a/examples/build.zig b/examples/build.zig index f94a3b4b..6e13ab3d 100644 --- a/examples/build.zig +++ b/examples/build.zig @@ -1,6 +1,7 @@ const std = @import("std"); const builtin = @import("builtin"); +// This has been tested to work with zig master branch as of commit 87de821 or May 14 2023 fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossTarget, optimize: std.builtin.OptimizeMode) !*std.Build.Step { if (target.getOsTag() == .emscripten) { @panic("Emscripten building via Zig unsupported"); diff --git a/src/build.zig b/src/build.zig index 58cf84fe..48e93c32 100644 --- a/src/build.zig +++ b/src/build.zig @@ -1,6 +1,7 @@ const std = @import("std"); -pub fn addRaylib(b: *std.build.Builder, target: std.zig.CrossTarget) *std.build.LibExeObjStep { +// This has been tested to work with zig master branch as of commit 87de821 or May 14 2023 +pub fn addRaylib(b: *std.Build, target: std.zig.CrossTarget, optimize: std.builtin.OptimizeMode) *std.Build.CompileStep { const raylib_flags = &[_][]const u8{ "-std=gnu99", "-D_GNU_SOURCE", @@ -8,10 +9,10 @@ pub fn addRaylib(b: *std.build.Builder, target: std.zig.CrossTarget) *std.build. "-fno-sanitize=undefined", // https://github.com/raysan5/raylib/issues/1891 }; - const raylib = b.addStaticLibrary(std.Build.StaticLibraryOptions{ + const raylib = b.addStaticLibrary(.{ .name = "raylib", .target = target, - .optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseSafe }), + .optimize = optimize, }); raylib.linkLibC(); @@ -103,7 +104,7 @@ pub fn addRaylib(b: *std.build.Builder, target: std.zig.CrossTarget) *std.build. return raylib; } -pub fn build(b: *std.build.Builder) void { +pub fn build(b: *std.Build) 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 @@ -112,10 +113,10 @@ pub fn build(b: *std.build.Builder) 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.standardReleaseOptions(); + const optimize = b.standardOptimizeOption(.{}); - const lib = addRaylib(b, target); - b.installFile("src/raylib.h", "raylib.h"); + const lib = addRaylib(b, target, optimize); + lib.installHeader("src/raylib.h", "raylib.h"); b.installArtifact(lib); } |
