forked from mirror/vulkan-zig
Add run step for example
This commit is contained in:
21
build.zig
21
build.zig
@@ -23,15 +23,20 @@ pub fn build(b: *Builder) void {
|
|||||||
|
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
const exe = b.addExecutable("example", "examples/main.zig");
|
const example_exe = b.addExecutable("example", "examples/main.zig");
|
||||||
exe.setTarget(target);
|
example_exe.setTarget(target);
|
||||||
exe.setBuildMode(mode);
|
example_exe.setBuildMode(mode);
|
||||||
exe.install();
|
example_exe.install();
|
||||||
exe.linkSystemLibrary("c");
|
example_exe.linkSystemLibrary("c");
|
||||||
exe.linkSystemLibrary("glfw");
|
example_exe.linkSystemLibrary("glfw");
|
||||||
|
|
||||||
const vk_path = generateVk(b);
|
const vk_path = generateVk(b);
|
||||||
const fmt_step = b.addFmt(&[_][]const u8{vk_path});
|
const fmt_step = b.addFmt(&[_][]const u8{vk_path});
|
||||||
exe.step.dependOn(&fmt_step.step);
|
example_exe.step.dependOn(&fmt_step.step);
|
||||||
exe.addPackagePath("vulkan", vk_path);
|
example_exe.addPackagePath("vulkan", vk_path);
|
||||||
|
|
||||||
|
const example_run_cmd = example_exe.run();
|
||||||
|
example_run_cmd.step.dependOn(b.getInstallStep());
|
||||||
|
const example_run_step = b.step("run-example", "Run the example");
|
||||||
|
example_run_step.dependOn(&example_run_cmd.step);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user