Skip to content

Commit a3f1b3e

Browse files
committed
add lld as a linker to improve compile times
1 parent 5dcfd5e commit a3f1b3e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.cargo/config.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
# .cargo/config.toml
3+
# On Windows
4+
# ```
5+
# cargo install -f cargo-binutils
6+
# rustup component add llvm-tools-preview
7+
# ```
8+
[target.x86_64-pc-windows-msvc]
9+
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
10+
[target.x86_64-pc-windows-gnu]
11+
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
12+
13+
# On Linux:
14+
# - Ubuntu, `sudo apt-get install lld clang`
15+
# - Arch, `sudo pacman -S lld clang`
16+
[target.x86_64-unknown-linux-gnu]
17+
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]
18+
19+
# On MacOS, `brew install llvm` and follow steps in `brew info llvm`
20+
[target.x86_64-apple-darwin]
21+
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
22+
[target.aarch64-apple-darwin]
23+
rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld"]

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
uses: dtolnay/rust-toolchain@stable
3131

3232
- name: Install dependencies
33-
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
33+
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev lld clang
3434

3535
- name: Populate target directory from cache
3636
uses: Leafwing-Studios/cargo-cache@v2

0 commit comments

Comments
 (0)