Skip to content

Commit 119b76f

Browse files
committed
docs: Add build description.
1 parent 003ad76 commit 119b76f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

docs/build.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
## Dependencies
3+
4+
Currently, it is necessary to use `clang` (due to `gcc` bug) to build VAST. On Linux it is also necessary to use `lld` at the moment.
5+
6+
VAST uses `llvm-17` which can be obtained from the [repository](https://apt.llvm.org/) provided by LLVM.
7+
8+
Before building (for Ubuntu) get all the necessary dependencies by running
9+
```
10+
apt-get install build-essential cmake ninja-build libstdc++-12-dev llvm-17 libmlir-17 libmlir-17-dev mlir-17-tools libclang-17-dev
11+
```
12+
or an equivalent command for your operating system of choice.
13+
14+
## Instructions
15+
16+
To configure project run `cmake` with following default options.
17+
In case `clang` isn't your default compiler prefix the command with `CC=clang CXX=clang++`.
18+
If you want to use system installed `llvm` and `mlir` (on Ubuntu) use:
19+
20+
```
21+
cmake --preset ninja-multi-default \
22+
--toolchain ./cmake/lld.toolchain.cmake \
23+
-DCMAKE_PREFIX_PATH=/usr/lib/llvm-17/
24+
```
25+
26+
To use a specific `llvm` provide `-DCMAKE_PREFIX_PATH=<llvm & mlir instalation paths>` option, where `CMAKE_PREFIX_PATH` points to directory containing `LLVMConfig.cmake` and `MLIRConfig.cmake`.
27+
28+
Note: vast requires LLVM with RTTI enabled. Use `LLVM_ENABLE_RTTI=ON` if you build your own LLVM.
29+
30+
31+
Finally, build the project:
32+
33+
```
34+
cmake --build --preset ninja-rel
35+
```
36+
37+
Use `ninja-deb` preset for debug build.
38+
39+
## Run
40+
41+
To run mlir codegen of highlevel dialect use.
42+
43+
```
44+
./builds/ninja-multi-default/tools/vast-front/Release/vast-front -vast-emit-mlir=<dialect> <input.c> -o <output.mlir>
45+
```
46+
47+
Supported dialects are: `hl`, `ll`, `llvm`
48+
49+
## Test
50+
51+
```
52+
ctest --preset ninja-deb
53+
```

0 commit comments

Comments
 (0)