File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change
1
+ use std:: env;
2
+
3
+ fn main ( ) {
4
+ // While OUT_DIR is set for both build.rs and compiling the crate, PROFILE is only set in
5
+ // build.rs. So, export it to crate compilation as well.
6
+ let profile = env:: var ( "PROFILE" ) . unwrap ( ) ;
7
+ println ! ( "cargo:rustc-env=PROFILE={}" , profile) ;
8
+ }
Original file line number Diff line number Diff line change @@ -197,6 +197,15 @@ pub fn main() {
197
197
}
198
198
199
199
pub fn compile_shaders ( ) -> Vec < SpvFile > {
200
+ // Hack: spirv_builder builds into a custom directory if running under cargo, to not
201
+ // deadlock, and the default target directory if not. However, packages like `proc-macro2`
202
+ // have different configurations when being built here vs. when building
203
+ // rustc_codegen_spirv normally, so we *want* to build into a separate target directory, to
204
+ // not have to rebuild half the crate graph every time we run. So, pretend we're running
205
+ // under cargo by setting these environment variables.
206
+ std:: env:: set_var ( "OUT_DIR" , env ! ( "OUT_DIR" ) ) ;
207
+ std:: env:: set_var ( "PROFILE" , env ! ( "PROFILE" ) ) ;
208
+
200
209
let sky_shader_path =
201
210
SpirvBuilder :: new ( "examples/shaders/sky-shader" , "spirv-unknown-vulkan1.1" )
202
211
. print_metadata ( MetadataPrintout :: None )
You can’t perform that action at this time.
0 commit comments