-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-mlir-18.sh
executable file
·49 lines (32 loc) · 1.19 KB
/
build-mlir-18.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# My Desktop
LLVM_PROJECT_ROOT=$MY_EXTERNAL_SDD_WORK_DIR/compiler-projects/llvm-18-src-build
# My Laptop
# LLVM_PROJECT_ROOT=$HOME/compiler-projects/llvm-18-src-build
# Add your $LLVM_PROJECT_ROOT path
# LLVM_PROJECT_ROOT=
BUILD_DIR=$LLVM_PROJECT_ROOT/build
PREFIX=$BUILD_DIR/lib/cmake/mlir
rm -R build/
mkdir -p build
cd build/
cmake \
-G Ninja \
-S ../ \
-B . \
-DCMAKE_BUILD_TYPE=DEBUG \
-DLLVM_DIR=$BUILD_DIR \
-DMLIR_DIR=$PREFIX \
-DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit \
-DCMAKE_C_COMPILER=$BUILD_DIR/bin/clang \
-DCMAKE_CXX_COMPILER=$BUILD_DIR/bin/clang++ \
-DLLVM_ENABLE_LLD=ON \
-DLLVM_PARALLEL_LINK_JOBS=1
# We need this
cmake --build . --target toy-compiler
# To generate the dialect doc
cmake --build . --target mlir-doc
# We donot need them anymore
# cmake --build . --target standalone-opt
# cmake --build . --target standalone-translate
# Notes
# 1. -DLLVM_USE_LINKER=“lld”. In order to use lld linker, it has to be available in $PATH. Neither it would give error something like this "Host compiler does not support -fuse-ld=/path/to/compiler-projects/llvm-src-17-build/installation/bin/lld"