[cfe-dev] clang libTooling instructions say that cmake is required to build the tools and clang?

Manuel Klimek klimek at google.com
Thu Apr 25 04:12:06 PDT 2013


On Thu, Apr 25, 2013 at 11:05 AM, Gábor Kozár <kozargabor at gmail.com> wrote:

> Hi,
>
> I believe you are correct. I'm certain that for LLVM and Clang is
> absolutely does not matter how you build them (in different circumstances,
> I built them with both methods). However, Clang tools require a
> CompilationDatabase, which can either be populated manually from other
> sources (where I work, we use a custom file format for this) or from the
> somewhat more convenient JSON compilation database that CMake is able to
> generate automatically. (There also exists another tool which is capable of
> generating such a .json file even when you're not using CMake - I don't
> remember the name, but I found a reference to it in the Clang documentation
> somewhere.)
>
> So yeah, it does not matter how you build Clang, and neither does it
> matter how you build the target application - all that matters is that you
> need a CompilationDatabase for Clang to be able to work its magic.
>

Technically you don't even need the compilation database (although it makes
things much easier). For tools built according to the standard pattern, you
can run them with
$ mytool some/file.cc -- <compile command line args go here>

That said, cmake+ninja gives you a faster build (and an even faster
parallel build), so I personally always prefer to build with cmake+ninja
over configure+make.

Cheers,
/Manuel


>
> Gabor
>
>
> 2013/4/25 Peeter Joot <peeter.joot at gmail.com>
>
>> I've built and installed clang, but did so in the "typical" unix way:
>>
>> mkdir build
>> cd build
>> ../llvm/configure --prefix=...
>> make
>> make install
>>
>> The libtooling instructions here say that to use libtooling, you have to
>> build clang using CMake:
>>
>> http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
>>
>> However, it appears all the libtooling stuff is already build by the make
>> that I've invoked, so I wouldn't think that I have to re-build clang a
>> second time to use libtooling.
>>
>> Is the cmake dependency for clang tools just the requirement to generate
>> this compilation database (this .json file).  If so, wouldn't the
>> requirement be to do this for the project code that I want to run the tools
>> on, not the clang or llvm build tree itself?
>>
>> --
>> Peeter
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130425/02d17ebb/attachment.html>


More information about the cfe-dev mailing list