Skip to content

Commit c99cce5

Browse files
committed
target enum: fixup cargo gpu
1 parent 7fc4560 commit c99cce5

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 = "e6d017d5504c4441a84edcc27f4eca61de6fc8cf", default-features = false }
16+
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "59d108bd89a734ae3d9ac6e0319b4853b2dbba22", 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::env;
1111
use std::path::{Path, PathBuf};
1212

@@ -33,7 +33,7 @@ impl InstalledBackend {
3333
pub fn to_spirv_builder(
3434
&self,
3535
path_to_crate: impl AsRef<Path>,
36-
target: impl Into<String>,
36+
target: impl IntoSpirvTarget,
3737
) -> SpirvBuilder {
3838
let mut builder = SpirvBuilder::new(path_to_crate, target);
3939
self.configure_spirv_builder(&mut builder)
@@ -49,10 +49,12 @@ impl InstalledBackend {
4949
pub fn configure_spirv_builder(&self, builder: &mut SpirvBuilder) -> anyhow::Result<()> {
5050
builder.rustc_codegen_spirv_location = Some(self.rustc_codegen_spirv_location.clone());
5151
builder.toolchain_overwrite = Some(self.toolchain_channel.clone());
52-
builder.path_to_target_spec = Some(self.target_spec_dir.join(format!(
53-
"{}.json",
54-
builder.target.as_ref().context("expect target to be set")?
55-
)));
52+
let file_name = builder
53+
.target
54+
.clone()
55+
.context("expect target to be set")??
56+
.target_json_file_name();
57+
builder.path_to_target_spec = Some(self.target_spec_dir.join(file_name));
5658
Ok(())
5759
}
5860
}

0 commit comments

Comments
 (0)