• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1CMake Caches
2============
3
4This directory contains CMake cache scripts that pre-populate the CMakeCache in
5a build directory with commonly used settings.
6
7You can use the caches files with the following CMake invocation:
8
9cmake -G <build system>
10  -C <path to cache file>
11  [additional CMake options (i.e. -DCMAKE_INSTALL_PREFIX=<install path>)]
12  <path to llvm>
13
14Options specified on the command line will override options in the cache files.
15
16The following cache files exist.
17
18Apple-stage1
19------------
20
21The Apple stage1 cache configures a two stage build similar to how Apple builds
22the clang shipped with Xcode. The build files generated from this invocation has
23a target named "stage2" which performs an LTO build of clang.
24
25The Apple-stage2 cache can be used directly to match the build settings Apple
26uses in shipping builds without doing a full bootstrap build.
27
28PGO
29---
30
31The PGO CMake cache can be used to generate a multi-stage instrumented compiler.
32You can configure your build directory with the following invocation of CMake:
33
34cmake -G <generator> -C <path_to_clang>/cmake/caches/PGO.cmake <source dir>
35
36After configuration the following additional targets will be generated:
37
38stage2-instrumented:
39Builds a stage1 x86 compiler, runtime, and required tools (llvm-config,
40llvm-profdata) then uses that compiler to build an instrumented stage2 compiler.
41
42stage2-instrumented-generate-profdata:
43Depends on "stage2-instrumented" and will use the instrumented compiler to
44generate profdata based on the training files in <clang>/utils/perf-training
45
46stage2:
47Depends on "stage2-instrumented-generate-profdata" and will use the stage1
48compiler with the stage2 profdata to build a PGO-optimized compiler.
49
50stage2-check-llvm:
51Depends on stage2 and runs check-llvm using the stage3 compiler.
52
53stage2-check-clang:
54Depends on stage2 and runs check-clang using the stage3 compiler.
55
56stage2-check-all:
57Depends on stage2 and runs check-all using the stage3 compiler.
58
59stage2-test-suite:
60Depends on stage2 and runs the test-suite using the stage3 compiler (requires
61in-tree test-suite).
62
633-stage
64-------
65
66This cache file can be used to generate a 3-stage clang build. You can configure
67using the following CMake command:
68
69cmake -C <path to clang>/cmake/caches/3-stage.cmake -G Ninja <path to llvm>
70
71You can then run "ninja stage3-clang" to build stage1, stage2 and stage3 clangs.
72
73This is useful for finding non-determinism the compiler by verifying that stage2
74and stage3 are identical.
75