From f16eab798dd9d086c782aaf9a4bec255e198037d Mon Sep 17 00:00:00 2001
From: Steffen Temme <steffen@zom.bi>
Date: Mon, 16 Dec 2024 20:23:58 +0100
Subject: [PATCH] disables windows shader build on linux

---
 build.rs | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/build.rs b/build.rs
index 789fb7b..e06ed04 100644
--- a/build.rs
+++ b/build.rs
@@ -17,22 +17,29 @@ fn main() {
     println!("cargo::rerun-if-changed=shaders/frag_cuboid.spv");
     println!("cargo::rerun-if-changed=shaders/vert_cuboid.spv");
 
-    #[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");
-    #[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());
+    if std::env::consts::OS == "windows" {
+        #[allow(unused_must_use)]
+        std::fs::remove_file("shaders/geo_cube.spv");
+        #[allow(unused_must_use)]
+        std::fs::remove_file("shaders/frag_cube.spv");
+        #[allow(unused_must_use)]
+        std::fs::remove_file("shaders/vert_cube.spv");
+        #[allow(unused_must_use)]
+        std::fs::remove_file("shaders/geo_cuboid.spv");
+        #[allow(unused_must_use)]
+        std::fs::remove_file("shaders/frag_cuboid.spv");
+        #[allow(unused_must_use)]
+        std::fs::remove_file("shaders/vert_cuboid.spv");
+        #[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());