From f4a00827adeeecce3eb89122f51812a541eac7d7 Mon Sep 17 00:00:00 2001 From: copygirl Date: Sat, 6 Apr 2024 21:21:27 +0200 Subject: [PATCH] Support latest zmath version --- build.zig | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/build.zig b/build.zig index d4fd3fd..4495509 100644 --- a/build.zig +++ b/build.zig @@ -1,6 +1,5 @@ const std = @import("std"); const mach = @import("mach"); -const zmath = @import("zmath"); pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); @@ -12,9 +11,10 @@ pub fn build(b: *std.Build) !void { // Only using mach.core, avoid pulling unnecessary dependencies. .core = true, }); - const zigimg_dep = b.dependency("zigimg", .{ .target = target, .optimize = optimize }); - const zmath_pkg = zmath.package(b, target, optimize, .{}); - const flecszigble_dep = b.dependency("flecs-zig-ble", .{ .target = target, .optimize = optimize }); + + const zmath = b.dependency("zmath", .{ .target = target, .optimize = optimize }); + const zigimg = b.dependency("zigimg", .{ .target = target, .optimize = optimize }); + const flecszigble = b.dependency("flecs-zig-ble", .{ .target = target, .optimize = optimize }); const app = try mach.CoreApp.init(b, mach_dep.builder, .{ .name = "zig-bloxel-game", @@ -22,12 +22,14 @@ pub fn build(b: *std.Build) !void { .target = target, .optimize = optimize, .deps = &.{ - .{ .name = "zigimg", .module = zigimg_dep.module("zigimg") }, - .{ .name = "zmath", .module = zmath_pkg.zmath }, - .{ .name = "flecs-zig-ble", .module = flecszigble_dep.module("flecs-zig-ble") }, + .{ .name = "zmath", .module = zmath.module("root") }, + .{ .name = "zigimg", .module = zigimg.module("zigimg") }, + .{ .name = "flecs-zig-ble", .module = flecszigble.module("flecs-zig-ble") }, }, }); - app.compile.linkLibrary(flecszigble_dep.artifact("flecs-zig-ble")); + // Honestly, not sure how this works, but this seems + // to be required for Flecs' header file to be found? + app.compile.linkLibrary(flecszigble.artifact("flecs-zig-ble")); if (b.args) |args| app.run.addArgs(args); const run_step = b.step("run", "Run the app"); @@ -38,7 +40,6 @@ 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");