progress

thread safe progress bar and spinner library for zig
git clone git://brookjeynes.dev/bjeynes/progress.git
Log | Files | Refs | README | LICENSE

build.zig (2194B)


      1 const std = @import("std");
      2 
      3 const name = "progress";
      4 
      5 pub fn build(b: *std.Build) void {
      6     const target = b.standardTargetOptions(.{});
      7     const optimize = b.standardOptimizeOption(.{});
      8 
      9     const mod = b.addModule(name, .{
     10         .root_source_file = b.path("src/root.zig"),
     11         .target = target,
     12         .optimize = optimize,
     13     });
     14 
     15     const progress = b.addLibrary(.{
     16         .name = name,
     17         .root_module = mod,
     18     });
     19 
     20     const docs = b.addInstallDirectory(.{
     21         .source_dir = progress.getEmittedDocs(),
     22         .install_dir = .prefix,
     23         .install_subdir = "docs",
     24     });
     25 
     26     const docs_step = b.step("docs", "Generate docs");
     27     docs_step.dependOn(&docs.step);
     28 
     29     for ([_][]const u8{ "simple", "complex", "thread", "multibar", "multibar-static" }) |example| {
     30         const run_step = b.step(b.fmt("run-bar-{s}", .{example}), b.fmt("Run bar/{s}.zig example", .{example}));
     31         const exe = b.addExecutable(.{
     32             .name = example,
     33             .root_module = b.createModule(.{
     34                 .root_source_file = b.path(b.fmt("examples/bar/{s}.zig", .{example})),
     35                 .target = target,
     36                 .optimize = optimize,
     37             }),
     38         });
     39         exe.root_module.addImport(name, mod);
     40 
     41         const run_cmd = b.addRunArtifact(exe);
     42         run_cmd.step.dependOn(&b.addInstallArtifact(exe, .{}).step);
     43         run_cmd.addPassthruArgs();
     44 
     45         run_step.dependOn(&run_cmd.step);
     46     }
     47 
     48     for ([_][]const u8{ "simple", "complex" }) |example| {
     49         const run_step = b.step(b.fmt("run-spinner-{s}", .{example}), b.fmt("Run spinner/{s}.zig example", .{example}));
     50         const exe = b.addExecutable(.{
     51             .name = example,
     52             .root_module = b.createModule(.{
     53                 .root_source_file = b.path(b.fmt("examples/spinner/{s}.zig", .{example})),
     54                 .target = target,
     55                 .optimize = optimize,
     56             }),
     57         });
     58         exe.root_module.addImport(name, mod);
     59 
     60         const run_cmd = b.addRunArtifact(exe);
     61         run_cmd.step.dependOn(&b.addInstallArtifact(exe, .{}).step);
     62         run_cmd.addPassthruArgs();
     63 
     64         run_step.dependOn(&run_cmd.step);
     65     }
     66 }