From 119b76fcc4c9afe79d6aed495a3c5507a0de3e91 Mon Sep 17 00:00:00 2001 From: Henrich Lauko Date: Thu, 9 Nov 2023 21:35:04 +0100 Subject: [PATCH] docs: Add build description. --- docs/build.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 docs/build.md diff --git a/docs/build.md b/docs/build.md new file mode 100644 index 0000000000..537a393fff --- /dev/null +++ b/docs/build.md @@ -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=` 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= -o +``` + +Supported dialects are: `hl`, `ll`, `llvm` + +## Test + +``` +ctest --preset ninja-deb +```