add renderdoc ENV in build.zig
s-ol
2 years ago
7 | 7 | pub fn build(b: *Builder) void { |
8 | 8 | const target = b.standardTargetOptions(.{}); |
9 | 9 | const mode = b.standardReleaseOptions(); |
10 | ||
10 | ||
11 | 11 | const exe = b.addExecutable("openxPriments", "src/main.zig"); |
12 | 12 | exe.setTarget(target); |
13 | 13 | exe.setBuildMode(mode); |
16 | 16 | exe.linkSystemLibrary("vulkan"); |
17 | 17 | exe.linkSystemLibrary("openxr_loader"); |
18 | 18 | exe.linkSystemLibrary("GraphicsEngineVk"); |
19 | ||
20 | const renderdoc = b.option(bool, "renderdoc", "Enable Renderdoc debugging") orelse false; | |
21 | if (renderdoc) exe.linkSystemLibrary("renderdoc"); | |
22 | exe.addBuildOption(bool, "renderdoc", renderdoc); | |
23 | ||
19 | ||
24 | 20 | const gen_dg = dggen.DgGenerateStep.init(b, "lib/DiligentEngine", "dg.zig"); |
25 | 21 | gen_dg.addDeps(exe, "Debug"); |
26 | 22 | |
40 | 36 | run_cmd.step.dependOn(b.getInstallStep()); |
41 | 37 | const run_step = b.step("run", "Run the example example"); |
42 | 38 | run_step.dependOn(&run_cmd.step); |
39 | ||
40 | const renderdoc = b.option(bool, "renderdoc", "Enable Renderdoc debugging") orelse false; | |
41 | exe.addBuildOption(bool, "renderdoc", renderdoc); | |
42 | if (renderdoc) { | |
43 | exe.linkSystemLibrary("renderdoc"); | |
44 | run_cmd.setEnvironmentVariable("VK_INSTANCE_LAYERS", "VK_LAYER_RENDERDOC_Capture"); | |
45 | } | |
43 | 46 | } |