From 7053970f7b4d311f41c604b10ff1b312fead0dc3 Mon Sep 17 00:00:00 2001 From: kimierik <105240664+kimierik@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:52:12 +0200 Subject: [PATCH] build.zig: remove raygui from options and re add adding raygui as a (#4485) function --- build.zig | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/build.zig b/build.zig index 9c275736..5c2ac77c 100644 --- a/build.zig +++ b/build.zig @@ -298,19 +298,18 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. .flags = raylib_flags_arr.items, }); - if (options.raygui) { - const raygui_dep = b.dependency(options.raygui_dependency_name, .{}); + return raylib; +} - var gen_step = b.addWriteFiles(); - raylib.step.dependOn(&gen_step.step); +pub fn addRaygui(b: *std.Build, raylib: *std.Build.Step.Compile, raygui_dep: *std.Build.Dependency) void { + var gen_step = b.addWriteFiles(); + raylib.step.dependOn(&gen_step.step); - const raygui_c_path = gen_step.add("raygui.c", "#define RAYGUI_IMPLEMENTATION\n#include \"raygui.h\"\n"); - raylib.addCSourceFile(.{ .file = raygui_c_path, .flags = raylib_flags_arr.items }); - raylib.addIncludePath(raygui_dep.path("src")); - raylib.installHeader(raygui_dep.path("src/raygui.h"), "raygui.h"); - } + const raygui_c_path = gen_step.add("raygui.c", "#define RAYGUI_IMPLEMENTATION\n#include \"raygui.h\"\n"); + raylib.addCSourceFile(.{ .file = raygui_c_path }); + raylib.addIncludePath(raygui_dep.path("src")); - return raylib; + raylib.installHeader(raygui_dep.path("src/raygui.h"), "raygui.h"); } pub const Options = struct { @@ -319,7 +318,6 @@ pub const Options = struct { rshapes: bool = true, rtext: bool = true, rtextures: bool = true, - raygui: bool = false, platform: PlatformBackend = .glfw, shared: bool = false, linux_display_backend: LinuxDisplayBackend = .Both, @@ -327,15 +325,12 @@ pub const Options = struct { /// config should be a list of space-separated cflags, eg, "-DSUPPORT_CUSTOM_FRAME_CONTROL" config: []const u8 = &.{}, - raygui_dependency_name: []const u8 = "raygui", - const defaults = Options{}; fn getOptions(b: *std.Build) Options { return .{ .platform = b.option(PlatformBackend, "platform", "Choose the platform backedn for desktop target") orelse defaults.platform, .raudio = b.option(bool, "raudio", "Compile with audio support") orelse defaults.raudio, - .raygui = b.option(bool, "raygui", "Compile with raygui support") orelse defaults.raygui, .rmodels = b.option(bool, "rmodels", "Compile with models support") orelse defaults.rmodels, .rtext = b.option(bool, "rtext", "Compile with text support") orelse defaults.rtext, .rtextures = b.option(bool, "rtextures", "Compile with textures support") orelse defaults.rtextures,