Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy install steps from showcase carts #69

Merged
merged 1 commit into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading