aboutsummaryrefslogtreecommitdiffstats
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig33
1 files changed, 10 insertions, 23 deletions
diff --git a/build.zig b/build.zig
index b9c837d..f673f6b 100644
--- a/build.zig
+++ b/build.zig
@@ -1,47 +1,34 @@
1const std = @import("std"); 1const std = @import("std");
2 2
3pub fn build(b: *std.build.Builder) !void { 3pub fn build(b: *std.build.Builder) !void {
4 // Standard target options allows the person running `zig build` to choose
5 // what target to build for. Here we do not override the defaults, which
6 // means any target is allowed, and the default is native. Other options
7 // for restricting supported target set are available.
8 const target = b.standardTargetOptions(.{});
9
10 // Standard release options allow the person running `zig build` to select
11 // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
12 const mode = b.standardReleaseOptions(); 4 const mode = b.standardReleaseOptions();
5 const target = b.standardTargetOptions(.{});
13 6
14 const version = "0.1.0-dev"; 7 var lib_tests = b.addTest("src/lib.zig");
15
16 const lib = b.addStaticLibrary("nkeys", "src/nkeys.zig");
17 lib.setBuildMode(mode);
18 lib.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version));
19 lib.install();
20
21 var lib_tests = b.addTest("src/nkeys.zig");
22 lib_tests.setBuildMode(mode); 8 lib_tests.setBuildMode(mode);
23 lib_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version));
24 9
25 const test_step = b.step("test", "Run library tests"); 10 const test_step = b.step("test", "Run library tests");
26 test_step.dependOn(&lib_tests.step); 11 test_step.dependOn(&lib_tests.step);
27 12
13 const znk_version = "0.1.0";
14
28 var znk_tests = b.addTest("tool/znk.zig"); 15 var znk_tests = b.addTest("tool/znk.zig");
29 znk_tests.setBuildMode(mode); 16 znk_tests.setBuildMode(mode);
30 znk_tests.addPackagePath("nkeys", "src/nkeys.zig"); 17 znk_tests.addPackagePath("nkeys", "src/lib.zig");
31 znk_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); 18 znk_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, znk_version));
32 19
33 const znk_test_step = b.step("test-znk", "Run znk tests"); 20 const znk_test_step = b.step("test-znk", "Run znk tests");
34 znk_test_step.dependOn(&znk_tests.step); 21 znk_test_step.dependOn(&znk_tests.step);
35 22
36 const znk = b.addExecutable("znk", "tool/znk.zig"); 23 const znk = b.addExecutable("znk", "tool/znk.zig");
37 znk.setTarget(target);
38 znk.setBuildMode(mode); 24 znk.setBuildMode(mode);
39 znk.addPackagePath("nkeys", "src/nkeys.zig"); 25 znk.setTarget(target);
40 znk.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); 26 znk.addPackagePath("nkeys", "src/lib.zig");
27 znk.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, znk_version));
41 28
42 const znk_install = b.addInstallArtifact(znk); 29 const znk_install = b.addInstallArtifact(znk);
43 30
44 const znk_step = b.step("znk", "Build only znk"); 31 const znk_step = b.step("znk", "Build znk");
45 znk_step.dependOn(&znk_install.step); 32 znk_step.dependOn(&znk_install.step);
46 33
47 const znk_run_cmd = znk.run(); 34 const znk_run_cmd = znk.run();