Skip to content

Commit

Permalink
docs: Add build description.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Nov 9, 2023
1 parent 003ad76 commit 119b76f
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions docs/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

## Dependencies

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.

VAST uses `llvm-17` which can be obtained from the [repository](https://apt.llvm.org/) provided by LLVM.

Before building (for Ubuntu) get all the necessary dependencies by running
```
apt-get install build-essential cmake ninja-build libstdc++-12-dev llvm-17 libmlir-17 libmlir-17-dev mlir-17-tools libclang-17-dev
```
or an equivalent command for your operating system of choice.

## Instructions

To configure project run `cmake` with following default options.
In case `clang` isn't your default compiler prefix the command with `CC=clang CXX=clang++`.
If you want to use system installed `llvm` and `mlir` (on Ubuntu) use:

```
cmake --preset ninja-multi-default \
--toolchain ./cmake/lld.toolchain.cmake \
-DCMAKE_PREFIX_PATH=/usr/lib/llvm-17/
```

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`.

Note: vast requires LLVM with RTTI enabled. Use `LLVM_ENABLE_RTTI=ON` if you build your own LLVM.


Finally, build the project:

```
cmake --build --preset ninja-rel
```

Use `ninja-deb` preset for debug build.

## Run

To run mlir codegen of highlevel dialect use.

```
./builds/ninja-multi-default/tools/vast-front/Release/vast-front -vast-emit-mlir=<dialect> <input.c> -o <output.mlir>
```

Supported dialects are: `hl`, `ll`, `llvm`

## Test

```
ctest --preset ninja-deb
```

0 comments on commit 119b76f

Please sign in to comment.