build.zig 970 B

12345678910111213141516171819202122232425262728
  1. const std = @import("std");
  2. pub fn build(b: *std.build.Builder) void {
  3. // Standard target options allows the person running `zig build` to choose
  4. // what target to build for. Here we do not override the defaults, which
  5. // means any target is allowed, and the default is native. Other options
  6. // for restricting supported target set are available.
  7. const target = b.standardTargetOptions(.{});
  8. // Standard release options allow the person running `zig build` to select
  9. // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
  10. const mode = b.standardReleaseOptions();
  11. const exe = b.addExecutable("zmpsh", "src/main.zig");
  12. exe.setTarget(target);
  13. exe.setBuildMode(mode);
  14. exe.install();
  15. const run_cmd = exe.run();
  16. run_cmd.step.dependOn(b.getInstallStep());
  17. if (b.args) |args| {
  18. run_cmd.addArgs(args);
  19. }
  20. const run_step = b.step("run", "Run the app");
  21. run_step.dependOn(&run_cmd.step);
  22. }