mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-09 12:07:27 +00:00
Properly depend on raygui
This commit is contained in:
parent
d56fc7b663
commit
876219c600
25
build.zig
25
build.zig
@ -1,7 +1,8 @@
|
|||||||
// raylib-zig (c) Nikolas Wipper 2020-2024
|
// raylib-zig (c) Nikolas Wipper 2020-2024
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const rl = @This();
|
const this = @This();
|
||||||
|
const rl = @import("raylib");
|
||||||
|
|
||||||
pub const emcc = @import("emcc.zig");
|
pub const emcc = @import("emcc.zig");
|
||||||
|
|
||||||
@ -105,6 +106,12 @@ fn getRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.buil
|
|||||||
});
|
});
|
||||||
|
|
||||||
const lib = raylib.artifact("raylib");
|
const lib = raylib.artifact("raylib");
|
||||||
|
|
||||||
|
rl.addRaygui(b, lib, b.dependency("raygui", .{
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
}));
|
||||||
|
|
||||||
b.installArtifact(lib);
|
b.installArtifact(lib);
|
||||||
_raylib_lib_cache = lib;
|
_raylib_lib_cache = lib;
|
||||||
return lib;
|
return lib;
|
||||||
@ -124,7 +131,7 @@ fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.buil
|
|||||||
|
|
||||||
const math = struct {
|
const math = struct {
|
||||||
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
|
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
|
||||||
const raylib = rl.getModule(b, target, optimize);
|
const raylib = this.getModule(b, target, optimize);
|
||||||
return b.addModule("raymath", .{
|
return b.addModule("raymath", .{
|
||||||
.root_source_file = b.path("lib/raymath.zig"),
|
.root_source_file = b.path("lib/raymath.zig"),
|
||||||
.imports = &.{.{ .name = "raylib-zig", .module = raylib }},
|
.imports = &.{.{ .name = "raylib-zig", .module = raylib }},
|
||||||
@ -136,7 +143,7 @@ const math = struct {
|
|||||||
|
|
||||||
const gl = struct {
|
const gl = struct {
|
||||||
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
|
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
|
||||||
const raylib = rl.getModule(b, target, optimize);
|
const raylib = this.getModule(b, target, optimize);
|
||||||
return b.addModule("rlgl", .{
|
return b.addModule("rlgl", .{
|
||||||
.root_source_file = b.path("lib/rlgl.zig"),
|
.root_source_file = b.path("lib/rlgl.zig"),
|
||||||
.imports = &.{.{ .name = "raylib-zig", .module = raylib }},
|
.imports = &.{.{ .name = "raylib-zig", .module = raylib }},
|
||||||
@ -148,7 +155,7 @@ const gl = struct {
|
|||||||
|
|
||||||
const gui = struct {
|
const gui = struct {
|
||||||
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
|
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
|
||||||
const raylib = rl.getModule(b, target, optimize);
|
const raylib = this.getModule(b, target, optimize);
|
||||||
return b.addModule("raygui", .{
|
return b.addModule("raygui", .{
|
||||||
.root_source_file = b.path("lib/raygui.zig"),
|
.root_source_file = b.path("lib/raygui.zig"),
|
||||||
.imports = &.{.{ .name = "raylib-zig", .module = raylib }},
|
.imports = &.{.{ .name = "raylib-zig", .module = raylib }},
|
||||||
@ -257,10 +264,10 @@ pub fn build(b: *std.Build) !void {
|
|||||||
// },
|
// },
|
||||||
};
|
};
|
||||||
|
|
||||||
const raylib = rl.getModule(b, target, optimize);
|
const raylib = this.getModule(b, target, optimize);
|
||||||
const raymath = rl.math.getModule(b, target, optimize);
|
const raymath = this.math.getModule(b, target, optimize);
|
||||||
const rlgl = rl.gl.getModule(b, target, optimize);
|
const rlgl = this.gl.getModule(b, target, optimize);
|
||||||
const raygui = rl.gui.getModule(b, target, optimize);
|
const raygui = this.gui.getModule(b, target, optimize);
|
||||||
|
|
||||||
const raylib_test = b.addTest(.{
|
const raylib_test = b.addTest(.{
|
||||||
.root_source_file = b.path("lib/raylib.zig"),
|
.root_source_file = b.path("lib/raylib.zig"),
|
||||||
@ -326,7 +333,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
.target = target,
|
.target = target,
|
||||||
});
|
});
|
||||||
rl.link(b, exe, target, optimize, options);
|
this.link(b, exe, target, optimize, options);
|
||||||
exe.root_module.addImport("raylib", raylib);
|
exe.root_module.addImport("raylib", raylib);
|
||||||
exe.root_module.addImport("raymath", raymath);
|
exe.root_module.addImport("raymath", raymath);
|
||||||
exe.root_module.addImport("rlgl", rlgl);
|
exe.root_module.addImport("rlgl", rlgl);
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
.url = "https://github.com/raysan5/raylib/archive/d6b22b17aecd2346d4fd1fc8ebaea8212e40008f.tar.gz",
|
.url = "https://github.com/raysan5/raylib/archive/d6b22b17aecd2346d4fd1fc8ebaea8212e40008f.tar.gz",
|
||||||
.hash = "12205f45151f556dd41348acc8a93099f19d6a2e830978ace86733ce0bfe52978812",
|
.hash = "12205f45151f556dd41348acc8a93099f19d6a2e830978ace86733ce0bfe52978812",
|
||||||
},
|
},
|
||||||
|
.raygui = .{
|
||||||
|
.url = "https://github.com/raysan5/raygui/archive/4b3d94f5df6a5a2aa86286350f7e20c0ca35f516.tar.gz",
|
||||||
|
.hash = "12205f45151f556dd41348acc8a93099f19d6a2e830978ace86733ce0bfe52978812",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
.minimum_zig_version = "0.12.0",
|
.minimum_zig_version = "0.12.0",
|
||||||
.paths = .{ "build.zig", "build.zig.zon", "emcc.zig", "lib/raylib.zig", "lib/raylib-ext.zig", "lib/raymath.zig", "lib/raymath-ext.zig", "lib/rlgl.zig", "lib/rlgl-ext.zig" },
|
.paths = .{ "build.zig", "build.zig.zon", "emcc.zig", "lib/raylib.zig", "lib/raylib-ext.zig", "lib/raymath.zig", "lib/raymath-ext.zig", "lib/rlgl.zig", "lib/rlgl-ext.zig" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user