wyag

Write yourself a git
Log | Files | Refs | README

build.zig (1465B)


      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 lib = b.addStaticLibrary(.{
      8         .name = "wyag",
      9         .root_source_file = b.path("src/root.zig"),
     10         .target = target,
     11         .optimize = optimize,
     12     });
     13     b.installArtifact(lib);
     14 
     15     const exe = b.addExecutable(.{
     16         .name = "wyag",
     17         .root_source_file = b.path("src/main.zig"),
     18         .target = target,
     19         .optimize = optimize,
     20     });
     21     b.installArtifact(exe);
     22 
     23     const run_cmd = b.addRunArtifact(exe);
     24 
     25     run_cmd.step.dependOn(b.getInstallStep());
     26 
     27     if (b.args) |args| {
     28         run_cmd.addArgs(args);
     29     }
     30 
     31     const run_step = b.step("run", "Run the app");
     32     run_step.dependOn(&run_cmd.step);
     33 
     34     const lib_unit_tests = b.addTest(.{
     35         .root_source_file = b.path("src/root.zig"),
     36         .target = target,
     37         .optimize = optimize,
     38     });
     39 
     40     const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
     41     b.installArtifact(lib_unit_tests);
     42 
     43     const exe_unit_tests = b.addTest(.{
     44         .root_source_file = b.path("src/main.zig"),
     45         .target = target,
     46         .optimize = optimize,
     47     });
     48 
     49     const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
     50 
     51     const test_step = b.step("test", "Run unit tests");
     52     test_step.dependOn(&run_lib_unit_tests.step);
     53     test_step.dependOn(&run_exe_unit_tests.step);
     54 }