-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jason Phan
committed
Dec 10, 2022
1 parent
b5806e7
commit 79bae72
Showing
1 changed file
with
19 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
const std = @import("std"); | ||
|
||
const pkg_name = "getty"; | ||
const pkg_path = "../src/getty.zig"; | ||
|
||
const examples = .{ | ||
"bool-serializer", | ||
"bool-deserializer", | ||
"seq-serializer", | ||
"seq-deserializer", | ||
}; | ||
|
||
pub fn build(b: *std.build.Builder) void { | ||
const target = b.standardTargetOptions(.{}); | ||
const mode = b.standardReleaseOptions(); | ||
|
||
inline for (.{ | ||
"bool-serializer", | ||
"bool-deserializer", | ||
"seq-serializer", | ||
"seq-deserializer", | ||
}) |example| { | ||
const exe = b.addExecutable("examples", example ++ "/main.zig"); | ||
inline for (examples) |e| { | ||
const example_path = e ++ "/main.zig"; | ||
const exe_name = "example-" ++ e; | ||
const run_name = "run-" ++ e; | ||
const run_desc = "Run the " ++ e ++ " example"; | ||
|
||
const exe = b.addExecutable(exe_name, example_path); | ||
exe.setTarget(target); | ||
exe.setBuildMode(mode); | ||
exe.addPackagePath("getty", "../src/getty.zig"); | ||
exe.addPackagePath(pkg_name, pkg_path); | ||
exe.install(); | ||
|
||
const run_cmd = exe.run(); | ||
run_cmd.step.dependOn(b.getInstallStep()); | ||
const run_step = b.step("run-" ++ example, "Run the " ++ example ++ " example"); | ||
const run_step = b.step(run_name, run_desc); | ||
run_step.dependOn(&run_cmd.step); | ||
} | ||
} |