Skip to content

Commit

Permalink
Avoid ever building rustc_codegen_spirv more than once in release mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb authored and XAMPPRocky committed Mar 29, 2021
1 parent e9dc458 commit db208e7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ members = [
opt-level = 3
codegen-units = 16

# HACK(eddyb) this is the default but without explicitly specifying it, Cargo
# will treat the identical settings in `[profile.release.build-override]` above
# as different sets of `rustc` flags and will not reuse artifacts between them.
[profile.release]
codegen-units = 16

[patch.crates-io]
spirv-std = { path = "./crates/spirv-std" }
spirv-std-macros = { path = "./crates/spirv-std-macros" }
Expand Down
8 changes: 8 additions & 0 deletions crates/rustc_codegen_spirv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ use-installed-tools = ["spirv-tools/use-installed-tools"]
use-compiled-tools = ["spirv-tools/use-compiled-tools"]

[dependencies]
# HACK(eddyb) these only exist to unify features across dependency trees,
# in order to avoid multiple separate instances of `rustc_codegen_spirv`.
hashbrown = { version = "0.9", features = ["default"] }
libc = { version = "0.2", features = ["align", "extra_traits"] }
num-traits = { version = "0.2", features = ["libm"] }
syn = { version = "1", features = ["visit", "visit-mut"] }

# Normal dependencies.
bimap = "0.6"
indexmap = "1.6.0"
rspirv = { git = "https://github.com/gfx-rs/rspirv.git", rev = "ee1e913" }
Expand Down
8 changes: 7 additions & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ edition = "2018"
license = "MIT OR Apache-2.0"
publish = false

# See rustc_codegen_spirv/Cargo.toml for details on these features
[features]
default = ["use-compiled-tools"]
use-installed-tools = ["rustc_codegen_spirv/use-installed-tools"]
use-compiled-tools = ["rustc_codegen_spirv/use-compiled-tools"]

[dependencies]
compiletest = { version = "0.6.0", package = "compiletest_rs" }
rustc_codegen_spirv = { path = "../crates/rustc_codegen_spirv" }
rustc_codegen_spirv = { path = "../crates/rustc_codegen_spirv", default-features = false }
structopt = "0.3.21"

0 comments on commit db208e7

Please sign in to comment.