Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LLVMBuildScript

Assume LLVM Source tree is located at ../LLVM
The -DLLVM_CREATE_XCODE_TOOLCHAIN=on is only useful for macOS users that requires an Xcode Toolchain to use within Xcode. This enables an extra target called install-xcode-toolchain.
Add -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ installs the Toolchain for the current user.
To install the toolchain globally, replace with -DCMAKE_INSTALL_PREFIX=/Library/Developer/ and invoke sudo ninja install-xcode-toolchain

LLVM Development:

cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DLLVM_APPEND_VC_REV=on -DLLVM_CREATE_XCODE_TOOLCHAIN=on -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ ../LLVM

Daily Usage

cmake -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_APPEND_VC_REV=on -DLLVM_CREATE_XCODE_TOOLCHAIN=on -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ ../LLVM

Cross Compiling LLVM ITSELF to iOS

cmake -G "Ninja" -DCMAKE_OSX_ARCHITECTURES="armv7;armv7s;arm64" -DCMAKE_TOOLCHAIN_FILE=../LLVM/cmake/platforms/iOS.cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_RUNTIME=Off -DLLVM_INCLUDE_TESTS=Off -DLLVM_INCLUDE_EXAMPLES=Off -DLLVM_ENABLE_BACKTRACES=Off -DLLVM_TARGETS_TO_BUILD="ARM;AArch64" -DLLVM_TARGET_ARCH=ARM ../LLVM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.