Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = [
resolver = "2"

[workspace.dependencies]
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "e6d017d5504c4441a84edcc27f4eca61de6fc8cf", default-features = false }
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850", default-features = false }
anyhow = "1.0.94"
clap = { version = "4.5.37", features = ["derive"] }
crossterm = "0.28.1"
Expand Down
23 changes: 3 additions & 20 deletions crates/cargo-gpu/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::target_specs::update_target_specs_files;
use crate::{cache_dir, spirv_source::SpirvSource};
use anyhow::Context as _;
use spirv_builder::SpirvBuilder;
use std::env;
use std::path::{Path, PathBuf};

/// Represents a functional backend installation, whether it was cached or just installed.
Expand Down Expand Up @@ -279,8 +278,8 @@ package = "rustc_codegen_spirv"
.context("remove Cargo.lock")?;
}

crate::user_output!("Compiling `rustc_codegen_spirv` from source {}\n", source,);
let mut cargo = std::process::Command::new("cargo");
crate::user_output!("Compiling `rustc_codegen_spirv` from source {}\n", source);
let mut cargo = spirv_builder::cargo_cmd::CargoCmd::new();
cargo
.current_dir(&install_dir)
.arg(format!("+{toolchain_channel}"))
Expand All @@ -289,23 +288,7 @@ package = "rustc_codegen_spirv"
cargo.args(["-p", "rustc_codegen_spirv", "--lib"]);
}

// Clear Cargo environment variables that we don't want to leak into the
// inner invocation of Cargo and mess with our `rustc_codegen_spirv` build.
for (key, _) in env::vars_os() {
let remove = key.to_str().is_some_and(|st| {
st.starts_with("CARGO_FEATURES_") || st.starts_with("CARGO_CFG_")
});
if remove {
cargo.env_remove(key);
}
}
cargo
.env_remove("RUSTC")
.env_remove("RUSTFLAGS")
// ignore any externally supplied target dir, we want to build it in our cache dir
.env_remove("CARGO_TARGET_DIR");

log::debug!("building artifacts with `{cargo:?}`");
log::debug!("building artifacts with `{cargo}`");
cargo
.stdout(std::process::Stdio::inherit())
.stderr(std::process::Stdio::inherit())
Expand Down
Loading