this repo has no description

modified zig init

+88
+2
.gitignore
··· 1 + /zig-cache 2 + /zig-out
+42
build.zig
··· 1 + const std = @import("std"); 2 + 3 + pub fn build(b: *std.Build) void { 4 + const target = b.standardTargetOptions(.{}); 5 + const optimize = b.standardOptimizeOption(.{}); 6 + 7 + const rayray = b.addModule("rayray", .{ 8 + .root_source_file = .{ .path = "src/rayray.zig" }, 9 + .target = target, 10 + .optimize = optimize, 11 + }); 12 + 13 + const exe = b.addExecutable(.{ 14 + .name = "rayray", 15 + .root_source_file = .{ .path = "src/main.zig" }, 16 + .target = target, 17 + .optimize = optimize, 18 + }); 19 + 20 + exe.root_module.addImport("rayray", rayray); 21 + 22 + b.installArtifact(exe); 23 + 24 + const run_cmd = b.addRunArtifact(exe); 25 + run_cmd.step.dependOn(b.getInstallStep()); 26 + 27 + if (b.args) |args| { 28 + run_cmd.addArgs(args); 29 + } 30 + 31 + const run_step = b.step("run", "Run the app"); 32 + run_step.dependOn(&run_cmd.step); 33 + 34 + const lib_unit_tests = b.addTest(.{ 35 + .root_source_file = .{ .path = "src/root.zig" }, 36 + .target = target, 37 + .optimize = optimize, 38 + }); 39 + const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); 40 + const test_step = b.step("test", "Run unit tests"); 41 + test_step.dependOn(&run_lib_unit_tests.step); 42 + }
+17
build.zig.zon
··· 1 + .{ 2 + .name = "rayray", 3 + .version = "0.0.0", 4 + .minimum_zig_version = "0.12.0-dev.2631+3069669bc", 5 + .dependencies = .{ 6 + // See `zig fetch --save <url>` for a command-line interface for adding dependencies. 7 + }, 8 + .paths = .{ 9 + "", 10 + // For example... 11 + //"build.zig", 12 + //"build.zig.zon", 13 + //"src", 14 + //"LICENSE", 15 + //"README.md", 16 + }, 17 + }
+17
src/main.zig
··· 1 + const std = @import("std"); 2 + 3 + pub fn main() !void { 4 + // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`) 5 + std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); 6 + 7 + // stdout is for the actual output of your application, for example if you 8 + // are implementing gzip, then only the compressed bytes should be sent to 9 + // stdout, not any debugging messages. 10 + const stdout_file = std.io.getStdOut().writer(); 11 + var bw = std.io.bufferedWriter(stdout_file); 12 + const stdout = bw.writer(); 13 + 14 + try stdout.print("Run `zig build test` to run the tests.\n", .{}); 15 + 16 + try bw.flush(); // don't forget to flush! 17 + }
+10
src/rayray.zig
··· 1 + const std = @import("std"); 2 + const testing = std.testing; 3 + 4 + export fn add(a: i32, b: i32) i32 { 5 + return a + b; 6 + } 7 + 8 + test "basic add functionality" { 9 + try testing.expect(add(3, 7) == 10); 10 + }