OLD | NEW |
1 # Using CCache on Mac | 1 # Using CCache on Mac |
2 | 2 |
3 [ccache](http://ccache.samba.org/) is a compiler cache. It speeds up | 3 [ccache](http://ccache.samba.org/) is a compiler cache. It speeds up |
4 recompilation of C/C++ code by caching previous compilations and detecting when | 4 recompilation of C/C++ code by caching previous compilations and detecting when |
5 the same compilation is being done again. This often results in a significant | 5 the same compilation is being done again. This often results in a significant |
6 speedup in common compilations, especially when switching between branches. This | 6 speedup in common compilations, especially when switching between branches. This |
7 page is about using ccache on Mac with clang and the NinjaBuild system. | 7 page is about using ccache on Mac with clang and the NinjaBuild system. |
8 | 8 |
9 [TOC] | 9 [TOC] |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ``` | 63 ``` |
64 | 64 |
65 (Instead of relying on the clang/clang++ for building chromium in your `$PATH`, | 65 (Instead of relying on the clang/clang++ for building chromium in your `$PATH`, |
66 you can also use the absolute path here.) | 66 you can also use the absolute path here.) |
67 | 67 |
68 ## Use with GN | 68 ## Use with GN |
69 | 69 |
70 You just need to set the use\_ccache variable. Do so like the following: | 70 You just need to set the use\_ccache variable. Do so like the following: |
71 | 71 |
72 ```shell | 72 ```shell |
73 gn gen out-gn --args='use_ccache=true' | 73 gn gen out-gn --args='cc_wrapper="ccache"' |
74 ``` | 74 ``` |
75 | 75 |
76 ## Build | 76 ## Build |
77 | 77 |
78 In the build phase, the following environment variables must be set (assuming | 78 In the build phase, the following environment variables must be set (assuming |
79 you are in `chromium/src`): | 79 you are in `chromium/src`): |
80 | 80 |
81 ```shell | 81 ```shell |
82 export CCACHE_CPP2=yes | 82 export CCACHE_CPP2=yes |
83 export CCACHE_SLOPPINESS=time_macros | 83 export CCACHE_SLOPPINESS=time_macros |
84 export PATH=`pwd`/third_party/llvm-build/Release+Asserts/bin:$PATH | 84 export PATH=`pwd`/third_party/llvm-build/Release+Asserts/bin:$PATH |
85 ``` | 85 ``` |
86 | 86 |
87 Then you can just run ninja as normal: | 87 Then you can just run ninja as normal: |
88 | 88 |
89 ```shell | 89 ```shell |
90 ninja -C out/Release chrome | 90 ninja -C out/Release chrome |
91 ``` | 91 ``` |
92 | 92 |
93 ## Optional Steps | 93 ## Optional Steps |
94 | 94 |
95 * Configure ccache to use a different cache size with `ccache -M <max size>`. | 95 * Configure ccache to use a different cache size with `ccache -M <max size>`. |
96 You can see a list of configuration options by calling ccache alone. * The | 96 You can see a list of configuration options by calling ccache alone. * The |
97 default ccache directory is `~/.ccache`. You might want to symlink it to | 97 default ccache directory is `~/.ccache`. You might want to symlink it to |
98 another directory (for example, when using FileVault for your home | 98 another directory (for example, when using FileVault for your home |
99 directory). | 99 directory). |
OLD | NEW |