Skip to content

Commit 8266048

Browse files
committed
add build script optimizations from rust-gpu for spirv-builder variant
1 parent 8a0f38e commit 8266048

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

ash-graphics/Cargo.toml.liquid

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,32 @@ raw-window-handle = "0.6.2"
3333
winit = "0.30.0"
3434
cfg-if = "1.0.0"
3535
anyhow = "1.0.98"
36+
37+
{% if integration_type == "spirv-builder" -%}
38+
# Optimize build scripts, copied from rust-gpu's repo
39+
# Enable incremental by default in release mode.
40+
[profile.release]
41+
incremental = true
42+
# HACK(eddyb) this is the default but without explicitly specifying it, Cargo
43+
# will treat the identical settings in `[profile.release.build-override]` below
44+
# as different sets of `rustc` flags and will not reuse artifacts between them.
45+
codegen-units = 256
46+
47+
# Compile build-dependencies in release mode with the same settings
48+
# as regular dependencies (including the incremental enabled above).
49+
[profile.release.build-override]
50+
opt-level = 3
51+
incremental = true
52+
codegen-units = 256
53+
54+
# HACK(eddyb) reduce the number of linker exports and/or imports, by avoiding
55+
# inter-CGU linkage, to stay under the 64Ki MSVC limit for `rustc_codegen_spirv`
56+
# when building it in "debug mode" (only relevant to CI for now, realistically),
57+
# i.e. working around this issue: https://github.com/rust-lang/rust/issues/53014.
58+
[profile.dev]
59+
# HACK(eddyb) fewer inter-crate exports/imports (not just inter-CGU), but sadly
60+
# not configurable w/o breaking `Cargo.toml` parsing from non-nightly Cargo.
61+
#
62+
# rustflags = ["-Zshare-generics=off"]
63+
codegen-units = 1
64+
{% endif -%}

0 commit comments

Comments
 (0)