const std = @import("std"); /// /// Builds the engine, tools, and dependencies of all. /// pub fn build(builder: *std.build.Builder) void { const target = builder.standardTargetOptions(.{}); const mode = builder.standardReleaseOptions(); const core_pkg = projectPkg("core", &.{}); // Ona executable. { const exe = builder.addExecutable("ona", "./src/ona/main.zig"); exe.addPackage(projectPkg("oar", &.{core_pkg})); exe.addPackage(core_pkg); exe.setTarget(target); exe.setBuildMode(mode); exe.install(); exe.addIncludeDir("./ext"); exe.linkSystemLibrary("SDL2"); exe.linkLibC(); } // Oar executable. { const exe = builder.addExecutable("oar", "./src/oar/main.zig"); exe.addPackage(core_pkg); exe.setTarget(target); exe.setBuildMode(mode); exe.install(); } // Tests executable. { const tests = builder.addTestExe("test", "./src/tests.zig"); tests.setTarget(target); tests.setBuildMode(mode); builder.step("test", "Run unit tests").dependOn(&tests.step); } } /// /// Returns a [std.build.Pkg] within the project codebase path at `name` with `dependencies` as its /// dependencies. /// fn projectPkg(comptime name: []const u8, dependencies: []const std.build.Pkg) std.build.Pkg { return std.build.Pkg{ .name = name, .path = .{.path = "./src/" ++ name ++ "/main.zig"}, .dependencies = dependencies, }; }