zigvm

zigvm: Zig Version Manager
git clone git://code.mfashby.net:/zigvm
Log | Files | Refs | README

build.zig (1111B)


      1 const std = @import("std");
      2 
      3 pub fn build(b: *std.Build) void {
      4     const target = b.standardTargetOptions(.{});
      5     const optimize = b.standardOptimizeOption(.{});
      6 
      7     const minisign = b.dependency("minisign", .{ .target = target, .optimize = optimize });
      8     const exe = b.addExecutable(.{
      9         .name = "zigvm",
     10         .root_source_file = b.path("src/main.zig"),
     11         .target = target,
     12         .optimize = optimize,
     13     });
     14     exe.root_module.addImport("minisign", minisign.module("minizign"));
     15 
     16     b.installArtifact(exe);
     17     const run_cmd = b.addRunArtifact(exe);
     18 
     19     run_cmd.step.dependOn(b.getInstallStep());
     20 
     21     if (b.args) |args| {
     22         run_cmd.addArgs(args);
     23     }
     24 
     25     const run_step = b.step("run", "Run the app");
     26     run_step.dependOn(&run_cmd.step);
     27 
     28     const exe_unit_tests = b.addTest(.{
     29         .root_source_file = b.path("src/main.zig"),
     30         .target = target,
     31         .optimize = optimize,
     32     });
     33 
     34     const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
     35 
     36     const test_step = b.step("test", "Run unit tests");
     37     test_step.dependOn(&run_exe_unit_tests.step);
     38 }