andrewrk / poop

Performance Optimizer Observation Platform
MIT License
788 stars 50 forks source link

Update for Zig breaking change: per-Module #47

Closed moderation closed 7 months ago

moderation commented 7 months ago

No longer able to build on latest Zig - https://github.com/ziglang/zig/pull/18160

moderation commented 7 months ago

This is working for me but it may but removes the platform check that would prevent building on MacOS

diff --git a/build.zig b/build.zig
index 263a1f9..b2622e7 100644
--- a/build.zig
+++ b/build.zig
@@ -7,15 +7,14 @@ pub fn build(b: *std.Build) void {
     const exe = b.addExecutable(.{
         .name = "poop",
         .root_source_file = .{ .path = "src/main.zig" },
+        .strip = b.option(bool, "strip", "strip the binary") orelse switch (optimize) {
+            .Debug, .ReleaseSafe => false,
+            .ReleaseFast, .ReleaseSmall => true,
+        },
         .target = target,
         .optimize = optimize,
     });

-    exe.strip = b.option(bool, "strip", "strip the binary") orelse switch (optimize) {
-        .Debug, .ReleaseSafe => false,
-        .ReleaseFast, .ReleaseSmall => true,
-    };
-
     b.installArtifact(exe);

     const release = b.step("release", "make an upstream binary release");
@@ -26,12 +25,9 @@ pub fn build(b: *std.Build) void {
         const rel_exe = b.addExecutable(.{
             .name = "poop",
             .root_source_file = .{ .path = "src/main.zig" },
-            .target = std.zig.CrossTarget.parse(.{
-                .arch_os_abi = target_string,
-            }) catch unreachable,
+            .target = target,
             .optimize = .ReleaseSafe,
         });
-        rel_exe.strip = true;

         const install = b.addInstallArtifact(rel_exe, .{});
         install.dest_dir = .prefix;