Fix file exists in multiple modules error when including raymath

This commit is contained in:
Not-Nik 2023-08-05 20:10:10 +02:00
parent 0ee5495059
commit 0d4cc3ac8c
Failed to generate hash of commit
6 changed files with 13 additions and 8 deletions

View file

@ -2,6 +2,7 @@
const std = @import("std");
const Builder = std.build.Builder;
const rl = @This();
const Program = struct {
name: []const u8,
@ -65,12 +66,16 @@ pub fn getArtifact(b: *std.Build, target: std.zig.CrossTarget, optimize: std.bui
}
pub fn getModule(b: *std.Build) *std.Build.Module {
if (b.modules.contains("raylib")) {
return b.modules.get("raylib").?;
}
return b.addModule("raylib", .{ .source_file = .{ .path = "lib/raylib-zig.zig" } });
}
pub const math = struct {
pub fn getModule(b: *std.Build) *std.Build.Module {
return b.addModule("raylib-math", .{ .source_file = .{ .path = "lib/raylib-zig-math.zig" } });
var raylib = rl.getModule(b);
return b.addModule("raylib-math", .{ .source_file = .{ .path = "lib/raylib-zig-math.zig" }, .dependencies = &.{.{ .name = "raylib-zig", .module = raylib }} });
}
};