Skip to content

add cargo-gpu generate - #568

Merged
LegNeato merged 5 commits into
mainfrom
cargo-gpu-new
Aug 27, 2026
Merged

add cargo-gpu generate#568
LegNeato merged 5 commits into
mainfrom
cargo-gpu-new

Conversation

@Firestar99

@Firestar99 Firestar99 commented Apr 14, 2026

Copy link
Copy Markdown
Member
  • cargo-gpu generate effectively aliases cargo generate with the rust-gpu-template repo
  • This makes cargo-gpu depend on cargo-generate, which significantly increases the amount of dependencies cargo-gpu has. I expect most users to migrate to cargo-gpu-install for their build script needs.
    • if you really need cargo-gpu as a dep, I've made cargo-generate a default feature you can disable
  • cargo generate also depends on quite a few outdated packages, including vulnerabilities, making our cargo deny complain. I've made it pass by ignoring them all, as I don't think there's a huge concern for a dev cmdline tool.

close #576

@LegNeato LegNeato left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wait, we have cargo-gpu, spirvbuilder, and cargo-gpu-install?!?! That seems really bad and confusing.

Can't we just put this behind an off-by-default flag (looks like it is on?) that is turned on for the binary? That way people using cargo-gpu in teh build script don't get changes in behavior and we still get this feature.

So I guess I don't see why cargo-gpu-install even exists?

@Firestar99

Copy link
Copy Markdown
Member Author

Can't we just put this behind an off-by-default flag (looks like it is on?) that is turned on for the binary?

No we can't, cause if you cargo install, it'll always build the binary with the default feature set. So if we were to hide binary-only features behind a feature flag, noone would use them, cause noone will pass extra --features when installing a binary. Especially something like cargo new, which is primarily for newer users to give them a preconfigured rust-gpu workspace. We also didn't find a way to configure cargo install to pass additional features when building a crate.

So our only option was to split the crate in two, a library crate for build scripts (cargo-gpu-install) and a binary crate for cli usage (cargo-gpu). And since we wanted cargo install cargo-gpu to work, the cli crate has to be named cargo-gpu, so we named the library cargo-gpu-install since it'll only contain the Install action. It's only purpose is to install the rustup toolchain, build the codegen backend, and return you an InstalledBackend, from which you can create a SpirvBuilder (see cargo-gpu-install's readme). This split has also cuts out many cli-related dependencies like clap, crossterm and mio (async file io).

For additional background:

@LegNeato

Copy link
Copy Markdown
Collaborator

Ahhh, I see. Thanks for explaining.

Comment thread crates/cargo-gpu/src/generate.rs Outdated
Comment thread crates/cargo-gpu/src/generate.rs
@Firestar99

Copy link
Copy Markdown
Member Author

@LegNeato can you rereview this one?

@Firestar99 Firestar99 changed the title add cargo-gpu new add cargo-gpu generate Aug 14, 2026
@LegNeato
LegNeato added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit 7fa56ad Aug 27, 2026
23 checks passed
@LegNeato
LegNeato deleted the cargo-gpu-new branch August 27, 2026 04:04
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.

Add "new" command

3 participants