const std = @import("std"); const builds = std.build; const Builder = std.build.Builder; fn setupLinks(step: *builds.LibExeObjStep) void { step.linkSystemLibrary("c"); step.linkSystemLibrary("lilv-0"); step.linkSystemLibrary("sndfile"); step.linkSystemLibrary("readline"); step.linkSystemLibrary("GraphicsMagickWand"); step.linkSystemLibrary("GraphicsMagick"); step.addIncludePath("/usr/include/GraphicsMagick"); step.addIncludePath("/usr/include"); const possible_lilv_include_dirs = [_][]const u8{ "/usr/include/lilv-0/lilv", "/usr/include/lilv-0", }; var found_any_lilv = false; for (possible_lilv_include_dirs) |possible_lilv_dir| { var possible_dir = std.fs.cwd().openDir(possible_lilv_dir, .{}) catch |err| { std.debug.print("possible lilv {s} fail: {s}\n", .{ possible_lilv_dir, @errorName(err) }); continue; }; possible_dir.close(); found_any_lilv = true; std.debug.print("found lilv at '{s}'\n", .{possible_lilv_dir}); step.addIncludePath(possible_lilv_dir); } if (!found_any_lilv) { std.debug.print("No LILV library was found :(\n", .{}); @panic("no lilv found"); } } pub fn build(b: *Builder) void { const mode = b.standardReleaseOptions(); const exe = b.addExecutable("scritcher", "src/main.zig"); exe.setBuildMode(mode); exe.install(); setupLinks(exe); const test_obj_step = b.addTest("src/main.zig"); setupLinks(test_obj_step); const run_cmd = exe.run(); run_cmd.step.dependOn(b.getInstallStep()); const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); const test_step = b.step("test", "Run tests"); test_step.dependOn(&test_obj_step.step); }