VoxelEngine2/build.rs

41 lines
No EOL
1.8 KiB
Rust

use std::process::Command;
use std::io::{self, Write};
use std::path::Path;
fn main() {
println!("cargo::rerun-if-changed=shaders/cube.frag");
println!("cargo::rerun-if-changed=shaders/cube.geom");
println!("cargo::rerun-if-changed=shaders/cube.vert");
println!("cargo::rerun-if-changed=shaders/geo_cube.spv");
println!("cargo::rerun-if-changed=shaders/frag_cube.spv");
println!("cargo::rerun-if-changed=shaders/vert_cube.spv");
println!("cargo::rerun-if-changed=shaders/cuboid.frag");
println!("cargo::rerun-if-changed=shaders/cuboid.geom");
println!("cargo::rerun-if-changed=shaders/cuboid.vert");
println!("cargo::rerun-if-changed=shaders/geo_cuboid.spv");
println!("cargo::rerun-if-changed=shaders/frag_cuboid.spv");
println!("cargo::rerun-if-changed=shaders/vert_cuboid.spv");
std::fs::remove_file("shaders/geo_cube.spv");
std::fs::remove_file("shaders/frag_cube.spv");
std::fs::remove_file("shaders/vert_cube.spv");
std::fs::remove_file("shaders/geo_cuboid.spv");
std::fs::remove_file("shaders/frag_cuboid.spv");
std::fs::remove_file("shaders/vert_cuboid.spv");
// probably need to check the os and have different versions
let mut command = Command::new("./shaders/compile.bat");
let output = command.output().expect("Failed to execute command");
println!("status: {}", output.status);
io::stdout().write_all(&output.stdout).unwrap();
io::stderr().write_all(&output.stderr).unwrap();
assert!(output.status.success());
assert!(Path::new("shaders/geo_cube.spv").exists());
assert!(Path::new("shaders/frag_cube.spv").exists());
assert!(Path::new("shaders/vert_cube.spv").exists());
assert!(Path::new("shaders/geo_cuboid.spv").exists());
assert!(Path::new("shaders/frag_cuboid.spv").exists());
assert!(Path::new("shaders/vert_cuboid.spv").exists());
}