Skip to content

Commit

Permalink
build: Remove zig-gamedev libraries and use package manager to fetch …
Browse files Browse the repository at this point in the history
…them instead
  • Loading branch information
foxnne committed Mar 25, 2024
1 parent 88b5ef4 commit 26685d2
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 19,283 deletions.
23 changes: 10 additions & 13 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const std = @import("std");
const builtin = @import("builtin");

const zmath = @import("src/deps/zig-gamedev/zmath/build.zig");
const zstbi = @import("src/deps/zig-gamedev/zstbi/build.zig");

const mach = @import("mach");
const mach_gpu_dawn = @import("mach_gpu_dawn");
const xcode_frameworks = @import("xcode_frameworks");
Expand All @@ -20,11 +17,11 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const zstbi_pkg = zstbi.package(b, target, optimize, .{});
const zmath_pkg = zmath.package(b, target, optimize, .{});

const use_sysgpu = b.option(bool, "use_sysgpu", "Use sysgpu") orelse false;

const zstbi = b.dependency("zstbi", .{ .target = target, .optimize = optimize });
const zmath = b.dependency("zmath", .{ .target = target, .optimize = optimize });

const zip_pkg = zip.package(b, .{});

const mach_dep = b.dependency("mach", .{
Expand All @@ -49,8 +46,8 @@ pub fn build(b: *std.Build) !void {
.src = src_path,
.target = target,
.deps = &.{
.{ .name = "zstbi", .module = zstbi_pkg.zstbi },
.{ .name = "zmath", .module = zmath_pkg.zmath },
.{ .name = "zstbi", .module = zstbi.module("root") },
.{ .name = "zmath", .module = zmath.module("root") },
.{ .name = "nfd", .module = nfd.getModule(b) },
.{ .name = "zip", .module = zip_pkg.module },
.{ .name = "zig-imgui", .module = imgui_module },
Expand All @@ -77,17 +74,17 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});

unit_tests.root_module.addImport("zstbi", zstbi_pkg.zstbi);
unit_tests.root_module.addImport("zmath", zmath_pkg.zmath);
unit_tests.root_module.addImport("zstbi", zstbi.module("root"));
unit_tests.root_module.addImport("zmath", zmath.module("root"));
unit_tests.root_module.addImport("nfd", nfd.getModule(b));
unit_tests.root_module.addImport("zip", zip_pkg.module);

const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);

app.compile.root_module.addImport("zstbi", zstbi_pkg.zstbi);
app.compile.root_module.addImport("zmath", zmath_pkg.zmath);
app.compile.root_module.addImport("zstbi", zstbi.module("root"));
app.compile.root_module.addImport("zmath", zmath.module("root"));
app.compile.root_module.addImport("nfd", nfd.getModule(b));
app.compile.root_module.addImport("zip", zip_pkg.module);
app.compile.root_module.addImport("zig-imgui", imgui_module);
Expand All @@ -102,7 +99,7 @@ pub fn build(b: *std.Build) !void {
// xcode_frameworks.addPaths(nfd_lib);
// }
app.compile.linkLibrary(zig_imgui_dep.artifact("imgui"));
zstbi_pkg.link(app.compile);
app.compile.linkLibrary(zstbi.artifact("zstbi"));
zip.link(app.compile);

const assets = ProcessAssetsStep.init(b, "assets", "src/assets.zig", "src/animations.zig");
Expand Down
8 changes: 8 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@
.url = "https://github.com/foxnne/zig-imgui/archive/918b941cfce9127581ab33c7da2306b036ea2d2e.tar.gz",
.hash = "12203ea87584e579079c6f1ccfa61ec1cfe30a8a3a62c6cf5b284039524f59c44a53",
},
.zstbi = .{
.url = "https://github.com/foxnne/zstbi/archive/a1c98da23c4be769100fc441a9cc070e73313a99.tar.gz",
.hash = "1220fb738b701190120ebb3808a2787f8875a7b1866b75744e974288e2072e0a4553",
},
.zmath = .{
.url = "https://github.com/foxnne/zmath/archive/ecfdbf57c6fd0a8ac8a9bf01dafe1e5adae869ae.tar.gz",
.hash = "1220a105762825631ef4dfd4730109120600bba51368f1207fc63b7536333c5748c3",
},
},
}
138 changes: 0 additions & 138 deletions src/deps/zig-gamedev/zmath/README.md

This file was deleted.

104 changes: 0 additions & 104 deletions src/deps/zig-gamedev/zmath/build.zig

This file was deleted.

Loading

0 comments on commit 26685d2

Please sign in to comment.