const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const vk_dep = b.dependency("vk", .{}); const volk_dep = b.dependency("volk", .{}); const volk_h = b.addTranslateC(.{ .target = target, .optimize = optimize, .root_source_file = volk_dep.path("volk.h"), .link_libc = true, }); const volk = b.addModule("volk", .{ .target = target, .optimize = optimize, .root_source_file = volk_h.getOutput(), .link_libc = true, }); volk.addIncludePath(vk_dep.path("include")); volk.addCSourceFile(.{ .file = volk_dep.path("volk.c"), .language = .c }); const vulkan = b.addModule("vulkan", .{ .target = target, .optimize = optimize, .root_source_file = b.path("vk/root.zig"), .imports = &.{ .{ .name = "volk", .module = volk }, }, }); const exe = b.addExecutable(.{ .name = "main", .root_module = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "vk", .module = vulkan }, }, }), }); b.installArtifact(exe); const run_step = b.step("run", "Run the app"); const run_cmd = b.addRunArtifact(exe); run_step.dependOn(&run_cmd.step); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const exe_tests = b.addTest(.{ .root_module = exe.root_module, }); const run_exe_tests = b.addRunArtifact(exe_tests); const test_step = b.step("test", "Run tests"); test_step.dependOn(&run_exe_tests.step); }