@@ -5,10 +5,15 @@ use std::path::PathBuf;
55pub fn main ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
66 env_logger:: builder ( ) . init ( ) ;
77
8- let shader_crate = PathBuf :: from ( concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/.." ) ) ;
8+ // Skip building the shader if they are provided externally
9+ println ! ( "cargo:rerun-if-env-changed=GRAPHENE_RASTER_NODES_SHADER_PATH" ) ;
10+ if !std:: env:: var ( "GRAPHENE_RASTER_NODES_SHADER_PATH" ) . unwrap_or_default ( ) . is_empty ( ) {
11+ return Ok ( ( ) ) ;
12+ }
913
1014 // Allows overriding the PATH to inject the rust-gpu rust toolchain when building the rest of the project with stable rustc.
1115 // Used in nix shell. Do not remove without checking with developers using nix.
16+ println ! ( "cargo:rerun-if-env-changed=RUST_GPU_PATH_OVERRIDE" ) ;
1217 if let Ok ( path_override) = std:: env:: var ( "RUST_GPU_PATH_OVERRIDE" ) {
1318 let current_path = std:: env:: var ( "PATH" ) . unwrap_or_default ( ) ;
1419 let new_path = format ! ( "{path_override}:{current_path}" ) ;
@@ -18,6 +23,9 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
1823 }
1924 }
2025
26+ let shader_crate = PathBuf :: from ( concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/.." ) ) ;
27+
28+ println ! ( "cargo:rerun-if-env-changed=RUSTC_CODEGEN_SPIRV_PATH" ) ;
2129 let rustc_codegen_spirv_path = std:: env:: var ( "RUSTC_CODEGEN_SPIRV_PATH" ) . unwrap_or_default ( ) ;
2230 let backend = if rustc_codegen_spirv_path. is_empty ( ) {
2331 // install the toolchain and build the `rustc_codegen_spirv` codegen backend with it
@@ -42,6 +50,6 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
4250 // needs to be fixed upstream
4351 let path_to_wgsl = path_to_spv. with_extension ( "wgsl" ) ;
4452
45- println ! ( "cargo::rustc-env=WGSL_SHADER_PATH ={}" , path_to_wgsl. display( ) ) ;
53+ println ! ( "cargo::rustc-env=GRAPHENE_RASTER_NODES_SHADER_PATH ={}" , path_to_wgsl. display( ) ) ;
4654 Ok ( ( ) )
4755}
0 commit comments