this repo has no description
13
fork

Configure Feed

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

at 01605eebf65be21caa85ee9d840047f864553308 90 lines 2.8 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("grapheme", zg_dep.module("grapheme")); 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 table, 38 text_input, 39 vaxis, 40 view, 41 vt, 42 }; 43 const example_option = b.option(Example, "example", "Example to run (default: text_input)") orelse .text_input; 44 const example_step = b.step("example", "Run example"); 45 const example = b.addExecutable(.{ 46 .name = "example", 47 // future versions should use b.path, see zig PR #19597 48 .root_source_file = b.path( 49 b.fmt("examples/{s}.zig", .{@tagName(example_option)}), 50 ), 51 .target = target, 52 .optimize = optimize, 53 }); 54 example.root_module.addImport("vaxis", vaxis_mod); 55 56 const example_run = b.addRunArtifact(example); 57 example_step.dependOn(&example_run.step); 58 59 // Tests 60 const tests_step = b.step("test", "Run tests"); 61 62 const tests = b.addTest(.{ 63 .root_source_file = b.path("src/main.zig"), 64 .target = target, 65 .optimize = optimize, 66 }); 67 tests.root_module.addImport("code_point", zg_dep.module("code_point")); 68 tests.root_module.addImport("grapheme", zg_dep.module("grapheme")); 69 tests.root_module.addImport("DisplayWidth", zg_dep.module("DisplayWidth")); 70 tests.root_module.addImport("zigimg", zigimg_dep.module("zigimg")); 71 72 const tests_run = b.addRunArtifact(tests); 73 b.installArtifact(tests); 74 tests_step.dependOn(&tests_run.step); 75 76 // Docs 77 const docs_step = b.step("docs", "Build the vaxis library docs"); 78 const docs_obj = b.addObject(.{ 79 .name = "vaxis", 80 .root_source_file = root_source_file, 81 .target = target, 82 .optimize = optimize, 83 }); 84 const docs = docs_obj.getEmittedDocs(); 85 docs_step.dependOn(&b.addInstallDirectory(.{ 86 .source_dir = docs, 87 .install_dir = .prefix, 88 .install_subdir = "docs", 89 }).step); 90}