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
No known key found for this signature in database
GPG Key ID: 08BB71E672DB3BFD
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 }} });
}
};

View File

@ -3,8 +3,8 @@
.version = "0.1.0",
.dependencies = .{
.raylib = .{
.url = "https://github.com/raysan5/raylib/archive/ad2338b994785c887528c91a843d6720cac2c2b0.tar.gz",
.hash = "122003990d16146cfb85e04e0557f41b54e81bae635fa4379f3a597ed5fb7716ee53",
.url = "https://github.com/raysan5/raylib/archive/6094869e3e845e90e1e8ae41b98e889fb3e13e78.tar.gz",
.hash = "12203b7a16bcf8d7fe4c9990a46d92b6f2e35531a4b82eb3bdf8ba4a0dbcc5f21415",
},
},
}
}

View File

@ -1,4 +1,4 @@
// raylib-zig (c) Nikolas Wipper 2023
const rl = @import("raylib-zig.zig");
const rl = @import("raylib-zig");
const rlm = @import("raylib-zig-math.zig");

View File

@ -1,6 +1,6 @@
// raylib-zig (c) Nikolas Wipper 2023
const rl = @import("raylib-zig.zig");
const rl = @import("raylib-zig");
const cdef = @import("raylib-zig-math-ext.zig");
const std = @import("std");

View File

@ -1,6 +1,6 @@
// raylib-zig (c) Nikolas Wipper 2023
const rl = @import("raylib-zig.zig");
const rl = @import("raylib-zig");
const rlm = @import("raylib-zig-math.zig");
pub extern "c" fn Clamp(value: f32, min: f32, max: f32) f32;

View File

@ -1,6 +1,6 @@
// raylib-zig (c) Nikolas Wipper 2023
const rl = @import("raylib-zig.zig");
const rl = @import("raylib-zig");
const cdef = @import("raylib-zig-math-ext.zig");
const std = @import("std");