Michael J. Spencer | 365f1ec | 2012-04-25 19:34:24 +0000 | [diff] [blame] | 1 | .. _getting_started: |
| 2 | |
| 3 | Getting Started: Building and Running lld |
| 4 | ========================================= |
| 5 | |
| 6 | This page gives you the shortest path to checking out and building lld. If you |
| 7 | run into problems, please file bugs in the `LLVM Bugzilla`__ |
| 8 | |
| 9 | __ http://llvm.org/bugs/ |
| 10 | |
| 11 | Building lld |
| 12 | ------------ |
| 13 | |
| 14 | On Unix-like Systems |
| 15 | ~~~~~~~~~~~~~~~~~~~~ |
| 16 | |
Nick Kledzik | f784817 | 2012-04-26 23:41:01 +0000 | [diff] [blame] | 17 | 1. Get the required tools. |
Michael J. Spencer | 365f1ec | 2012-04-25 19:34:24 +0000 | [diff] [blame] | 18 | |
| 19 | * `CMake 2.8`_\+. |
| 20 | * make (or any build system CMake supports). |
| 21 | * `Clang 3.1`_\+ or GCC 4.7+ (C++11 support is required). |
| 22 | |
| 23 | * If using Clang, you will also need `libc++`_. |
| 24 | * `Python 2.4`_\+ (not 3.x) for running tests. |
| 25 | |
| 26 | .. _CMake 2.8: http://www.cmake.org/cmake/resources/software.html |
| 27 | .. _Clang 3.1: http://clang.llvm.org/ |
| 28 | .. _libc++: http://libcxx.llvm.org/ |
| 29 | .. _Python 2.4: http://python.org/download/ |
| 30 | |
Nick Kledzik | f784817 | 2012-04-26 23:41:01 +0000 | [diff] [blame] | 31 | 2. Check out LLVM:: |
Michael J. Spencer | 365f1ec | 2012-04-25 19:34:24 +0000 | [diff] [blame] | 32 | |
| 33 | $ cd path/to/llvm-project |
| 34 | $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm |
| 35 | |
Nick Kledzik | f784817 | 2012-04-26 23:41:01 +0000 | [diff] [blame] | 36 | 3. Check out lld:: |
Michael J. Spencer | 365f1ec | 2012-04-25 19:34:24 +0000 | [diff] [blame] | 37 | |
| 38 | $ cd llvm/tools |
| 39 | $ svn co http://llvm.org/svn/llvm-project/lld/trunk lld |
| 40 | |
| 41 | * lld can also be checked out to ``path/to/llvm-project`` and built as an external |
| 42 | project. |
| 43 | |
Nick Kledzik | f784817 | 2012-04-26 23:41:01 +0000 | [diff] [blame] | 44 | 4. Build LLVM and lld:: |
Michael J. Spencer | 365f1ec | 2012-04-25 19:34:24 +0000 | [diff] [blame] | 45 | |
| 46 | $ cd path/to/llvm-build/llvm (out of source build required) |
| 47 | $ cmake -G "Unix Makefiles" path/to/llvm-project/llvm |
| 48 | $ make |
| 49 | |
Nick Kledzik | f784817 | 2012-04-26 23:41:01 +0000 | [diff] [blame] | 50 | * If you want to build with clang and it is not the default compiler or |
| 51 | it is installed in an alternate location, you'll need to tell the cmake tool |
| 52 | the location of the C and C++ compiler via CMAKE_C_COMPILER and |
| 53 | CMAKE_CXX_COMPILER. For example:: |
Nick Kledzik | 920cedd | 2012-06-18 20:24:47 +0000 | [diff] [blame] | 54 | |
Nick Kledzik | f784817 | 2012-04-26 23:41:01 +0000 | [diff] [blame] | 55 | $ cmake -DCMAKE_CXX_COMPILER=/path/to/clang++ -DCMAKE_C_COMPILER=/path/to/clang ... |
| 56 | |
| 57 | 5. Test:: |
Michael J. Spencer | 365f1ec | 2012-04-25 19:34:24 +0000 | [diff] [blame] | 58 | |
| 59 | $ make lld-test |
| 60 | |
| 61 | Using Visual Studio |
| 62 | ~~~~~~~~~~~~~~~~~~~ |
| 63 | |
| 64 | #. Get the required tools. |
| 65 | |
| 66 | * `CMake 2.8`_\+. |
| 67 | * `Visual Studio 11`_ (required for C++11 support) |
| 68 | * `Python 2.4`_\+ (not 3.x) for running tests. |
| 69 | |
| 70 | .. _CMake 2.8: http://www.cmake.org/cmake/resources/software.html |
| 71 | .. _Visual Studio 11: http://www.microsoft.com/visualstudio/11/en-us |
| 72 | .. _Python 2.4: http://python.org/download/ |
| 73 | |
| 74 | #. Check out LLVM:: |
| 75 | |
| 76 | $ cd path/to/llvm-project |
| 77 | $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm |
| 78 | |
| 79 | #. Check out lld:: |
| 80 | |
| 81 | $ cd llvm/tools |
| 82 | $ svn co http://llvm.org/svn/llvm-project/lld/trunk lld |
| 83 | |
| 84 | * lld can also be checked out to ``path/to/llvm-project`` and built as an external |
| 85 | project. |
| 86 | |
| 87 | #. Generate Visual Studio project files:: |
| 88 | |
| 89 | $ cd path/to/llvm-build/llvm (out of source build required) |
| 90 | $ cmake -G "Visual Studio 11" path/to/llvm-project/llvm |
| 91 | |
| 92 | #. Build |
| 93 | |
| 94 | * Open LLVM.sln in Visual Studio. |
| 95 | * Build the ``ALL_BUILD`` target. |
| 96 | |
| 97 | #. Test |
| 98 | |
| 99 | * Build the ``lld-test`` target. |
| 100 | |
| 101 | More Information |
| 102 | ~~~~~~~~~~~~~~~~ |
| 103 | |
| 104 | For more information on using CMake see the `LLVM CMake guide`_. |
| 105 | |
Alex Rosenberg | b65e888 | 2013-02-03 07:05:26 +0000 | [diff] [blame^] | 106 | .. _LLVM CMake guide: http://llvm.org/docs/CMake.html |