Skip to content

Commit d367693

Browse files
committed
target enum: fixup cargo gpu
1 parent 98931f8 commit d367693

File tree

3 files changed

+51
-10
lines changed

3 files changed

+51
-10
lines changed

Cargo.lock

Lines changed: 42 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exclude = [
1313
resolver = "2"
1414

1515
[workspace.dependencies]
16-
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "3e89e6cc7b32b51db51d75b5f558ccd7ecf5b850", default-features = false }
16+
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "08917152504679eda474e952e79c711012920b36", default-features = false }
1717
anyhow = "1.0.94"
1818
clap = { version = "4.5.37", features = ["derive"] }
1919
crossterm = "0.28.1"

crates/cargo-gpu/src/install.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::spirv_source::{
66
use crate::target_specs::update_target_specs_files;
77
use crate::{cache_dir, spirv_source::SpirvSource};
88
use anyhow::Context as _;
9-
use spirv_builder::SpirvBuilder;
9+
use spirv_builder::{IntoSpirvTarget, SpirvBuilder};
1010
use std::path::{Path, PathBuf};
1111

1212
/// Represents a functional backend installation, whether it was cached or just installed.
@@ -32,7 +32,7 @@ impl InstalledBackend {
3232
pub fn to_spirv_builder(
3333
&self,
3434
path_to_crate: impl AsRef<Path>,
35-
target: impl Into<String>,
35+
target: impl IntoSpirvTarget,
3636
) -> SpirvBuilder {
3737
let mut builder = SpirvBuilder::new(path_to_crate, target);
3838
self.configure_spirv_builder(&mut builder)
@@ -48,10 +48,12 @@ impl InstalledBackend {
4848
pub fn configure_spirv_builder(&self, builder: &mut SpirvBuilder) -> anyhow::Result<()> {
4949
builder.rustc_codegen_spirv_location = Some(self.rustc_codegen_spirv_location.clone());
5050
builder.toolchain_overwrite = Some(self.toolchain_channel.clone());
51-
builder.path_to_target_spec = Some(self.target_spec_dir.join(format!(
52-
"{}.json",
53-
builder.target.as_ref().context("expect target to be set")?
54-
)));
51+
let file_name = builder
52+
.target
53+
.clone()
54+
.context("expect target to be set")??
55+
.target_json_file_name();
56+
builder.path_to_target_spec = Some(self.target_spec_dir.join(file_name));
5557
Ok(())
5658
}
5759
}

0 commit comments

Comments
 (0)