this repo has no description
at main 44 lines 1.3 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 7 // library module 8 const redis_mod = b.addModule("redis", .{ 9 .root_source_file = b.path("src/redis.zig"), 10 .target = target, 11 .optimize = optimize, 12 }); 13 14 // unit tests 15 const unit_tests = b.addTest(.{ 16 .root_module = b.createModule(.{ 17 .root_source_file = b.path("src/redis.zig"), 18 .target = target, 19 .optimize = optimize, 20 }), 21 }); 22 const run_unit_tests = b.addRunArtifact(unit_tests); 23 const test_step = b.step("test", "run unit tests"); 24 test_step.dependOn(&run_unit_tests.step); 25 26 // example executable 27 const example = b.addExecutable(.{ 28 .name = "redis-example", 29 .root_module = b.createModule(.{ 30 .root_source_file = b.path("example.zig"), 31 .target = target, 32 .optimize = optimize, 33 .imports = &.{ 34 .{ .name = "redis", .module = redis_mod }, 35 }, 36 }), 37 }); 38 39 const run_example = b.addRunArtifact(example); 40 const run_step = b.step("run", "run the example"); 41 run_step.dependOn(&run_example.step); 42 43 b.installArtifact(example); 44}