Files
ZWindow/build.zig
T
2026-11-22 20:13:40 +01:00

45 lines
1.3 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const translate_c = b.addTranslateC(.{
.root_source_file = b.path("src/c.h"),
.target = target,
.optimize = optimize,
});
translate_c.linkSystemLibrary("X11", .{});
translate_c.linkSystemLibrary("Xi", .{});
translate_c.linkSystemLibrary("XFixes", .{});
translate_c.linkSystemLibrary("Xext", .{});
const zwindow = b.addModule("root", .{
.root_source_file = b.path("src/Window.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{
.name = "c",
.module = translate_c.createModule(),
},
},
.link_libc = false,
});
const test_step = b.step("test", "Run tests");
const tests = b.addTest(.{
.name = "ZWindow-tests",
.root_module = b.createModule(.{
.root_source_file = b.path("src/tests.zig"),
.target = target,
.optimize = optimize,
}),
});
tests.root_module.addImport("ZWindow", zwindow);
test_step.dependOn(&b.addRunArtifact(tests).step);
b.installArtifact(tests);
}