Skip to content

Instantly share code, notes, and snippets.

@Kazhuu
Last active February 9, 2021 21:21
Show Gist options
  • Save Kazhuu/1b8fdac96add400fa8561c79cafe863b to your computer and use it in GitHub Desktop.
Save Kazhuu/1b8fdac96add400fa8561c79cafe863b to your computer and use it in GitHub Desktop.
LLVM developer cmake generate command for fast build times
# LLVM debug build CMake generate command to have fast LLVM build times!
# This will build all LLVM components as shared libraries and not combine
# them to single big target.
# Run following before running CMake if llvm should be compiled with clang instead of gcc.
export CXX=clang++
export CC=clang
# Execute in build the directory 'llvm-project/build'
# Notice install directory and ccache directory!
cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:PATH=~/local/llvm/ \
-DLLVM_TARGETS_TO_BUILD:STRING=X86 -DLLVM_ENABLE_PROJECTS:STRING="clang" \
-DLLVM_USE_LINKER:STRING="gold" -DLLVM_CCACHE_BUILD:BOOL=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DBUILD_SHARED_LIBS:BOOL=ON -DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON -DLLVM_CCACHE_DIR:PATH=./ccache/ \
-DLLVM_ENABLE_RTTI:BOOL=ON \
../llvm
# After this if you're using vim create symbolic link from build/compile_commands.json to project root.
cd ..
ln -s build/compile_commands.json .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment