60 lines
1.6 KiB
Zig
60 lines
1.6 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const vulkan_dep = b.dependency("vulkan_zig", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.registry = b.path("vendor/vk.xml"),
|
|
});
|
|
|
|
const vulkan_mod = vulkan_dep.module("vulkan-zig");
|
|
|
|
const mod = b.addModule("xcb", .{
|
|
.root_source_file = b.path("src/root.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.link_libc = true,
|
|
});
|
|
|
|
mod.linkSystemLibrary("xcb", .{});
|
|
|
|
const mod_tests = b.addTest(.{
|
|
.root_module = mod,
|
|
});
|
|
|
|
const run_mod_tests = b.addRunArtifact(mod_tests);
|
|
|
|
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 = "vulkan", .module = vulkan_mod },
|
|
.{ .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);
|
|
}
|