this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

at cb00a91471f6b858a828c754211862acb8e3640a 100 lines 3.1 kB view raw
1const std = @import("std"); 2 3pub fn build(b: *std.Build) void { 4 const target = b.standardTargetOptions(.{}); 5 const optimize = b.standardOptimizeOption(.{}); 6 const root_source_file = b.path("src/main.zig"); 7 8 // Dependencies 9 const zg_dep = b.dependency("zg", .{ 10 .optimize = optimize, 11 .target = target, 12 }); 13 const zigimg_dep = b.dependency("zigimg", .{ 14 .optimize = optimize, 15 .target = target, 16 }); 17 18 // Module 19 const vaxis_mod = b.addModule("vaxis", .{ 20 .root_source_file = root_source_file, 21 .target = target, 22 .optimize = optimize, 23 }); 24 vaxis_mod.addImport("code_point", zg_dep.module("code_point")); 25 vaxis_mod.addImport("Graphemes", zg_dep.module("Graphemes")); 26 vaxis_mod.addImport("DisplayWidth", zg_dep.module("DisplayWidth")); 27 vaxis_mod.addImport("zigimg", zigimg_dep.module("zigimg")); 28 29 // Examples 30 const Example = enum { 31 cli, 32 counter, 33 fuzzy, 34 image, 35 main, 36 scroll, 37 split_view, 38 table, 39 text_input, 40 vaxis, 41 view, 42 vt, 43 }; 44 const example_option = b.option(Example, "example", "Example to run (default: text_input)") orelse .text_input; 45 const example_step = b.step("example", "Run example"); 46 const example = b.addExecutable(.{ 47 .name = "example", 48 .root_module = b.createModule(.{ 49 .root_source_file = b.path( 50 b.fmt("examples/{s}.zig", .{@tagName(example_option)}), 51 ), 52 .target = target, 53 .optimize = optimize, 54 .imports = &.{ 55 .{ .name = "vaxis", .module = vaxis_mod }, 56 }, 57 }), 58 }); 59 60 const example_run = b.addRunArtifact(example); 61 example_step.dependOn(&example_run.step); 62 63 // Tests 64 const tests_step = b.step("test", "Run tests"); 65 66 const tests = b.addTest(.{ 67 .root_module = b.createModule(.{ 68 .root_source_file = b.path("src/main.zig"), 69 .target = target, 70 .optimize = optimize, 71 .imports = &.{ 72 .{ .name = "code_point", .module = zg_dep.module("code_point") }, 73 .{ .name = "Graphemes", .module = zg_dep.module("Graphemes") }, 74 .{ .name = "DisplayWidth", .module = zg_dep.module("DisplayWidth") }, 75 .{ .name = "zigimg", .module = zigimg_dep.module("zigimg") }, 76 }, 77 }), 78 }); 79 80 const tests_run = b.addRunArtifact(tests); 81 b.installArtifact(tests); 82 tests_step.dependOn(&tests_run.step); 83 84 // Docs 85 const docs_step = b.step("docs", "Build the vaxis library docs"); 86 const docs_obj = b.addObject(.{ 87 .name = "vaxis", 88 .root_module = b.createModule(.{ 89 .root_source_file = root_source_file, 90 .target = target, 91 .optimize = optimize, 92 }), 93 }); 94 const docs = docs_obj.getEmittedDocs(); 95 docs_step.dependOn(&b.addInstallDirectory(.{ 96 .source_dir = docs, 97 .install_dir = .prefix, 98 .install_subdir = "docs", 99 }).step); 100}