const std = @import("std"); pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); const target = b.standardTargetOptions(.{}); const lib = b.addStaticLibrary(.{ .name = "earcut", .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize, }); lib.install(); const main_tests = b.addTest(.{ .name = "earcut-tests", .kind = .test_exe, .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize, }); const test_step = b.step("test", "Run library tests"); test_step.dependOn(&main_tests.step); _ = module(b); } pub fn module(b: *std.Build) *std.build.Module { return b.createModule(.{ .source_file = .{ .path = sdkPath("/src/main.zig") }, }); } fn sdkPath(comptime suffix: []const u8) []const u8 { if (suffix[0] != '/') @compileError("suffix must be an absolute path"); return comptime blk: { const root_dir = std.fs.path.dirname(@src().file) orelse "."; break :blk root_dir ++ suffix; }; }