Skip to content

Conversation

@Firestar99
Copy link
Member

@Firestar99 Firestar99 commented Dec 23, 2025

Requires #128

See primary issue #105

Superseding #112 and #117

  • extract the "install" action to the new cargo-gpu-install crate
    • philosophy: keep it as simple as possible, while removing cli deps
    • About the name: I felt like it was more descriptive than my previous suggestions with *-cache
  • has the following features to make these dependencies optional:
clap = ["dep:clap", "spirv-builder/clap"]
watch = ["spirv-builder/watch"]
tty = ["dep:crossterm"]
  • removes a few dependencies too: env_logger, relative-path, serde_json, semver, dunce
  • serde is not worth feature gating, since spirv-builder itself needs serde and serde_json
  • best reviewed commit-by-commit

close #105

@Firestar99 Firestar99 changed the title New crate cargo-gpu-install for just the install action, without requiring clap Split install action to new crate cargo-gpu-install Dec 23, 2025
// build the shader crate
let mut builder = backend.to_spirv_builder(shader_crate, "spirv-unknown-vulkan1.2");
// set to true when you're in a build script, false when outside one
builder.build_script.defaults = true;
Copy link
Member Author

@Firestar99 Firestar99 Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is already adjusted for Rust-GPU/rust-gpu#488, even though it is not yet in this branch. So this will fail doctests (which we don't test in ci...)

@Firestar99 Firestar99 requested review from schell and tombh December 23, 2025 12:35
@Firestar99 Firestar99 changed the title Split install action to new crate cargo-gpu-install Split install action into the new crate cargo-gpu-install Dec 23, 2025
@tombh
Copy link
Collaborator

tombh commented Dec 23, 2025

Looks good!

What about adding a section in the main README about the 2 ways (as a CLI and as a crate) of using this project?

I think that the only reason crossterm is used is to enable pressing y without hitting return to accept the confirmation? It's not a big deal, just worth bearing in mind. I think it's actually probably more conventional to not have to hit return with these kind of prompts.

@Firestar99
Copy link
Member Author

Firestar99 commented Dec 23, 2025

Kept the readme update simple: https://github.com/Rust-GPU/cargo-gpu/blob/install-crate/README.md (and updated the cargo-gpu-install readme to not mention wgsl stuff)

On crossterm, yes that's the only thing we use it for. Which is why I just hid it behind the tty feature along with user output, which realistically noone should enable other than cargo-gpu itself. Also optimized the features of it to remove some extra deps.

@tombh

This comment was marked as outdated.

unintentionally started sharing the cache dir between tests
@Firestar99
Copy link
Member Author

Firestar99 commented Dec 23, 2025

Let's move the entire readme discussion to #133, since I think it needs a lot more than just mentioning the crate dependency path. (Also I hid your large comment)

Primarily, I made this over the past few weeks: https://github.com/Rust-GPU/rust-gpu-template
(and have given it a readme literally an hour ago)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants