mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 06:45:13 +00:00
example-runner-ash: make sure spirv-builder
uses a dedicated target dir.
This commit is contained in:
parent
35df2de639
commit
90db8e22d5
8
examples/runners/ash/build.rs
Normal file
8
examples/runners/ash/build.rs
Normal file
@ -0,0 +1,8 @@
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
// While OUT_DIR is set for both build.rs and compiling the crate, PROFILE is only set in
|
||||
// build.rs. So, export it to crate compilation as well.
|
||||
let profile = env::var("PROFILE").unwrap();
|
||||
println!("cargo:rustc-env=PROFILE={}", profile);
|
||||
}
|
@ -197,6 +197,15 @@ pub fn main() {
|
||||
}
|
||||
|
||||
pub fn compile_shaders() -> Vec<SpvFile> {
|
||||
// Hack: spirv_builder builds into a custom directory if running under cargo, to not
|
||||
// deadlock, and the default target directory if not. However, packages like `proc-macro2`
|
||||
// have different configurations when being built here vs. when building
|
||||
// rustc_codegen_spirv normally, so we *want* to build into a separate target directory, to
|
||||
// not have to rebuild half the crate graph every time we run. So, pretend we're running
|
||||
// under cargo by setting these environment variables.
|
||||
std::env::set_var("OUT_DIR", env!("OUT_DIR"));
|
||||
std::env::set_var("PROFILE", env!("PROFILE"));
|
||||
|
||||
let sky_shader_path =
|
||||
SpirvBuilder::new("examples/shaders/sky-shader", "spirv-unknown-vulkan1.1")
|
||||
.print_metadata(MetadataPrintout::None)
|
||||
|
Loading…
Reference in New Issue
Block a user