[llvm-dev] LLVM compiling

Martell Malone via llvm-dev llvm-dev at lists.llvm.org
Sat Aug 29 00:52:11 PDT 2015


>
> And I don't compile llvm separately. Should I compile llvm separately?

Build together is fine.

I typically use git and
clone clang into llvm/tools
and compiler-rt into llvm/projects.

Then I just run cmake as described and make if I am using -G "Unix
Makefiles"

I indeed am confused with this compiling method.  For example , there are
> two files : CMakeLists.txt and Makefile in llvm/lib/Transfroms/Hello.

They CmakeLists.txt are part of the source of llvm so I don't see what the
confusion is.
The makefile has not been touched in 5 years so you would just leave that.
It's the CMakeLists you want to edit.

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.

Testcases are usually automatically picked up when they are in the correct
folder regardless of the build system.
If you want to add something to the system I would do it in CMakeList.txt
and submit it for review via phabracator.

Kind Regards
Martell


On Sat, Aug 29, 2015 at 12:16 AM, 慕冬亮 <mudongliangabcd at gmail.com> wrote:

>
> 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/164505ef/attachment-0001.html>


More information about the llvm-dev mailing list