chore: 构建提速——sccache 编译缓存、mold 并行链接与快速 release profile

This commit is contained in:
2026-10-10 10:19:56 +00:00
parent 6ecd3aed89
commit 55313cf3a9
4 changed files with 51 additions and 23 deletions
+9
View File
@@ -1,2 +1,11 @@
[build]
rustflags = ["-D", "warnings"]
# sccache 编译缓存:重复构建(切分支、profile 变动、clean 后重编)命中缓存直接
# 复用产物,跳过 rustc。缓存目录默认 ~/.cache/sccache(上限 10G)。
rustc-wrapper = "sccache"
[target.x86_64-unknown-linux-gnu]
# mold 链接器:并行链接,比 GNU ld 快 5 至 10 倍(98M 二进制链接 4.4s 降到
# 亚秒级)。走 cc 驱动的 -fuse-ld=mold(不能直接 linker="mold":rustc 会把
# cc 驱动参数 -m64/-Wl, 原样传给 mold,mold 不认)。对 dev 与 release 全 profile 生效。
rustflags = ["-C", "link-arg=-fuse-ld=mold"]