11const std = @import ("std" );
22
3- // Zig Version: 0.11.0-dev.3798+a5e15eced
4- // Zig Build Command: zig build
5- // Zig Run Command: zig build -h
6- // zig build run_test0_zig
7- // zig build run_test1_zig
3+ // // Zig Version: 0.11.0-dev.3798+a5e15eced
4+ // // Zig Build Command: zig build
5+ // // Zig Run Command: zig build -h
6+ // // zig build run_zig_test0
7+ // // zig build run_zig_test1
88pub fn build (b : * std.Build ) void {
9+ // // Standard target options allows the person running `zig build` to choose
10+ // // what target to build for. Here we do not override the defaults, which
11+ // // means any target is allowed, and the default is native. Other options
12+ // // for restricting supported target set are available.
913 const target = b .standardTargetOptions (.{});
14+
15+ // // Standard optimization options allow the person running `zig build` to select
16+ // // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not
17+ // // set a preferred release mode, allowing the user to decide how to optimize.
1018 const optimize = b .standardOptimizeOption (.{});
19+ // const optimize = .ReleaseFast;
20+ // const optimize = .ReleaseSmall;
21+
22+ // zig_examples
23+ const zig_examples = .{
24+
25+ };
26+ inline for (zig_examples ) | name | {
27+ const exe = b .addExecutable (.{
28+ .name = name ,
29+ .root_source_file = .{ .path = std .fmt .comptimePrint ("examples/{s}/main.zig" , .{name }) },
30+ .target = target ,
31+ .optimize = optimize ,
32+ });
33+ exe .addIncludePath ("./thirdparty/ggml/include" );
34+ exe .addIncludePath ("./thirdparty/ggml/include/ggml" );
35+ exe .addCSourceFiles (&.{
36+ "./thirdparty/ggml/src/ggml.c" ,
37+ }, &.{"-std=c11" });
38+ exe .linkLibC ();
39+ b .installArtifact (exe );
40+ const run_cmd = b .addRunArtifact (exe );
41+ // // This allows the user to pass arguments to the application in the build
42+ // // command itself, like this: `zig build run -- arg1 arg2 etc`
43+ run_cmd .step .dependOn (b .getInstallStep ());
44+ if (b .args ) | args | run_cmd .addArgs (args );
45+ const run_step = b .step ("run_zig_" ++ name , "Run zig_examples" );
46+ run_step .dependOn (& run_cmd .step );
47+ }
1148
12- // tests_zig
13- const tests_zig = .{
49+ // zig_tests
50+ const zig_tests = .{
1451 "test0" ,
1552 "test1" ,
1653 };
17- inline for (tests_zig ) | name | {
54+ inline for (zig_tests ) | name | {
1855 const exe = b .addExecutable (.{
1956 .name = name ,
2057 .root_source_file = .{ .path = std .fmt .comptimePrint ("tests/{s}.zig" , .{name }) },
@@ -29,9 +66,11 @@ pub fn build(b: *std.Build) void {
2966 exe .linkLibC ();
3067 b .installArtifact (exe );
3168 const run_cmd = b .addRunArtifact (exe );
69+ // // This allows the user to pass arguments to the application in the build
70+ // // command itself, like this: `zig build run -- arg1 arg2 etc`
3271 run_cmd .step .dependOn (b .getInstallStep ());
3372 if (b .args ) | args | run_cmd .addArgs (args );
34- const run_step = b .step ("run_ " ++ name ++ "_zig" , "Run tests_zig " );
73+ const run_step = b .step ("run_zig_ " ++ name , "Run zig_tests " );
3574 run_step .dependOn (& run_cmd .step );
3675 }
3776}
0 commit comments