Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: docs/c_cache_mac.md

Issue 1309473002: WIP: Migrate Wiki content over to src/docs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Introduction
2
3 [ccache](http://ccache.samba.org/) is a compiler cache. It speeds up recompilati on of C/C++ code by caching previous compilations and detecting when the same co mpilation is being done again. This often results in a significant speedup in co mmon compilations, especially when switching between branches. This page is abou t using ccache on Mac with clang and the NinjaBuild system. If you want to use X code, please refer to the old [CCacheMac](http://code.google.com/p/chromium/wiki /CCacheMac) page.
4
5 In order to use [ccache](http://ccache.samba.org) with [clang](http://code.googl e.com/p/chromium/wiki/Clang), you need to use the current [git HEAD](http://ccac he.samba.org/repo.html), since the most recent version (3.1.9) doesn't contain t he [patch needed](https://github.com/jrosdahl/ccache/pull/4) for using [the chro mium style plugin](http://code.google.com/p/chromium/wiki/Clang#Using_plugins).
6
7 # Installation
8
9 To install ccache with [homebrew](http://mxcl.github.com/homebrew/), use the fol lowing command:
10
11 ```
12 brew install --HEAD ccache
13 ```
14
15 You can also download and install yourself (with GNU automake, autoconf and libt ool installed):
16
17 ```
18 git clone git://git.samba.org/ccache.git
19 cd ccache
20 ./autogen.sh
21 ./configure && make && make install
22 ```
23
24 Make sure ccache can be found in your `$PATH`.
25
26 You can also just use the current released version of ccache (3.1.8 or 3.1.9) an d disable the chromium style plugin with `clang_use_chrome_plugins=0` in your `G YP_DEFINES`.
27
28 # Use with GYP
29
30 We have to set two environment variables (`CC` and `CXX`) before calling `gclien t runhooks` or `build/gyp_chromium`, given you are currently in the `chromium/sr c` directory:
31
32 ```
33 export CC="ccache clang -Qunused-arguments"
34 export CXX="ccache clang++ -Qunused-arguments"
35 ```
36
37 Then run:
38
39 ```
40 GYP_GENERATORS="ninja" ./build/gyp_chromium
41
42 ```
43 or
44
45 ```
46 GYP_GENERATORS="ninja" gclient runhooks
47 ```
48
49 (Instead of relying on the clang/clang++ for building chromium in your `$PATH`, you can also use the absolute path here.)
50
51 # Use with GN
52
53 You just need to set the use\_ccache variable. Do so like the following:
54
55 ```
56 gn gen out-gn --args='use_ccache=true'
57 ```
58
59
60 # Build
61
62 In the build phase, the following environment variables must be set (assuming yo u are in `chromium/src`):
63
64 ```
65 export CCACHE_CPP2=yes
66 export CCACHE_SLOPPINESS=time_macros
67 export PATH=`pwd`/third_party/llvm-build/Release+Asserts/bin:$PATH
68 ```
69
70 Then you can just run ninja as normal:
71
72 ```
73 ninja -C out/Release chrome
74 ```
75
76 # Optional Steps
77
78 * Configure ccache to use a different cache size with `ccache -M <max size>`. You can see a list of configuration options by calling ccache alone.
79 * The default ccache directory is `~/.ccache`. You might want to symlink it to another directory (for example, when using FileVault for your home directory).
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698