Merge raymath and rlgl into main raylib module

This commit is contained in:
Not-Nik 2024-06-05 22:56:07 +02:00
parent 171c2e100c
commit c0d07991d1
Failed to generate hash of commit
15 changed files with 1012 additions and 68 deletions

View file

@ -145,30 +145,6 @@ fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.buil
});
}
const math = struct {
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
const raylib = this.getModule(b, target, optimize);
return b.addModule("raymath", .{
.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, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
const raylib = this.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,
});
}
};
const gui = struct {
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
const raylib = this.getModule(b, target, optimize);
@ -281,8 +257,6 @@ pub fn build(b: *std.Build) !void {
};
const raylib = this.getModule(b, target, optimize);
const raymath = this.math.getModule(b, target, optimize);
const rlgl = this.gl.getModule(b, target, optimize);
const raygui = this.gui.getModule(b, target, optimize);
const raylib_test = b.addTest(.{
@ -291,20 +265,6 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});
const raymath_test = b.addTest(.{
.root_source_file = b.path("lib/raymath.zig"),
.target = target,
.optimize = optimize,
});
raymath_test.root_module.addImport("raylib-zig", raylib);
const rlgl_test = b.addTest(.{
.root_source_file = b.path("lib/rlgl.zig"),
.target = target,
.optimize = optimize,
});
rlgl_test.root_module.addImport("raylib-zig", raylib);
const raygui_test = b.addTest(.{
.root_source_file = b.path("lib/raygui.zig"),
.target = target,
@ -314,8 +274,6 @@ pub fn build(b: *std.Build) !void {
const test_step = b.step("test", "Check for library compilation errors");
test_step.dependOn(&raylib_test.step);
test_step.dependOn(&raymath_test.step);
test_step.dependOn(&rlgl_test.step);
test_step.dependOn(&raygui_test.step);
const examples_step = b.step("examples", "Builds all the examples");
@ -324,8 +282,6 @@ pub fn build(b: *std.Build) !void {
if (target.query.os_tag == .emscripten) {
const exe_lib = emcc.compileForEmscripten(b, ex.name, ex.path, target, optimize);
exe_lib.root_module.addImport("raylib", raylib);
exe_lib.root_module.addImport("raymath", raymath);
exe_lib.root_module.addImport("rlgl", rlgl);
exe_lib.root_module.addImport("raygui", raygui);
const raylib_lib = getRaylib(b, target, optimize, options);
@ -351,8 +307,6 @@ pub fn build(b: *std.Build) !void {
});
this.link(b, exe, target, optimize, options);
exe.root_module.addImport("raylib", raylib);
exe.root_module.addImport("raymath", raymath);
exe.root_module.addImport("rlgl", rlgl);
exe.root_module.addImport("raygui", raygui);
const run_cmd = b.addRunArtifact(exe);