build.zig: remove raygui from options and re add adding raygui as a (#4485)
function
This commit is contained in:
parent
4ddf4679b4
commit
7053970f7b
27
build.zig
27
build.zig
@ -298,28 +298,26 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
|||||||
.flags = raylib_flags_arr.items,
|
.flags = raylib_flags_arr.items,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (options.raygui) {
|
|
||||||
const raygui_dep = b.dependency(options.raygui_dependency_name, .{});
|
|
||||||
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
return raylib;
|
return raylib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 });
|
||||||
|
raylib.addIncludePath(raygui_dep.path("src"));
|
||||||
|
|
||||||
|
raylib.installHeader(raygui_dep.path("src/raygui.h"), "raygui.h");
|
||||||
|
}
|
||||||
|
|
||||||
pub const Options = struct {
|
pub const Options = struct {
|
||||||
raudio: bool = true,
|
raudio: bool = true,
|
||||||
rmodels: bool = true,
|
rmodels: bool = true,
|
||||||
rshapes: bool = true,
|
rshapes: bool = true,
|
||||||
rtext: bool = true,
|
rtext: bool = true,
|
||||||
rtextures: bool = true,
|
rtextures: bool = true,
|
||||||
raygui: bool = false,
|
|
||||||
platform: PlatformBackend = .glfw,
|
platform: PlatformBackend = .glfw,
|
||||||
shared: bool = false,
|
shared: bool = false,
|
||||||
linux_display_backend: LinuxDisplayBackend = .Both,
|
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 should be a list of space-separated cflags, eg, "-DSUPPORT_CUSTOM_FRAME_CONTROL"
|
||||||
config: []const u8 = &.{},
|
config: []const u8 = &.{},
|
||||||
|
|
||||||
raygui_dependency_name: []const u8 = "raygui",
|
|
||||||
|
|
||||||
const defaults = Options{};
|
const defaults = Options{};
|
||||||
|
|
||||||
fn getOptions(b: *std.Build) Options {
|
fn getOptions(b: *std.Build) Options {
|
||||||
return .{
|
return .{
|
||||||
.platform = b.option(PlatformBackend, "platform", "Choose the platform backedn for desktop target") orelse defaults.platform,
|
.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,
|
.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,
|
.rmodels = b.option(bool, "rmodels", "Compile with models support") orelse defaults.rmodels,
|
||||||
.rtext = b.option(bool, "rtext", "Compile with text support") orelse defaults.rtext,
|
.rtext = b.option(bool, "rtext", "Compile with text support") orelse defaults.rtext,
|
||||||
.rtextures = b.option(bool, "rtextures", "Compile with textures support") orelse defaults.rtextures,
|
.rtextures = b.option(bool, "rtextures", "Compile with textures support") orelse defaults.rtextures,
|
||||||
|
Loading…
Reference in New Issue
Block a user