this repo has no description

zig init

altagos.dev e610f187

+80
+2
.gitignore
··· 1 + .zig-cache/ 2 + zig-out/
+37
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 zmath = b.dependency("zmath", .{}); 8 + 9 + const mod = b.addModule("codings", .{ 10 + .root_source_file = b.path("src/root.zig"), 11 + .target = target, 12 + .optimize = optimize, 13 + }); 14 + mod.addImport("zmath", zmath.module("root")); 15 + 16 + const lib = b.addLibrary(.{ 17 + .name = "codings", 18 + .linkage = .static, 19 + .root_module = mod, 20 + }); 21 + 22 + const install_docs = b.addInstallDirectory(.{ 23 + .source_dir = lib.getEmittedDocs(), 24 + .install_dir = .prefix, 25 + .install_subdir = "docs", 26 + }); 27 + 28 + const doc_step = b.step("docs", "Copy documentation to prefix path"); 29 + doc_step.dependOn(&install_docs.step); 30 + 31 + const mod_tests = b.addTest(.{ 32 + .root_module = mod, 33 + }); 34 + const run_mod_tests = b.addRunArtifact(mod_tests); 35 + const test_step = b.step("test", "Run tests"); 36 + test_step.dependOn(&run_mod_tests.step); 37 + }
+18
build.zig.zon
··· 1 + .{ 2 + .name = .codings, 3 + .version = "0.0.0", 4 + .fingerprint = 0x55f56641cf5754dd, // Changing this has security and trust implications. 5 + .minimum_zig_version = "0.16.0-dev.70+73a0b5441", 6 + .dependencies = .{ 7 + .zmath = .{ 8 + .url = "git+https://github.com/zig-gamedev/zmath?ref=main#3a5955b2b72cd081563fbb084eff05bffd1e3fbb", 9 + .hash = "zmath-0.11.0-dev-wjwivdMsAwD-xaLj76YHUq3t9JDH-X16xuMTmnDzqbu2", 10 + }, 11 + }, 12 + .paths = .{ 13 + "build.zig", 14 + "build.zig.zon", 15 + "src", 16 + //"LICENSE", 17 + }, 18 + }
+23
src/root.zig
··· 1 + //! By convention, root.zig is the root source file when making a library. 2 + const std = @import("std"); 3 + 4 + pub fn bufferedPrint() !void { 5 + // Stdout is for the actual output of your application, for example if you 6 + // are implementing gzip, then only the compressed bytes should be sent to 7 + // stdout, not any debugging messages. 8 + var stdout_buffer: [1024]u8 = undefined; 9 + var stdout_writer = std.fs.File.stdout().writer(&stdout_buffer); 10 + const stdout = &stdout_writer.interface; 11 + 12 + try stdout.print("Run `zig build test` to run the tests.\n", .{}); 13 + 14 + try stdout.flush(); // Don't forget to flush! 15 + } 16 + 17 + pub fn add(a: i32, b: i32) i32 { 18 + return a + b; 19 + } 20 + 21 + test "basic add functionality" { 22 + try std.testing.expect(add(3, 7) == 10); 23 + }