|
1 | | -const std = @import("std"); |
2 | | - |
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 |
8 | | -// zig build run_zig_test2 |
9 | | -// zig build run_zig_test3 |
10 | | -pub fn build(b: *std.Build) void { |
11 | | - // Standard target options allows the person running `zig build` to choose |
12 | | - // what target to build for. Here we do not override the defaults, which |
13 | | - // means any target is allowed, and the default is native. Other options |
14 | | - // for restricting supported target set are available. |
15 | | - const target = b.standardTargetOptions(.{}); |
16 | | - |
17 | | - // Standard optimization options allow the person running `zig build` to select |
18 | | - // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not |
19 | | - // set a preferred release mode, allowing the user to decide how to optimize. |
20 | | - const optimize = b.standardOptimizeOption(.{}); |
21 | | - // const optimize = .ReleaseFast; |
22 | | - // const optimize = .ReleaseSmall; |
23 | | - |
24 | | - // zig_examples |
25 | | - const zig_examples = .{ |
26 | | - |
27 | | - }; |
28 | | - inline for (zig_examples) |name| { |
29 | | - const exe = b.addExecutable(.{ |
30 | | - .name = name, |
31 | | - .root_source_file = .{ .path = std.fmt.comptimePrint("examples/{s}/main.zig", .{name}) }, |
32 | | - .target = target, |
33 | | - .optimize = optimize, |
34 | | - }); |
35 | | - exe.addIncludePath("./thirdparty/ggml/include"); |
36 | | - exe.addIncludePath("./thirdparty/ggml/include/ggml"); |
37 | | - exe.addCSourceFiles(&.{ |
38 | | - "./thirdparty/ggml/src/ggml.c", |
39 | | - }, &.{"-std=c11"}); |
40 | | - exe.linkLibC(); |
41 | | - b.installArtifact(exe); |
42 | | - const run_cmd = b.addRunArtifact(exe); |
43 | | - // This allows the user to pass arguments to the application in the build |
44 | | - // command itself, like this: `zig build run -- arg1 arg2 etc` |
45 | | - run_cmd.step.dependOn(b.getInstallStep()); |
46 | | - if (b.args) |args| run_cmd.addArgs(args); |
47 | | - const run_step = b.step("run_zig_" ++ name, "Run zig_examples"); |
48 | | - run_step.dependOn(&run_cmd.step); |
49 | | - } |
50 | | - |
51 | | - // zig_tests |
52 | | - const zig_tests = .{ |
53 | | - "test0", |
54 | | - "test1", |
55 | | - "test2", |
56 | | - "test3", |
57 | | - }; |
58 | | - inline for (zig_tests) |name| { |
59 | | - const exe = b.addExecutable(.{ |
60 | | - .name = name, |
61 | | - .root_source_file = .{ .path = std.fmt.comptimePrint("tests/{s}.zig", .{name}) }, |
62 | | - .target = target, |
63 | | - .optimize = optimize, |
64 | | - }); |
65 | | - exe.addIncludePath("./thirdparty/ggml/include"); |
66 | | - exe.addIncludePath("./thirdparty/ggml/include/ggml"); |
67 | | - exe.addCSourceFiles(&.{ |
68 | | - "./thirdparty/ggml/src/ggml.c", |
69 | | - }, &.{"-std=c11"}); |
70 | | - exe.linkLibC(); |
71 | | - b.installArtifact(exe); |
72 | | - const run_cmd = b.addRunArtifact(exe); |
73 | | - // This allows the user to pass arguments to the application in the build |
74 | | - // command itself, like this: `zig build run -- arg1 arg2 etc` |
75 | | - run_cmd.step.dependOn(b.getInstallStep()); |
76 | | - if (b.args) |args| run_cmd.addArgs(args); |
77 | | - const run_step = b.step("run_zig_" ++ name, "Run zig_tests"); |
78 | | - run_step.dependOn(&run_cmd.step); |
79 | | - } |
80 | | -} |
81 | | - |
| 1 | +const std = @import("std"); |
| 2 | + |
| 3 | +// Zig Version: 0.11.0-dev.3867+ff37ccd29 |
| 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 |
| 8 | +// zig build run_zig_test2 |
| 9 | +// zig build run_zig_test3 |
| 10 | +pub fn build(b: *std.Build) void { |
| 11 | + // Standard target options allows the person running `zig build` to choose |
| 12 | + // what target to build for. Here we do not override the defaults, which |
| 13 | + // means any target is allowed, and the default is native. Other options |
| 14 | + // for restricting supported target set are available. |
| 15 | + const target = b.standardTargetOptions(.{}); |
| 16 | + |
| 17 | + // Standard optimization options allow the person running `zig build` to select |
| 18 | + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not |
| 19 | + // set a preferred release mode, allowing the user to decide how to optimize. |
| 20 | + const optimize = b.standardOptimizeOption(.{}); |
| 21 | + // const optimize = .ReleaseFast; |
| 22 | + // const optimize = .ReleaseSmall; |
| 23 | + |
| 24 | + // zig_examples |
| 25 | + const zig_examples = .{ |
| 26 | + |
| 27 | + }; |
| 28 | + inline for (zig_examples) |name| { |
| 29 | + const exe = b.addExecutable(.{ |
| 30 | + .name = name, |
| 31 | + .root_source_file = .{ .path = std.fmt.comptimePrint("examples/{s}/main.zig", .{name}) }, |
| 32 | + .target = target, |
| 33 | + .optimize = optimize, |
| 34 | + }); |
| 35 | + exe.addIncludePath("./thirdparty/ggml/include"); |
| 36 | + exe.addIncludePath("./thirdparty/ggml/include/ggml"); |
| 37 | + exe.addCSourceFiles(&.{ |
| 38 | + "./thirdparty/ggml/src/ggml.c", |
| 39 | + }, &.{"-std=c11"}); |
| 40 | + exe.linkLibC(); |
| 41 | + b.installArtifact(exe); |
| 42 | + const run_cmd = b.addRunArtifact(exe); |
| 43 | + // This allows the user to pass arguments to the application in the build |
| 44 | + // command itself, like this: `zig build run -- arg1 arg2 etc` |
| 45 | + run_cmd.step.dependOn(b.getInstallStep()); |
| 46 | + if (b.args) |args| run_cmd.addArgs(args); |
| 47 | + const run_step = b.step("run_zig_" ++ name, "Run zig_examples"); |
| 48 | + run_step.dependOn(&run_cmd.step); |
| 49 | + } |
| 50 | + |
| 51 | + // zig_tests |
| 52 | + const zig_tests = .{ |
| 53 | + "test0", |
| 54 | + "test1", |
| 55 | + "test2", |
| 56 | + "test3", |
| 57 | + }; |
| 58 | + inline for (zig_tests) |name| { |
| 59 | + const exe = b.addExecutable(.{ |
| 60 | + .name = name, |
| 61 | + .root_source_file = .{ .path = std.fmt.comptimePrint("tests/{s}.zig", .{name}) }, |
| 62 | + .target = target, |
| 63 | + .optimize = optimize, |
| 64 | + }); |
| 65 | + exe.addIncludePath("./thirdparty/ggml/include"); |
| 66 | + exe.addIncludePath("./thirdparty/ggml/include/ggml"); |
| 67 | + exe.addCSourceFiles(&.{ |
| 68 | + "./thirdparty/ggml/src/ggml.c", |
| 69 | + }, &.{"-std=c11"}); |
| 70 | + exe.linkLibC(); |
| 71 | + b.installArtifact(exe); |
| 72 | + const run_cmd = b.addRunArtifact(exe); |
| 73 | + // This allows the user to pass arguments to the application in the build |
| 74 | + // command itself, like this: `zig build run -- arg1 arg2 etc` |
| 75 | + run_cmd.step.dependOn(b.getInstallStep()); |
| 76 | + if (b.args) |args| run_cmd.addArgs(args); |
| 77 | + const run_step = b.step("run_zig_" ++ name, "Run zig_tests"); |
| 78 | + run_step.dependOn(&run_cmd.step); |
| 79 | + } |
| 80 | +} |
| 81 | + |
0 commit comments