const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const pretty = b.addModule("pretty", .{ .root_source_file = b.path("pretty.zig"), .target = target, .optimize = optimize, }); const options = b.addOptions(); const indent_width = b.option(u32, "indent-width", "Set indent width") orelse 2; options.addOption(u32, "indent_width", indent_width); const skip_root_type_name = b.option(bool, "skip-root-type-name", "Don't show the type name of the first element") orelse false; options.addOption(bool, "skip_root_type_name", skip_root_type_name); const example = b.addExecutable(.{ .root_module = b.createModule(.{ .root_source_file = b.path("example/main.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "pretty", .module = pretty }, .{ .name = "build-options", .module = options.createModule() }, }, }), .name = "pretty-example", }); b.installArtifact(example); const run_example = b.addRunArtifact(example); run_example.step.dependOn(b.getInstallStep()); if (b.args) |args| run_example.addArgs(args); const run_step = b.step("example", "Run the example"); run_step.dependOn(&run_example.step); }