rust_vulkan_test/build.rs
Florian RICHER b2d28ef408
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s
Continue vulkan c++ tutorial
2024-11-17 20:19:34 +01:00

24 lines
679 B
Rust

use std::process::Command;
fn main() {
for shader in glob::glob("res/shaders/*").unwrap().filter_map(Result::ok) {
if !shader.is_file() {
continue;
}
let shader_file_name = shader.to_str().unwrap();
let mut command = Command::new("glslc");
command.arg(&shader);
let out_file = match shader.extension().unwrap().to_str().unwrap() {
"vert" => shader_file_name.replace(".vert", ".vert.spv"),
"frag" => shader_file_name.replace(".frag", ".frag.spv"),
_ => continue,
};
command.arg("-o");
command.arg(out_file);
command.output().unwrap();
}
}