this repo has no description
13
fork

Configure Feed

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

at 3d37f043a161fd32897ad44a2dddbfaab75faa8a 123 lines 3.6 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 zigimg_dep = b.dependency("zigimg", .{ 10 .optimize = optimize, 11 .target = target, 12 }); 13 const uucode_dep = b.dependency("uucode", .{ 14 .target = target, 15 .optimize = optimize, 16 .fields = @as([]const []const u8, &.{ 17 "east_asian_width", 18 "grapheme_break", 19 "general_category", 20 "is_emoji_presentation", 21 }), 22 }); 23 24 // Module 25 const vaxis_mod = b.addModule("vaxis", .{ 26 .root_source_file = root_source_file, 27 .target = target, 28 .optimize = optimize, 29 }); 30 vaxis_mod.addImport("zigimg", zigimg_dep.module("zigimg")); 31 vaxis_mod.addImport("uucode", uucode_dep.module("uucode")); 32 33 // Examples 34 const Example = enum { 35 cli, 36 counter, 37 fuzzy, 38 image, 39 main, 40 scroll, 41 split_view, 42 table, 43 text_input, 44 text_view, 45 list_view, 46 vaxis, 47 view, 48 vt, 49 }; 50 const example_option = b.option(Example, "example", "Example to run (default: text_input)") orelse .text_input; 51 const example_step = b.step("example", "Run example"); 52 const example = b.addExecutable(.{ 53 .name = "example", 54 .root_module = b.createModule(.{ 55 .root_source_file = b.path( 56 b.fmt("examples/{s}.zig", .{@tagName(example_option)}), 57 ), 58 .target = target, 59 .optimize = optimize, 60 .imports = &.{ 61 .{ .name = "vaxis", .module = vaxis_mod }, 62 }, 63 }), 64 }); 65 66 const example_run = b.addRunArtifact(example); 67 example_step.dependOn(&example_run.step); 68 69 // Benchmarks 70 const bench_step = b.step("bench", "Run benchmarks"); 71 const bench = b.addExecutable(.{ 72 .name = "bench", 73 .root_module = b.createModule(.{ 74 .root_source_file = b.path("bench/bench.zig"), 75 .target = target, 76 .optimize = optimize, 77 .imports = &.{ 78 .{ .name = "vaxis", .module = vaxis_mod }, 79 }, 80 }), 81 }); 82 const bench_run = b.addRunArtifact(bench); 83 if (b.args) |args| { 84 bench_run.addArgs(args); 85 } 86 bench_step.dependOn(&bench_run.step); 87 88 // Tests 89 const tests_step = b.step("test", "Run tests"); 90 91 const tests = b.addTest(.{ 92 .root_module = b.createModule(.{ 93 .root_source_file = b.path("src/main.zig"), 94 .target = target, 95 .optimize = optimize, 96 .imports = &.{ 97 .{ .name = "zigimg", .module = zigimg_dep.module("zigimg") }, 98 .{ .name = "uucode", .module = uucode_dep.module("uucode") }, 99 }, 100 }), 101 }); 102 103 const tests_run = b.addRunArtifact(tests); 104 b.installArtifact(tests); 105 tests_step.dependOn(&tests_run.step); 106 107 // Docs 108 const docs_step = b.step("docs", "Build the vaxis library docs"); 109 const docs_obj = b.addObject(.{ 110 .name = "vaxis", 111 .root_module = b.createModule(.{ 112 .root_source_file = root_source_file, 113 .target = target, 114 .optimize = optimize, 115 }), 116 }); 117 const docs = docs_obj.getEmittedDocs(); 118 docs_step.dependOn(&b.addInstallDirectory(.{ 119 .source_dir = docs, 120 .install_dir = .prefix, 121 .install_subdir = "docs", 122 }).step); 123}