LLVM CMake Build

From Dmz-portal

Jump to: navigation, search


Getting CMake

CMake is usually available in the standard repository for your distro. The curses GUI (ccmake) is often in a separate package to the main tool (cmake) so you may need to install multiple packages. If it is not available in your distro, try the CMake home page.

CMake + Make

Using CMake with make is simple enough:

cd $build_dir
cmake -DCMAKE_INSTALL_PREFIX=$install_dir $src_dir
make install

CMake + Ninja

Using ninja can greatly accelerate the build process. It can do 'nop' builds in a split second (vs >20s for make), and a typical build while editing td files takes ~1min when shared libraries are enabled. It also emits the output of the subprograms in sequential order despite running them in parallel. The only issue I've found so far is that 'ninja check' doesnt emit the progress bar that 'make check' does (actually 'ninja check' buffers the output and emits all the progress bar updates at the end but the effect is the same).

Get it from the Ninja home page and follow the instructions to install it.

cd $build_dir
cmake -DCMAKE_INSTALL_PREFIX=$install_dir -G Ninja $src_dir
ninja install

Shared Library Builds

Setting BUILD_SHARED_LIBS to ON will enable shared library builds. This significantly improves build times but currently causes three tests to fail. The three tests are all for bugpoint and fail because the shared-library build is significantly larger than the static-library build. This triggers a hardcoded memory limit in bugpoint which prevents it running the necessary subprograms.

Personal tools