Skip to content

Commit

Permalink
Add Rustup installation instructions to README
Browse files Browse the repository at this point in the history
Now that cranelift is distributed with Rustup, I find myself constantly searching for the rust-lang/rust#81746 PR. I think that it would be useful to also describe the Rustup installation/usage instructions here in README.
  • Loading branch information
Kobzol committed Nov 11, 2023
1 parent 82487a9 commit 58c52b0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@ This has the potential to improve compilation times in debug mode.
If your project doesn't use any of the things listed under "Not yet supported", it should work fine.
If not please open an issue.

## Download using Rustup
The Cranelift codegen backend is now distributed in nightly builds on Linux. If you want to
install it using Rustup, you can do that by running:

```bash
$ rustup component add rustc-codegen-cranelift-preview --toolchain nightly
```

Once it is installed, you can enable it with one of the following approaches:
- `CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build -Zcodegen-backend`
- `RUSTFLAGS="-Zcodegen-backend=cranelift" cargo +nightly build`
- Add the following to `.cargo/config.toml`:
```toml
[unstable]
codegen-backend = true

[profile.dev]
codegen-backend = "cranelift"
```
- Add the following to `Cargo.toml`:
```toml
# This line needs to come before anything else in Cargo.toml
cargo-features = ["codegen-backend"]

[profile.dev]
codegen-backend = "cranelift"
```

## Building and testing

```bash
Expand Down

0 comments on commit 58c52b0

Please sign in to comment.