diff --git a/.gitignore b/.gitignore index 2040c29..68557b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -zig-cache +zig-* +.zig-* diff --git a/build.zig b/build.zig index 30802da..dd40eb6 100644 --- a/build.zig +++ b/build.zig @@ -1,7 +1,35 @@ const std = @import("std"); pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + _ = b.addModule("diffz", .{ .root_source_file = b.path("DiffMatchPatch.zig"), + .target = target, + .optimize = optimize, }); + + const lib = b.addStaticLibrary(.{ + .name = "diffz", + .root_source_file = b.path("DiffMatchPatch.zig"), + .target = target, + .optimize = optimize, + }); + + // This declares intent for the library to be installed into the standard + // location when the user invokes the "install" step (the default step when + // running `zig build`). + b.installArtifact(lib); + + // Run tests + const tests = b.addTest(.{ + .name = "tests", + .root_source_file = b.path("DiffMatchPatch.zig"), + .target = target, + .optimize = optimize, + }); + const step_tests = b.addRunArtifact(tests); + + b.step("test", "Run diffz tests").dependOn(&step_tests.step); } diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..b4e0b4d --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,13 @@ +.{ + .name = "diffz", + .version = "0.0.1", + .paths = .{ + "DiffMatchPatch.zig", + ".gitattributes", + ".gitignore", + "LICENSE", + "README.md", + "build.zig.zon", + "build.zig", + }, +}