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 21 matching lines...) Expand all Loading... |
32 ./autogen.sh | 32 ./autogen.sh |
33 ./configure && make && make install | 33 ./configure && make && make install |
34 ``` | 34 ``` |
35 | 35 |
36 Make sure ccache can be found in your `$PATH`. | 36 Make sure ccache can be found in your `$PATH`. |
37 | 37 |
38 You can also just use the current released version of ccache (3.1.8 or 3.1.9) | 38 You can also just use the current released version of ccache (3.1.8 or 3.1.9) |
39 and disable the chromium style plugin with `clang_use_chrome_plugins=0` in your | 39 and disable the chromium style plugin with `clang_use_chrome_plugins=0` in your |
40 `GYP_DEFINES`. | 40 `GYP_DEFINES`. |
41 | 41 |
42 ## Use with GYP | |
43 | |
44 We have to set two environment variables (`CC` and `CXX`) before calling | |
45 `gclient runhooks` or `build/gyp_chromium`, given you are currently in the | |
46 `chromium/src` directory: | |
47 | |
48 ```shell | |
49 export CC="ccache clang -Qunused-arguments" | |
50 export CXX="ccache clang++ -Qunused-arguments" | |
51 ``` | |
52 | |
53 Then run: | |
54 | |
55 ```shell | |
56 GYP_GENERATORS="ninja" ./build/gyp_chromium | |
57 ``` | |
58 | |
59 or | |
60 | |
61 ```shell | |
62 GYP_GENERATORS="ninja" gclient runhooks | |
63 ``` | |
64 | |
65 (Instead of relying on the clang/clang++ for building chromium in your `$PATH`, | |
66 you can also use the absolute path here.) | |
67 | |
68 ## Use with GN | 42 ## Use with GN |
69 | 43 |
70 You just need to set the use\_ccache variable. Do so like the following: | 44 You just need to set the use\_ccache variable. Do so like the following: |
71 | 45 |
72 ```shell | 46 ```shell |
73 gn gen out-gn --args='cc_wrapper="ccache"' | 47 gn gen out-gn --args='cc_wrapper="ccache"' |
74 ``` | 48 ``` |
75 | 49 |
76 ## Build | 50 ## Build |
77 | 51 |
(...skipping 12 matching lines...) Expand all Loading... |
90 ninja -C out/Release chrome | 64 ninja -C out/Release chrome |
91 ``` | 65 ``` |
92 | 66 |
93 ## Optional Steps | 67 ## Optional Steps |
94 | 68 |
95 * Configure ccache to use a different cache size with `ccache -M <max size>`. | 69 * 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 | 70 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 | 71 default ccache directory is `~/.ccache`. You might want to symlink it to |
98 another directory (for example, when using FileVault for your home | 72 another directory (for example, when using FileVault for your home |
99 directory). | 73 directory). |
OLD | NEW |