Provide bootstrap support to build only llvm+clang when using cmake.
authorAndy Gibbs <andyg1001@hotmail.co.uk>
Wed, 26 Jun 2013 08:05:08 +0000 (08:05 +0000)
committerAndy Gibbs <andyg1001@hotmail.co.uk>
Wed, 26 Jun 2013 08:05:08 +0000 (08:05 +0000)
Where a source tree is complete with lld, lldb and polly, it may not be possible to use cmake to configure build scripts if the host compiler it not capable of compiling these sub-projects.  This change makes it possible to first build a bootstrap clang compiler when can then be used to build a complete llvm toolchain.  An example bootstrap build sequence could be as follows:

$ mkdir bootstrap
$ cd bootstrap
$ cmake -G 'Unix Makefiles'
        -DCMAKE_BUILD_TYPE:STRING=Release
        -DCMAKE_PREFIX_PATH:STRING=$(pwd)
        -DLLVM_TARGETS_TO_BUILD:STRING=host
        -DLLVM_INCLUDE_TOOLS:STRING=bootstrap-only
        ../source
$ make clang  # build clang only for host

$ cd ..
$ export CC=$(realpath bootstrap/bin)/clang
$ export CXX=$(realpath bootstrap/bin)/clang++

$ mkdir final
$ cd final
$ cmake -G 'Unix Makefiles' ../source
$ make all check-all

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184924 91177308-0d34-0410-b5e6-96231b3b80d8

tools/CMakeLists.txt

index f651d90865c3f7fe0dca9f3e63b1fdb427f55ec7..e6637813cd562e0a0a9450a756d2376746b253fa 100644 (file)
@@ -58,8 +58,11 @@ if( LLVM_ENABLE_PIC )
 endif()
 
 add_llvm_external_project(clang)
-add_llvm_external_project(lld)
-add_llvm_external_project(lldb)
-add_llvm_external_project(polly)
+
+if( NOT LLVM_INCLUDE_TOOLS STREQUAL "bootstrap-only" )
+  add_llvm_external_project(lld)
+  add_llvm_external_project(lldb)
+  add_llvm_external_project(polly)
+endif()
 
 set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)