Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phodal/rust-llvm-practises
Rust LLVM Practises
https://github.com/phodal/rust-llvm-practises
Last synced: 3 days ago
JSON representation
Rust LLVM Practises
- Host: GitHub
- URL: https://github.com/phodal/rust-llvm-practises
- Owner: phodal
- Created: 2020-11-11T11:22:38.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-29T02:14:34.000Z (almost 4 years ago)
- Last Synced: 2024-08-02T07:02:18.743Z (3 months ago)
- Language: Rust
- Size: 392 KB
- Stars: 17
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust LLVM Practise
```
├── helloworld // hello, world demo
└── stdlib // Rust call c libs demo
```## Setup
0. Rust 1.39+ + LLVM 10.0
1. use [llvmenv](https://github.com/termoshtt/llvmenv) to Manage multiple LLVM/Clang builds
2. Rust LLVM wrapper use [inkwell](https://github.com/TheDan64/inkwell)
3. generated LLVM IR code see in [main.ll](main.ll)### Install LLVM
```
brew install cmake ninja
```Homebrew 11
```
brew install llvm
```#### remote
```bash
cargo install llvmenv
```usage
```
llvmenv init
llvmenv entries
local-llvm 10.0.0
```about `1.5 hours` in my MBP 2018
#### local
Add local llvm for build to: `$XDG_CONFIG_HOME/llvmenv/entry.toml
docs: https://docs.rs/llvmenv/0.3.0/llvmenv/entry/index.html
````
[local-llvm]
path = "/path/to/your/src"
target = ["X86"]
```**build**
```
llvmenv build-entry local-llvm
```### run & build
```
LLVM_SYS_101_PREFIX=$HOME/llvm/llvm-10.0.1.src/build cargo build
LLVM_SYS_101_PREFIX=$HOME/llvm/llvm-10.0.1.src/build cargo run
````