[llvm-dev] LLVM compiling
慕冬亮 via llvm-dev
llvm-dev at lists.llvm.org
Sat Aug 29 00:16:11 PDT 2015
2015-08-29 14:45 GMT+08:00 Martell Malone <martellmalone at gmail.com>:
> Why are there two ways to compile LLVM?
>> make and cmake!
>> What's the difference of those two ways?
>
>
> make and cmake are used together not separately.
> cmake is a high level generator that creates a makefile for make
>
> I compile llvm according to this website(
http://clang.llvm.org/get_started.html)
1. Checkout LLVM:
- Change directory to where you want the llvm directory placed.
- svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
2. Checkout Clang:
- cd llvm/tools
- svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
- cd ../..
3. Checkout extra Clang Tools: (optional)
- cd llvm/tools/clang/tools
- svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk
extra
- cd ../../../..
4. Checkout Compiler-RT:
- cd llvm/projects
- svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk
compiler-rt
- cd ../..
5. Build LLVM and Clang:
- mkdir build (in-tree build is not supported)
- cd build
- cmake -G "Unix Makefiles" ../llvm
- make
And I don't compile llvm separately. Should I compile llvm separately?
You may however be confusing make with autotools.
> autotools like cmake generates a makefile for make to use.
>
> autotools is an older tool typically used by gcc so it was natural for
> llvm/clang to adopt this
> llvm as a project is moving towards only having cmake as the high level
> generator.
>
> Configure and build LLVM and Clang using autotools :
- cd where-you-want-to-build-llvm
- mkdir build (for building without polluting the source dir)
- cd build
- ../llvm/configure [options] Some common options:
- --prefix=directory — Specify for *directory* the full pathname of
where you want the LLVM tools and libraries to be installed (default
/usr/local).
- --enable-optimized — Compile with optimizations enabled (default is
NO).
- --enable-assertions — Compile with assertion checks enabled
(default is YES).
- make [-j] — The -j specifies the number of jobs (commands) to run
simultaneously. This builds both LLVM and Clang for Debug+Asserts mode. The
--enable-optimized configure option is used to specify a Release build.
- make check-all — This run the regression tests to ensure everything is
in working order.
I indeed am confused with this compiling method. For example , there are
two files : CMakeLists.txt and Makefile in llvm/lib/Transfroms/Hello.
I want to add my testing Pass in lib for testing. I should prepare two
files according to the way you compile.( Makefile : autotools ,
CMakeLists.txt : cmake)
Please correct me if what I say are wrong.
- mudongliang
Please someone correct me if I am wrong but the autotools build will be
> deprecated soon
> so I suggest you use cmake when building
>
> Kind Regards
> Martell
>
> On Fri, Aug 28, 2015 at 9:18 PM, mudongliang via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Why are there two ways to compile LLVM?
>> make and cmake!
>> What's the difference of those two ways?
>>
>> - mudongliang
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150829/d8d052fd/attachment.html>
More information about the llvm-dev
mailing list