From 70df2efe0d25225b5e1b7c11877e28eeeae1fdad Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Sun, 19 May 2024 02:15:19 -0400 Subject: [PATCH] Copy install steps from showcase carts. --- showcase/build.zig | 23 +++++++++++++++++++---- showcase/build.zig.zon | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/showcase/build.zig b/showcase/build.zig index 64734f9..43859ad 100644 --- a/showcase/build.zig +++ b/showcase/build.zig @@ -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") }, @@ -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, .{ diff --git a/showcase/build.zig.zon b/showcase/build.zig.zon index a719727..b75a153 100644 --- a/showcase/build.zig.zon +++ b/showcase/build.zig.zon @@ -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" },