xref: /llvm-project/clang/cmake/caches/DistributionExample.cmake (revision b67cb3cda05bb1fa08b4789423983a7ee3f3c5e4)
17e0f03ecSChris Bieneman# This file sets up a CMakeCache for a simple distribution bootstrap build.
27e0f03ecSChris Bieneman
3c1ad143fSChris Bieneman#Enable LLVM projects and runtimes
4c1ad143fSChris Bienemanset(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
5*b67cb3cdSChris Bienemanset(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi" CACHE STRING "")
6c1ad143fSChris Bieneman
77e0f03ecSChris Bieneman# Only build the native target in stage1 since it is a throwaway build.
87e0f03ecSChris Bienemanset(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
97e0f03ecSChris Bieneman
107e0f03ecSChris Bieneman# Optimize the stage1 compiler, but don't LTO it because that wastes time.
117e0f03ecSChris Bienemanset(CMAKE_BUILD_TYPE Release CACHE STRING "")
127e0f03ecSChris Bieneman
137e0f03ecSChris Bieneman# Setup vendor-specific settings.
147e0f03ecSChris Bienemanset(PACKAGE_VENDOR LLVM.org CACHE STRING "")
157e0f03ecSChris Bieneman
167e0f03ecSChris Bieneman# Setting up the stage2 LTO option needs to be done on the stage1 build so that
177e0f03ecSChris Bieneman# the proper LTO library dependencies can be connected.
187e0f03ecSChris Bienemanset(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
197e0f03ecSChris Bieneman
20*b67cb3cdSChris Bienemanif (NOT APPLE)
21*b67cb3cdSChris Bieneman  # Since LLVM_ENABLE_LTO is ON we need a LTO capable linker
22*b67cb3cdSChris Bieneman  set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
23*b67cb3cdSChris Bienemanendif()
24*b67cb3cdSChris Bieneman
257e0f03ecSChris Bieneman# Expose stage2 targets through the stage1 build configuration.
267e0f03ecSChris Bienemanset(CLANG_BOOTSTRAP_TARGETS
277e0f03ecSChris Bieneman  check-all
287e0f03ecSChris Bieneman  check-llvm
297e0f03ecSChris Bieneman  check-clang
307e0f03ecSChris Bieneman  llvm-config
317e0f03ecSChris Bieneman  test-suite
327e0f03ecSChris Bieneman  test-depends
337e0f03ecSChris Bieneman  llvm-test-depends
347e0f03ecSChris Bieneman  clang-test-depends
357e0f03ecSChris Bieneman  distribution
367e0f03ecSChris Bieneman  install-distribution
377e0f03ecSChris Bieneman  clang CACHE STRING "")
387e0f03ecSChris Bieneman
397e0f03ecSChris Bieneman# Setup the bootstrap build.
407e0f03ecSChris Bienemanset(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
4125f1a6edSNAKAMURA Takumi
4225f1a6edSNAKAMURA Takumiif(STAGE2_CACHE_FILE)
4325f1a6edSNAKAMURA Takumi  set(CLANG_BOOTSTRAP_CMAKE_ARGS
4425f1a6edSNAKAMURA Takumi    -C ${STAGE2_CACHE_FILE}
4525f1a6edSNAKAMURA Takumi    CACHE STRING "")
4625f1a6edSNAKAMURA Takumielse()
477e0f03ecSChris Bieneman  set(CLANG_BOOTSTRAP_CMAKE_ARGS
487e0f03ecSChris Bieneman    -C ${CMAKE_CURRENT_LIST_DIR}/DistributionExample-stage2.cmake
497e0f03ecSChris Bieneman    CACHE STRING "")
5025f1a6edSNAKAMURA Takumiendif()
51