Skip to content

Commit

Permalink
Copy install steps from showcase carts.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobly0 committed May 19, 2024
1 parent 9b10269 commit 70df2ef
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions showcase/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const carts = .{
.{ "zeroman", @import("zeroman") },
.{ "blobs", @import("blobs") },
.{ "plasma", @import("plasma") },
.{ "metalgear_timer", @import("metalgear_timer") },
.{ "metalgear-timer", @import("metalgear-timer") },
.{ "raytracer", @import("raytracer") },
.{ "neopixelpuzzle", @import("neopixelpuzzle") },
.{ "dvd", @import("dvd") },
Expand All @@ -17,15 +17,30 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});

inline for (carts) |cart| {
const cart_name = cart[0];
const cart_import = cart[1];
const cart_name, const cart_import = cart;
_ = cart_import.author_name;
if (@hasDecl(cart_import, "author_handle"))
_ = cart_import.author_handle;
_ = cart_import.cart_title;
_ = cart_import.description;
const dep = b.dependency(cart_name, .{ .optimize = optimize });
b.getInstallStep().dependOn(dep.builder.getInstallStep());
for (dep.builder.install_tls.step.dependencies.items) |dep_step| {
switch (dep_step.id) {
.install_artifact => {
const install_artifact = dep_step.cast(std.Build.Step.InstallArtifact).?;
b.installArtifact(install_artifact.artifact);
},
.install_file => {
const install_file = dep_step.cast(std.Build.Step.InstallFile).?;
b.getInstallStep().dependOn(&b.addInstallFileWithDir(
install_file.source,
install_file.dir,
install_file.dest_rel_path,
).step);
},
else => unreachable,
}
}
}

//zine.addWebsite(b, .{
Expand Down
2 changes: 1 addition & 1 deletion showcase/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.zeroman = .{ .path = "carts/zeroman" },
.blobs = .{ .path = "carts/blobs" },
.plasma = .{ .path = "carts/plasma" },
.metalgear_timer = .{ .path = "carts/metalgear-timer" },
.@"metalgear-timer" = .{ .path = "carts/metalgear-timer" },
.raytracer = .{ .path = "carts/raytracer" },
.neopixelpuzzle = .{ .path = "carts/neopixelpuzzle" },
.dvd = .{ .path = "carts/dvd" },
Expand Down

0 comments on commit 70df2ef

Please sign in to comment.