Build and install

CIR is enabled by setting the cmake variable CLANG_ENABLE_CIR to ON, note that it requires both mlir and clang projects to be enabled. Other than that it works with a regular build of Clang/LLVM.


See the steps here for general instruction on how to build LLVM.

For example, building and installing CIR enabled clang on macOS could look like:

CLANG=`xcrun -f clang`

$ cd llvm-project/llvm
$ mkdir build-release; cd build-release
$ /Applications/ -GNinja \
 -DLLVM_ENABLE_PROJECTS="clang;mlir" \
$ ninja install

Check for cir-opt to confirm all is fine:

$ /tmp/install-llvm/bin/cir-opt --help