removing dependency
This commit is contained in:
@@ -27,121 +27,13 @@ pub fn build(b: *std.Build) void {
|
||||
.use_llvm = use_llvm,
|
||||
});
|
||||
|
||||
const install_spv_lib = b.addInstallArtifact(spv_lib, .{});
|
||||
b.installArtifact(spv_lib);
|
||||
|
||||
addSandbox(b, target, optimize, use_llvm, spv_mod, &install_spv_lib.step);
|
||||
addExample(b, target, optimize, use_llvm, spv_mod, &install_spv_lib.step);
|
||||
addZigTests(b, target, optimize, use_llvm, spv_mod, zmath);
|
||||
addCffi(b, target, optimize, use_llvm, spv_mod);
|
||||
addDocs(b, spv_mod);
|
||||
}
|
||||
|
||||
fn addExample(
|
||||
b: *std.Build,
|
||||
target: std.Build.ResolvedTarget,
|
||||
optimize: std.builtin.OptimizeMode,
|
||||
use_llvm: bool,
|
||||
spv_mod: *std.Build.Module,
|
||||
install_spv_lib_step: *std.Build.Step,
|
||||
) void {
|
||||
const no_example = b.option(bool, "no-example", "Skip example build") orelse false;
|
||||
if (!no_example) {
|
||||
const sdl3 = b.lazyDependency("sdl3", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
}) orelse return;
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "spirv_interpreter_example",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("example/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.imports = &.{
|
||||
.{ .name = "spv", .module = spv_mod },
|
||||
.{ .name = "sdl3", .module = sdl3.module("sdl3") },
|
||||
},
|
||||
}),
|
||||
.use_llvm = use_llvm,
|
||||
});
|
||||
|
||||
const install_exe = b.addInstallArtifact(exe, .{});
|
||||
install_exe.step.dependOn(install_spv_lib_step);
|
||||
|
||||
const run_exe = b.addRunArtifact(exe);
|
||||
run_exe.step.dependOn(&install_exe.step);
|
||||
|
||||
const run_step = b.step("example", "Run the example");
|
||||
run_step.dependOn(&run_exe.step);
|
||||
|
||||
addShaderCompileStep(
|
||||
b,
|
||||
"example-shader",
|
||||
"Compile example shader using nzslc",
|
||||
"example/shader.nzsl",
|
||||
"example",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn addSandbox(
|
||||
b: *std.Build,
|
||||
target: std.Build.ResolvedTarget,
|
||||
optimize: std.builtin.OptimizeMode,
|
||||
use_llvm: bool,
|
||||
spv_mod: *std.Build.Module,
|
||||
install_spv_lib_step: *std.Build.Step,
|
||||
) void {
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "spirv_interpreter_sandbox",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("sandbox/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.imports = &.{
|
||||
.{ .name = "spv", .module = spv_mod },
|
||||
},
|
||||
}),
|
||||
.use_llvm = use_llvm,
|
||||
});
|
||||
|
||||
const install_exe = b.addInstallArtifact(exe, .{});
|
||||
install_exe.step.dependOn(install_spv_lib_step);
|
||||
|
||||
const run_exe = b.addRunArtifact(exe);
|
||||
run_exe.step.dependOn(&install_exe.step);
|
||||
|
||||
const run_step = b.step("sandbox", "Run the sandbox");
|
||||
run_step.dependOn(&run_exe.step);
|
||||
|
||||
addShaderCompileStep(
|
||||
b,
|
||||
"sandbox-shader",
|
||||
"Compile sandbox shader using nzslc",
|
||||
"sandbox/shader.nzsl",
|
||||
"sandbox",
|
||||
);
|
||||
}
|
||||
|
||||
fn addShaderCompileStep(
|
||||
b: *std.Build,
|
||||
step_name: []const u8,
|
||||
description: []const u8,
|
||||
shader_path: []const u8,
|
||||
output_dir: []const u8,
|
||||
) void {
|
||||
const cmd = b.addSystemCommand(&.{
|
||||
"nzslc",
|
||||
shader_path,
|
||||
"--compile=spv,spv-dis",
|
||||
"-o",
|
||||
output_dir,
|
||||
});
|
||||
|
||||
const step = b.step(step_name, description);
|
||||
step.dependOn(&cmd.step);
|
||||
}
|
||||
|
||||
fn addZigTests(
|
||||
b: *std.Build,
|
||||
target: std.Build.ResolvedTarget,
|
||||
|
||||
Reference in New Issue
Block a user