Build LLVM on Windows

less than 1 minute read

To build LLVM on Windows, Cmake and Vistual Studio is required.

Take a look at this page for the complete manual.

Grab LLVM source and checkout to a desired tag/branch:

git clone --config core.autocrlf=false

cd llvm-project

# Checkout to a tag, for instance:
git checkout llvmorg-17.0.1

In the root directory of the repo (not build), run cmake with desired options:

cmake -B build -G "Visual Studio 16 2019" -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld;lldb' \
 -DLLVM_ENABLE_RUNTIME='compiler-rt;libc;libcxx;openmp' -S llvm

This command will create LLVM.sln file. Open it in Visual Studio, change the build type to Release and build the whole project.

After completion, the binary files should be under build/Release/bin.