diff options
author | Rutger Broekhoff | 2021-05-25 20:32:42 +0200 |
---|---|---|
committer | Rutger Broekhoff | 2021-05-25 20:32:42 +0200 |
commit | 5fc11d694ad86bdb08fe61a3007aa0c44ba894aa (patch) | |
tree | 216c08cdbcfc28e0886c85c4568a36cae2c9aa57 /build.zig | |
parent | 3b6b7b5eefe6270f126048d7a1ff5919f1da18cf (diff) | |
download | zig-nkeys-5fc11d694ad86bdb08fe61a3007aa0c44ba894aa.tar.gz zig-nkeys-5fc11d694ad86bdb08fe61a3007aa0c44ba894aa.zip |
Put the znk tool into a different directory
Diffstat (limited to 'build.zig')
-rw-r--r-- | build.zig | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -22,28 +22,34 @@ pub fn build(b: *std.build.Builder) !void { | |||
22 | lib_tests.setBuildMode(mode); | 22 | lib_tests.setBuildMode(mode); |
23 | lib_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | 23 | lib_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); |
24 | 24 | ||
25 | var znk_tests = b.addTest("src/znk.zig"); | ||
26 | znk_tests.setBuildMode(mode); | ||
27 | znk_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | ||
28 | |||
29 | const test_step = b.step("test", "Run library tests"); | 25 | const test_step = b.step("test", "Run library tests"); |
30 | test_step.dependOn(&lib_tests.step); | 26 | test_step.dependOn(&lib_tests.step); |
31 | 27 | ||
28 | var znk_tests = b.addTest("tool/znk.zig"); | ||
29 | znk_tests.setBuildMode(mode); | ||
30 | znk_tests.addPackagePath("nkeys", "src/nkeys.zig"); | ||
31 | znk_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | ||
32 | |||
32 | const znk_test_step = b.step("znk-test", "Run znk tests"); | 33 | const znk_test_step = b.step("znk-test", "Run znk tests"); |
33 | znk_test_step.dependOn(&znk_tests.step); | 34 | znk_test_step.dependOn(&znk_tests.step); |
34 | 35 | ||
35 | const exe = b.addExecutable("znk", "src/znk.zig"); | 36 | const znk = b.addExecutable("znk", "tool/znk.zig"); |
36 | exe.setTarget(target); | 37 | znk.setTarget(target); |
37 | exe.setBuildMode(mode); | 38 | znk.setBuildMode(mode); |
38 | exe.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | 39 | znk.addPackagePath("nkeys", "src/nkeys.zig"); |
39 | exe.install(); | 40 | znk.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); |
41 | |||
42 | const znk_install = b.addInstallArtifact(znk); | ||
43 | |||
44 | const znk_step = b.step("znk", "Build only znk"); | ||
45 | znk_step.dependOn(&znk_install.step); | ||
40 | 46 | ||
41 | const run_cmd = exe.run(); | 47 | const znk_run_cmd = znk.run(); |
42 | run_cmd.step.dependOn(b.getInstallStep()); | 48 | znk_run_cmd.step.dependOn(&znk_install.step); |
43 | if (b.args) |args| { | 49 | if (b.args) |args| { |
44 | run_cmd.addArgs(args); | 50 | znk_run_cmd.addArgs(args); |
45 | } | 51 | } |
46 | 52 | ||
47 | const run_step = b.step("run", "Run znk"); | 53 | const znk_run_step = b.step("znk-run", "Run znk"); |
48 | run_step.dependOn(&run_cmd.step); | 54 | znk_run_step.dependOn(&znk_run_cmd.step); |
49 | } | 55 | } |