|
| 1 | +# Based on clang/cmake/caches/DistributionExample.cmake |
| 2 | +# This file sets up a CMakeCache for a simple distribution bootstrap build. |
| 3 | + |
| 4 | +# Enable LLVM projects and runtimes |
| 5 | +set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "") |
| 6 | +set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "") |
| 7 | + |
| 8 | +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") |
| 9 | +set(LLVM_CCACHE_BUILD ON CACHE BOOL "") |
| 10 | +set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "") |
| 11 | +set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "") |
| 12 | +set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "") |
| 13 | + |
| 14 | +# Only build the native target in stage1 since it is a throwaway build. |
| 15 | +set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "") |
| 16 | + |
| 17 | +# Optimize the stage1 compiler, but don't LTO it because that wastes time. |
| 18 | +set(CMAKE_BUILD_TYPE Release CACHE STRING "") |
| 19 | + |
| 20 | +# Setup vendor-specific settings. |
| 21 | +set(PACKAGE_VENDOR LLVM.org CACHE STRING "") |
| 22 | + |
| 23 | +# Setting up the stage2 LTO option needs to be done on the stage1 build so that |
| 24 | +# the proper LTO library dependencies can be connected. |
| 25 | +set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "") |
| 26 | + |
| 27 | +if(NOT APPLE) |
| 28 | + # Since LLVM_ENABLE_LTO is ON we need a LTO capable linker |
| 29 | + set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "") |
| 30 | +endif() |
| 31 | + |
| 32 | +# Expose stage2 targets through the stage1 build configuration. |
| 33 | +set(CLANG_BOOTSTRAP_TARGETS |
| 34 | + check-all |
| 35 | + check-llvm |
| 36 | + check-clang |
| 37 | + llvm-config |
| 38 | + test-suite |
| 39 | + test-depends |
| 40 | + llvm-test-depends |
| 41 | + clang-test-depends |
| 42 | + distribution |
| 43 | + install-distribution |
| 44 | + clang CACHE STRING "") |
| 45 | + |
| 46 | +# Setup the bootstrap build. |
| 47 | +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "") |
| 48 | + |
| 49 | +if(STAGE2_CACHE_FILE) |
| 50 | + set(CLANG_BOOTSTRAP_CMAKE_ARGS |
| 51 | + -C ${STAGE2_CACHE_FILE} |
| 52 | + CACHE STRING "") |
| 53 | +else() |
| 54 | + set(CLANG_BOOTSTRAP_CMAKE_ARGS |
| 55 | + -C ${CMAKE_CURRENT_LIST_DIR}/ToolchainCache-stage2.cmake |
| 56 | + CACHE STRING "") |
| 57 | +endif() |
0 commit comments