@@ -102,9 +102,17 @@ pub struct Install {
102102
103103 /// Clear target dir of `rustc_codegen_spirv` build after a successful build, saves about
104104 /// 200MiB of disk space.
105- #[ cfg_attr( feature = "clap" , clap( long = "no-clear-target" , default_value = "true" , action = clap:: ArgAction :: SetFalse ) ) ]
105+ #[ cfg_attr( feature = "clap" , clap( long = "no-clear-target" , default_value = "true" , action = clap:: ArgAction :: SetFalse
106+ ) ) ]
106107 pub clear_target : bool ,
107108
109+ /// Enables printing `cargo:rerun-if-changed` to stdout for build scripts, defaults to `false`.
110+ ///
111+ /// Currently only used with `path`-based `spirv-std` sources, so that any change in your local rust-gpu checkout
112+ /// reruns the build script to rebuild the codegen backend and your shaders.
113+ #[ cfg_attr( feature = "clap" , clap( skip) ) ]
114+ pub build_script : bool ,
115+
108116 /// There is a tricky situation where a shader crate that depends on workspace config can have
109117 /// a different `Cargo.lock` lockfile version from the the workspace's `Cargo.lock`. This can
110118 /// prevent builds when an old Rust toolchain doesn't recognise the newer lockfile version.
@@ -143,6 +151,7 @@ impl Install {
143151 rebuild_codegen : false ,
144152 auto_install_rust_toolchain : true ,
145153 clear_target : true ,
154+ build_script : false ,
146155 force_overwrite_lockfiles_v4_to_v3 : false ,
147156 }
148157 }
@@ -228,6 +237,16 @@ package = "rustc_codegen_spirv"
228237 std:: env:: consts:: DLL_SUFFIX
229238 ) ;
230239
240+ if self . build_script {
241+ #[ allow( clippy:: print_stdout) ]
242+ if let SpirvSource :: Path {
243+ rust_gpu_repo_root, ..
244+ } = & source
245+ {
246+ println ! ( "cargo:rerun-if-changed={rust_gpu_repo_root}" ) ;
247+ }
248+ }
249+
231250 let ( dest_dylib_path, skip_rebuild) = if source. is_path ( ) {
232251 (
233252 install_dir
0 commit comments