[cfe-dev] Building clang outside of LLVM (with CMake)

Óscar Fuentes ofv at wanadoo.es
Wed Feb 2 10:10:25 PST 2011

Douglas Gregor <dgregor at apple.com> writes:

> We'd like to be able to consider LLVM as a stable library that Clang
> depends on.

Okay, that's the idea I had.

> This would allow us to build against an installed LLVM
> (rather than embedding our own full copy of LLVM in Clang), test Clang
> and LLVM more independently,

No problem with the first part and it is mostly done. Testing Clang
outside of LLVM seems the hard part. AFAIK it is not possible to test
LLVM once it is installed, and Clang tests are embedded in LLVM's
testing framework.

I understand that building Clang standalone is of little benefit if you
can't test it. Some comment from someone who knows well the testing part
would be helpful. Dan?

> avoid embedding all of LLVM into the Clang executable (assuming that
> LLVM becomes a shared library at some point),

AFAIK it is possible to build Clang as a Huge Single Shared Library with
the autoconf build and I don't think it would be too difficult to do the
same with cmake. Right now we can build LLVM as a set of shared
libraries, which possibly is even better than a huge library. But maybe
Clang uses LLVM so extensively that it is not interesting to deal with
multiple libraries instead of just one.

> and make our Xcode/MSVC projects significantly smaller (since
> they'll only have Clang).
> I think this will also become more important in the future, since, for
> example, LLDB layers on top of LLVM and Clang.


More information about the cfe-dev mailing list