mirror of
https://github.com/raylib-zig/raylib-zig.git
synced 2026-02-20 16:24:34 +00:00
Get module with target and optimization
This commit is contained in:
parent
a9f6ff9944
commit
73bc8b70cd
26
build.zig
26
build.zig
@ -75,29 +75,37 @@ fn getRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.buil
|
||||
}
|
||||
}
|
||||
|
||||
fn getModule(b: *std.Build) *std.Build.Module {
|
||||
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
|
||||
if (b.modules.contains("raylib")) {
|
||||
return b.modules.get("raylib").?;
|
||||
}
|
||||
return b.addModule("raylib", .{ .root_source_file = b.path("lib/raylib.zig")});
|
||||
return b.addModule("raylib", .{
|
||||
.root_source_file = b.path("lib/raylib.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
}
|
||||
|
||||
const math = struct {
|
||||
fn getModule(b: *std.Build) *std.Build.Module {
|
||||
const raylib = rl.getModule(b);
|
||||
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
|
||||
const raylib = rl.getModule(b, target, optimize);
|
||||
return b.addModule("raylib-math", .{
|
||||
.root_source_file = b.path("lib/raymath.zig"),
|
||||
.imports = &.{.{ .name = "raylib-zig", .module = raylib }},
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const gl = struct {
|
||||
fn getModule(b: *std.Build) *std.Build.Module {
|
||||
const raylib = rl.getModule(b);
|
||||
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
|
||||
const raylib = rl.getModule(b, target, optimize);
|
||||
return b.addModule("rlgl", .{
|
||||
.root_source_file = b.path("lib/rlgl.zig"),
|
||||
.imports = &.{.{ .name = "raylib-zig", .module = raylib }},
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -181,9 +189,9 @@ pub fn build(b: *std.Build) !void {
|
||||
|
||||
const examples_step = b.step("examples", "Builds all the examples");
|
||||
|
||||
const raylib = rl.getModule(b);
|
||||
const raylib_math = rl.math.getModule(b);
|
||||
const rlgl = rl.gl.getModule(b);
|
||||
const raylib = rl.getModule(b, target, optimize);
|
||||
const raylib_math = rl.math.getModule(b, target, optimize);
|
||||
const rlgl = rl.gl.getModule(b, target, optimize);
|
||||
|
||||
const raylib_test = b.addTest(.{
|
||||
.root_source_file = b.path("lib/raylib.zig"),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user