| ... | ... | @@ -9,14 +9,26 @@ pub fn build(b: *std.build.Builder) void { |
| 9 | 9 | b.setPreferredReleaseMode(.ReleaseSafe); |
| 10 | 10 | const mode = b.standardReleaseOptions(); |
| 11 | 11 | |
| 12 | const bootstrap = b.option(bool, "bootstrap", "bootstrapping with just the zig compiler"); |
| 12 | 13 | const use_full_name = b.option(bool, "use-full-name", "") orelse false; |
| 13 | 14 | const with_arch_os = b.fmt("-{s}-{s}", .{ @tagName(target.cpu_arch orelse builtin.cpu.arch), @tagName(target.os_tag orelse builtin.os.tag) }); |
| 14 | 15 | const exe_name = b.fmt("{s}{s}", .{ "zigmod", if (use_full_name) with_arch_os else "" }); |
| 16 | const exe = makeExe(b, exe_name, target, mode, bootstrap); |
| 17 | |
| 18 | const run_cmd = exe.run(); |
| 19 | run_cmd.step.dependOn(b.getInstallStep()); |
| 20 | if (b.args) |args| { |
| 21 | run_cmd.addArgs(args); |
| 22 | } |
| 23 | |
| 24 | const run_step = b.step("run", "Run the app"); |
| 25 | run_step.dependOn(&run_cmd.step); |
| 26 | } |
| 15 | 27 | |
| 28 | fn makeExe(b: *std.build.Builder, exe_name: string, target: std.zig.CrossTarget, mode: std.builtin.Mode, bootstrap: ?bool) *std.build.LibExeObjStep { |
| 16 | 29 | const exe = b.addExecutable(exe_name, "src/main.zig"); |
| 17 | 30 | exe.setTarget(target); |
| 18 | 31 | exe.setBuildMode(mode); |
| 19 | | const bootstrap = b.option(bool, "bootstrap", "bootstrapping with just the zig compiler"); |
| 20 | 32 | |
| 21 | 33 | const exe_options = b.addOptions(); |
| 22 | 34 | exe.addOptions("build_options", exe_options); |
| ... | ... | @@ -55,13 +67,5 @@ pub fn build(b: *std.build.Builder) void { |
| 55 | 67 | } |
| 56 | 68 | |
| 57 | 69 | exe.install(); |
| 58 | | |
| 59 | | const run_cmd = exe.run(); |
| 60 | | run_cmd.step.dependOn(b.getInstallStep()); |
| 61 | | if (b.args) |args| { |
| 62 | | run_cmd.addArgs(args); |
| 63 | | } |
| 64 | | |
| 65 | | const run_step = b.step("run", "Run the app"); |
| 66 | | run_step.dependOn(&run_cmd.step); |
| 70 | return exe; |
| 67 | 71 | } |