Add zmath dependency

main
copygirl 3 months ago
parent 9fc7356a22
commit 4796ff6de5
  1. 20
      README.md
  2. 10
      build.zig
  3. 1
      build.zig.zon
  4. 1
      libs/zig-gamedev

@ -1,7 +1,19 @@
# Zig Bloxel Game
This is a small project attempting to create a "bloxel" game (think Minecraft) using the relatively new [Zig] programming language with the help of [Mach] and [Flecs].
This is a small project attempting to create a "bloxel" game (think Minecraft) using the relatively new [Zig] programming language with the help of [Mach], [Flecs] and [zig-gamedev]. Due to Zig being a quickly evolving language, Mach and zig-gamedev, and as a result this project, target version `0.12.0-dev.2063+804cee3b9` of Zig.
[Zig]: https://ziglang.org/
[Mach]: https://machengine.org/
[Flecs]: https://flecs.dev/
[Zig]: https://ziglang.org/
[Mach]: https://github.com/hexops/mach-core
[Flecs]: https://github.com/SanderMertens/flecs
[zig-gamedev]: https://github.com/zig-gamedev/zig-gamedev
## Dependencies
```sh
mkdir -p libs && cd libs
# Clone zig-gamedev sparsely, only grabbing top-level files.
git clone --sparse --filter=blob:none https://github.com/zig-gamedev/zig-gamedev.git
# However, we also care about zmath, so check that out too.
cd zig-gamedev
git sparse-checkout add libs/zmath
```

@ -1,10 +1,15 @@
const std = @import("std");
const mach_core = @import("mach_core");
const zmath = @import("zmath");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const zmath_pkg = zmath.package(b, target, optimize, .{
.options = .{ .enable_cross_platform_determinism = true },
});
const mach_core_dep = b.dependency("mach_core", .{
.target = target,
.optimize = optimize,
@ -14,7 +19,9 @@ pub fn build(b: *std.Build) !void {
.src = "src/main.zig",
.target = target,
.optimize = optimize,
.deps = &.{},
.deps = &.{
.{ .name = "zmath", .module = zmath_pkg.zmath },
},
});
if (b.args) |args| app.run.addArgs(args);
@ -26,6 +33,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
});
unit_tests.root_module.addImport("zmath", zmath_pkg.zmath);
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");

@ -14,5 +14,6 @@
.url = "https://pkg.machengine.org/mach-core/6a62bcc90e0d072d632788a6575d77942bd09a19.tar.gz",
.hash = "12209d39954fcda0be158461c10f64d14d5c7d097bd6d26785b332d75ffefa7dd7a0",
},
.zmath = .{ .path = "libs/zig-gamedev/libs/zmath" },
},
}

@ -0,0 +1 @@
Subproject commit 25e1794d608d6a1d13e84a42d98c950fd250050d
Loading…
Cancel
Save