41 lines
1.2 KiB
Zig
41 lines
1.2 KiB
Zig
const std = @import("std");
|
|
const sdl3 = @import("sdl3");
|
|
|
|
const dependencyList = [_][]const u8{
|
|
"core",
|
|
"sdl3",
|
|
"nfd",
|
|
};
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
|
|
|
const mod = b.addModule("platform", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = b.path("src/platform.zig"),
|
|
});
|
|
|
|
const tests = b.addTest(.{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = b.path("tests/tests.zig"),
|
|
});
|
|
|
|
for (dependencyList) |depName| {
|
|
const dep = b.dependency(depName, .{ .target = target, .optimize = optimize, .static_build = static_build });
|
|
const dep_mod = dep.module(depName);
|
|
mod.addImport(depName, dep_mod);
|
|
tests.root_module.addImport(depName, dep_mod);
|
|
}
|
|
|
|
const test_step = b.step("test", "run unit tests for platform");
|
|
|
|
tests.root_module.addImport("platform", mod);
|
|
const runArtifact = b.addRunArtifact(tests);
|
|
test_step.dependOn(&runArtifact.step);
|
|
b.installArtifact(tests);
|
|
}
|