[cfe-dev] Building clang outside of LLVM (with CMake)
theraven at sucs.org
Wed Feb 2 04:15:40 PST 2011
On 2 Feb 2011, at 11:40, arrowdodger wrote:
> On Wed, Feb 2, 2011 at 6:29 AM, Óscar Fuentes <ofv at wanadoo.es> wrote:
>> Some time ago Doug mentioned that it would be useful to build clang
>> outside of LLVM: basically LLVM acts as an external library which is
>> used by clang.
> I just was about to propose this myself.
This would be useful. In particular, projects that are not using clang as a compiler want to build just the libraries required for libclang, which only depend on a few LLVM libraries (Support and System, and possibly the asm parser things if you want inline asm).
>> IIRC Doug mentioned something about build times, and indeed clang takes
>> about 4 minutes to build alone and almost 10 minutes to build within
>> LLVM, so if the goal is to quickly build clang multiple times with the
>> same LLVM base then it is a must-have feature.
> I'm not sure, but if someone wish to only recompile clang, can't he do
> cd cmake_build_dir/tools/clang && make?
You can also just do cd llvm/tools/clang && gmake - this works without the CMAKE stuff. If you're hacking on clang, then this is a lot faster than doing a complete LLVM build each time. There's no requirement to do an LLVM build for every clang build, unless the LLVM ABI has changed since your last build (and this rarely happens more than once in any given hour...).
In fact, it would be better if clang used the installed LLVM headers, rather than the ones from the LLVM tree, so that you'd always be building clang with the headers that matched the library.
This email complies with ISO 3103
More information about the cfe-dev