@@ -16,6 +16,8 @@ pub struct InstalledBackend {
1616 pub rustc_codegen_spirv_location : PathBuf ,
1717 /// toolchain channel name
1818 pub toolchain_channel : String ,
19+ /// Whether this runs in a build script
20+ pub build_script : bool ,
1921}
2022
2123impl InstalledBackend {
@@ -45,6 +47,7 @@ impl InstalledBackend {
4547 pub fn configure_spirv_builder ( & self , builder : & mut SpirvBuilder ) -> anyhow:: Result < ( ) > {
4648 builder. rustc_codegen_spirv_location = Some ( self . rustc_codegen_spirv_location . clone ( ) ) ;
4749 builder. toolchain_overwrite = Some ( self . toolchain_channel . clone ( ) ) ;
50+ builder. build_script . defaults = self . build_script ;
4851 Ok ( ( ) )
4952 }
5053}
@@ -108,8 +111,9 @@ pub struct Install {
108111
109112 /// Enables printing `cargo:rerun-if-changed` to stdout for build scripts, defaults to `false`.
110113 ///
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.
114+ /// Will be forwarded to `spirv_builder.build_script.defaults`. On the cargo-gpu side, only used with `path`-based
115+ /// `spirv-std` sources, so that any change in your local rust-gpu checkout reruns the build script to rebuild the
116+ /// codegen backend and your shaders.
113117 #[ cfg_attr( feature = "clap" , clap( skip) ) ]
114118 pub build_script : bool ,
115119
@@ -352,6 +356,7 @@ package = "rustc_codegen_spirv"
352356 Ok ( InstalledBackend {
353357 rustc_codegen_spirv_location : dest_dylib_path,
354358 toolchain_channel,
359+ build_script : self . build_script ,
355360 } )
356361 }
357362}
0 commit comments