VoxelEngine2/build.rs

43 lines
1.9 KiB
Rust
Raw Permalink Normal View History

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");
2024-09-15 14:02:00 +02:00
#[allow(unused_must_use)]
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");
2024-09-15 14:02:00 +02:00
#[warn(unused_must_use)]
// 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());
}