@@ -5,10 +5,15 @@ use std::path::PathBuf;
5
5
pub fn main ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
6
6
env_logger:: builder ( ) . init ( ) ;
7
7
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
+ }
9
13
10
14
// Allows overriding the PATH to inject the rust-gpu rust toolchain when building the rest of the project with stable rustc.
11
15
// Used in nix shell. Do not remove without checking with developers using nix.
16
+ println ! ( "cargo:rerun-if-env-changed=RUST_GPU_PATH_OVERRIDE" ) ;
12
17
if let Ok ( path_override) = std:: env:: var ( "RUST_GPU_PATH_OVERRIDE" ) {
13
18
let current_path = std:: env:: var ( "PATH" ) . unwrap_or_default ( ) ;
14
19
let new_path = format ! ( "{path_override}:{current_path}" ) ;
@@ -18,6 +23,9 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
18
23
}
19
24
}
20
25
26
+ let shader_crate = PathBuf :: from ( concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/.." ) ) ;
27
+
28
+ println ! ( "cargo:rerun-if-env-changed=RUSTC_CODEGEN_SPIRV_PATH" ) ;
21
29
let rustc_codegen_spirv_path = std:: env:: var ( "RUSTC_CODEGEN_SPIRV_PATH" ) . unwrap_or_default ( ) ;
22
30
let backend = if rustc_codegen_spirv_path. is_empty ( ) {
23
31
// 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>> {
42
50
// needs to be fixed upstream
43
51
let path_to_wgsl = path_to_spv. with_extension ( "wgsl" ) ;
44
52
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( ) ) ;
46
54
Ok ( ( ) )
47
55
}
0 commit comments