xcb: add sample

This commit is contained in:
2026-08-31 01:09:53 +02:00
parent fe7f845359
commit 0f6d1a0842
3 changed files with 123 additions and 1 deletions

View File

@@ -2,10 +2,13 @@ const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const mod = b.addModule("xcb", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
mod.linkSystemLibrary("xcb", .{});
@@ -18,4 +21,30 @@ pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_mod_tests.step);
const sample_module = b.createModule(.{
.root_source_file = b.path("sample/root.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "xcb", .module = mod },
},
});
const sample_exe = b.addExecutable(.{
.name = "sample",
.root_module = sample_module,
});
const sample_install = b.addInstallArtifact(sample_exe, .{});
const run_sample = b.addRunArtifact(sample_exe);
run_sample.step.dependOn(&sample_install.step);
if (b.args) |args| {
run_sample.addArgs(args);
}
const sample_step = b.step("sample", "Run sample");
sample_step.dependOn(&run_sample.step);
}