Skip to content

Commit

Permalink
Copy install steps from showcase carts (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobly0 authored May 19, 2024
1 parent 9b10269 commit 5b6c2cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 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,24 @@ 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| {
if (dep_step.cast(std.Build.Step.InstallArtifact)) |install_artifact| {
b.installArtifact(install_artifact.artifact);
} else if (dep_step.cast(std.Build.Step.InstallFile)) |install_file| {
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 5b6c2cd

Please sign in to comment.