Skip to content

spirv_builder feature compile_codegen to disable building rustc_codegen_spirv #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
30c6502
compile_codegen: add compile_codegen feature
Firestar99 Apr 27, 2025
a30c580
compile_codegen: panic when `rustc_codegen_spirv_location` is not set
Firestar99 Apr 27, 2025
dd056a3
gitignore: .idea
Firestar99 Apr 27, 2025
7e3a7b5
compile_codegen: make SpirvBuilderError use thiserror
Firestar99 Apr 28, 2025
49a962b
compile_codegen: make SpirvBuilder fields pub, reuse spirv-tools structs
Firestar99 Apr 27, 2025
1c0baee
compile_codegen: forward missing codegen backend error
Firestar99 Apr 28, 2025
fe42c46
compile_codegen: fix watch feature
Firestar99 Apr 29, 2025
674214b
compile_codegen: fix lint
Firestar99 Apr 29, 2025
879338b
compile_codegen: validate `rustc_codegen_spirv_location` on build
Firestar99 Apr 29, 2025
bb5d2e0
compile_codegen: rename feature from `compile_codegen` to `rustc_code…
Firestar99 Apr 29, 2025
5235161
compile_codegen: add serde derives
Firestar99 Apr 29, 2025
de2cef8
compile_codegen: add clap feature, make SpirvBuilder args the same as…
Firestar99 Apr 29, 2025
d643a65
compile_codegen: derive Debug for SpirvBuilder
Firestar99 Apr 29, 2025
6a518ac
compile_codegen: make clip skip variables not previously exposed
Firestar99 Apr 29, 2025
744c844
compile_codegen: serde flatten
Firestar99 Apr 29, 2025
9a9ebc1
compile_codegen: add warning in build.rs about cargo gpu parsing
Firestar99 Apr 30, 2025
da624d1
compile_codegen: make SpirvBuilder::build() no longer consume self
Firestar99 Apr 30, 2025
b619665
compile_codegen: add SpirvBuilder.toolchain_overwrite
Firestar99 Apr 30, 2025
dcbdc52
compile_codegen: include_str! all target_spec jsons for cargo gpu
Firestar99 Apr 30, 2025
e040ab9
compile_codegen: SpirvBuilder: remove RUSTC env var before calling cargo
Firestar99 Apr 30, 2025
b8f659b
compile_codegen: SpirvBuilder: only use target_spec json when compile…
Firestar99 Apr 30, 2025
eca83df
compile_codegen: SpirvBuilder: fix `query_rustc_version()` for stable…
Firestar99 Apr 30, 2025
5db761e
compile_codegen: change default MetadataPrintout to None
Firestar99 May 1, 2025
3c9a7d7
compile_codegen: refactor watcher to call on_compilation_finishes() e…
Firestar99 May 1, 2025
74d1c66
compile_codegen: allow SpirvBuilder watch to return something on firs…
Firestar99 May 1, 2025
d8f0398
compile_codegen: fix typo
Firestar99 May 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ target/
tests/Cargo.lock
.github/install-spirv-tools/Cargo.lock
rustc-ice-*.txt
.idea
65 changes: 48 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/rustc_codegen_spirv-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
repository.workspace = true

[dependencies]
spirv = { version = "0.3.0", features = ["serialize", "deserialize"] }
rspirv = "0.12"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
3 changes: 3 additions & 0 deletions crates/rustc_codegen_spirv/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use std::process::{Command, ExitCode};
use std::{env, fs, mem};

/// Current `rust-toolchain.toml` file
/// WARNING!!! cargo-gpu is now relying on this being a string literal! It will
/// scan `build.rs` for any line starting with `channel = "..."` to figure out
/// which toolchain version to use! This also allows backwards compat.
/// Unfortunately, directly including the actual workspace `rust-toolchain.toml` doesn't work together with
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
Expand Down
14 changes: 11 additions & 3 deletions crates/spirv-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ no-default-features = true
# that optional dependency, from being automatically created by Cargo, see:
# https://doc.rust-lang.org/cargo/reference/features.html#optional-dependencies
[features]
# See `rustc_codegen_spirv/Cargo.toml` for details on these features.
default = ["use-compiled-tools"]
use-installed-tools = ["dep:rustc_codegen_spirv", "rustc_codegen_spirv?/use-installed-tools"]
use-compiled-tools = ["dep:rustc_codegen_spirv", "rustc_codegen_spirv?/use-compiled-tools"]
# Compile `rustc_codegen_spirv`, allows constructing SpirvBuilder without
# explicitly passing in a path to a compiled `rustc_codegen_spirv.so` (or dll)
rustc_codegen_spirv = ["dep:rustc_codegen_spirv"]
# See `rustc_codegen_spirv/Cargo.toml` for details on these features.
use-installed-tools = ["rustc_codegen_spirv", "rustc_codegen_spirv?/use-installed-tools"]
use-compiled-tools = ["rustc_codegen_spirv", "rustc_codegen_spirv?/use-compiled-tools"]
skip-toolchain-check = ["rustc_codegen_spirv?/skip-toolchain-check"]

watch = ["dep:notify"]
clap = ["dep:clap"]

[dependencies]
# See comment in `src/lib.rs` `invoke_rustc` regarding `rustc_codegen_spirv` dep.
Expand All @@ -38,5 +42,9 @@ memchr = "2.4"
raw-string = "0.3.5"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "2.0.12"
semver = { version = "1.0.24", features = ["serde"] }

notify = { version = "7.0", optional = true }
# Pinning clap, as newer versions have raised min rustc version without being marked a breaking change
clap = { version = "=4.5.37", optional = true, features = ["derive"] }
Loading