Skip to content

Commit 9e75b95

Browse files
committed
Divide project into library and binary parts
1 parent 265bba7 commit 9e75b95

File tree

8 files changed

+55
-18
lines changed

8 files changed

+55
-18
lines changed

Cargo.lock

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
[workspace]
22
members = [
33
"crates/cargo-gpu",
4+
"crates/cargo-gpu-cli",
45
"crates/xtask",
56
]
67

78
exclude = [
89
# This currently needs to be excluded because it depends on a version of `rust-gpu` that
9-
# uses a toolchain whose Cargo version doesn't recognise version 4 of `Cargo.lock`.
10-
"crates/shader-crate-template"
10+
# uses a toolchain whose Cargo version doesn't recognize version 4 of `Cargo.lock`.
11+
"crates/shader-crate-template",
1112
]
1213

1314
resolver = "2"
1415

16+
[workspace.package]
17+
version = "0.1.0"
18+
edition = "2021"
19+
repository = "https://github.com/Rust-GPU/cargo-gpu"
20+
keywords = ["gpu", "compiler", "rust-gpu"]
21+
license = "MIT OR Apache-2.0"
22+
1523
[workspace.dependencies]
1624
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "3df836eb9d7b01344f52737bf9a310d1fb5a0c26", default-features = false }
1725
anyhow = "1.0.98"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Command line tool for building Rust shaders using rust-gpu.
99
To install the tool ensure you have `rustup`. Then run:
1010

1111
```
12-
cargo install --git https://github.com/rust-gpu/cargo-gpu cargo-gpu
12+
cargo install --git https://github.com/rust-gpu/cargo-gpu cargo-gpu-cli
1313
```
1414

1515
After that you can use `cargo gpu` to compile your shader crates with:

crates/cargo-gpu-cli/Cargo.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "cargo-gpu-cli"
3+
description = "Command line tool for building Rust shaders using `rust-gpu`"
4+
version.workspace = true
5+
edition.workspace = true
6+
repository.workspace = true
7+
keywords.workspace = true
8+
license.workspace = true
9+
10+
default-run = "cargo-gpu"
11+
12+
[[bin]]
13+
name = "cargo-gpu"
14+
path = "src/main.rs"
15+
16+
[dependencies]
17+
cargo-gpu = { path = "../cargo-gpu" }
18+
clap.workspace = true
19+
log.workspace = true
20+
env_logger.workspace = true
21+
anyhow.workspace = true
22+
23+
[lints]
24+
workspace = true
File renamed without changes.

crates/cargo-gpu/Cargo.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
[package]
22
name = "cargo-gpu"
3-
version = "0.1.0"
4-
edition = "2021"
5-
description = "Generates shader .spv files from rust-gpu shader crates"
6-
repository = "https://github.com/Rust-GPU/cargo-gpu"
3+
description = "Generates shader .spv files from `rust-gpu` shader crates"
74
readme = "../../README.md"
8-
keywords = ["gpu", "compiler", "rust-gpu"]
9-
license = "MIT OR Apache-2.0"
10-
default-run = "cargo-gpu"
11-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
5+
version.workspace = true
6+
edition.workspace = true
7+
repository.workspace = true
8+
keywords.workspace = true
9+
license.workspace = true
1210

1311
[dependencies]
1412
cargo_metadata.workspace = true
@@ -17,7 +15,6 @@ spirv-builder = { workspace = true, features = ["clap", "watch"] }
1715
legacy_target_specs.workspace = true
1816
clap.workspace = true
1917
directories.workspace = true
20-
env_logger.workspace = true
2118
log.workspace = true
2219
relative-path.workspace = true
2320
serde.workspace = true

crates/cargo-gpu/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,13 @@ impl Command {
140140
config::Config::clap_command_with_cargo_config(shader_crate_path, env_args)?;
141141
log::debug!("building with final merged arguments: {command:#?}");
142142

143+
// When watching, do one normal run to setup the `manifest.json` file.
143144
if command.build.watch {
144-
// When watching, do one normal run to setup the `manifest.json` file.
145145
command.build.watch = false;
146146
command.run()?;
147147
command.build.watch = true;
148-
command.run()?;
149-
} else {
150-
command.run()?;
151148
}
149+
command.run()?;
152150
}
153151
Self::Show(show) => show.run()?,
154152
Self::DumpUsage => dump_full_usage_for_readme()?,

crates/xtask/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn main() {
149149
rust_gpu_version: maybe_rust_gpu_version,
150150
} => {
151151
log::info!("installing cargo gpu");
152-
cmd(["cargo", "install", "--path", "crates/cargo-gpu"]).unwrap();
152+
cmd(["cargo", "install", "--path", "crates/cargo-gpu-cli"]).unwrap();
153153

154154
log::info!("setup project");
155155
let dir = tempdir::TempDir::new("test-shader-output").unwrap();

0 commit comments

Comments
 (0)