Skip to content

Commit cb3fe17

Browse files
Loris CroLoris Cro
Loris Cro
authored and
Loris Cro
committed
update addUpdateSourceFiles example in learn/build-system
closes #465
1 parent 1f4f83b commit cb3fe17

File tree

1 file changed

+4
-1
lines changed
  • zig-code/build-system/mutate-source-files

1 file changed

+4
-1
lines changed

zig-code/build-system/mutate-source-files/build.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
const std = @import("std");
22

33
pub fn build(b: *std.Build) void {
4+
const target = b.standardTargetOptions(.{});
45
const exe = b.addExecutable(.{
56
.name = "demo",
67
.root_source_file = b.path("src/main.zig"),
8+
.target = target,
79
});
810
b.installArtifact(exe);
911

1012
const proto_gen = b.addExecutable(.{
1113
.name = "proto_gen",
1214
.root_source_file = b.path("tools/proto_gen.zig"),
15+
.target = target,
1316
});
1417

1518
const run = b.addRunArtifact(proto_gen);
1619
const generated_protocol_file = run.addOutputFileArg("protocol.zig");
1720

18-
const wf = b.addWriteFiles();
21+
const wf = b.addUpdateSourceFiles();
1922
wf.addCopyFileToSource(generated_protocol_file, "src/protocol.zig");
2023

2124
const update_protocol_step = b.step("update-protocol", "update src/protocol.zig to latest");

0 commit comments

Comments
 (0)