#!/usr/bin/bash

BASEDIR=$(dirname $(realpath "$0"))

cd "$BASEDIR/../compiler/thirdparty/llvm-project"

mkdir -p build
cd build

cmake -G Ninja ../llvm \
      -DLLVM_ENABLE_PROJECTS="mlir;llvm;lld" \
      -DLLVM_BUILD_EXAMPLES=ON \
      -DLLVM_TARGETS_TO_BUILD="Native;NVPTX;AMDGPU" \
      -DCMAKE_BUILD_TYPE=Release \
      -DLLVM_ENABLE_ASSERTIONS=ON

cmake --build .
