OLD | NEW |
(Empty) | |
| 1 |
| 2 |
| 3 Ninja is a build system written with the specific goal of improving the edit-com
pile cycle time. It is used by default everywhere except when building for iOS. |
| 4 |
| 5 Ninja behaves very similar to Make -- the major feature is that it starts buildi
ng files nearly instantly. (It has a number of minor user interface improvement
s to make as well.) |
| 6 |
| 7 Read more about Ninja at [the Ninja home page](http://martine.github.com/ninja/)
. |
| 8 |
| 9 ## Using it |
| 10 |
| 11 ### Configure your system to use Ninja |
| 12 |
| 13 #### Install |
| 14 |
| 15 Ninja is included in depot\_tools as well as gyp, so there's nothing to install. |
| 16 |
| 17 ## Build instructions |
| 18 |
| 19 To build Chrome: |
| 20 ``` |
| 21 cd /path/to/chrome/src |
| 22 ninja -C out/Debug chrome |
| 23 ``` |
| 24 |
| 25 Specify `out/Release` for a release build. I recommend setting up an alias so th
at you don't need to type out that build directory path. |
| 26 |
| 27 If you want to build all targets, use `ninja -C out/Debug all`. It's faster to b
uild only the target you're working on, like 'chrome' or 'unit\_tests'. |
| 28 |
| 29 ## Android |
| 30 |
| 31 Identical to Linux, just make sure `OS=android` is in your `GYP_DEFINES`. You wa
nt to build one of the _apk targets, e.g. `content_shell_apk`._ |
| 32 |
| 33 ## Windows |
| 34 |
| 35 Similar to Linux. It uses MSVS's `cl.exe`, `link.exe`, etc. so you still need to
have VS installed. To use it, open `cmd.exe`, go to your chrome checkout, and r
un: |
| 36 ``` |
| 37 set GYP_DEFINES=component=shared_library |
| 38 python build\gyp_chromium |
| 39 ninja -C out\Debug chrome.exe |
| 40 ``` |
| 41 |
| 42 `component=shared_library` optional but recommended for faster links. |
| 43 |
| 44 You can also set `GYP_GENERATORS=ninja,msvs-ninja` to get both VS projects gener
ated if you want to use VS just to browse/edit (but then gyp takes twice as long
to run). |
| 45 |
| 46 If you're using Express or the Windows SDK by itself (rather than using a Visual
Studio install), you'll need to run from a vcvarsall command prompt. |
| 47 |
| 48 ### Debugging |
| 49 |
| 50 Miss VS for debugging? |
| 51 ``` |
| 52 devenv.com /debugexe chrome.exe --my-great-args "go here" --single-process etc |
| 53 ``` |
| 54 |
| 55 Miss Xcode for debugging? Read http://dev.chromium.org/developers/debugging-on-o
s-x/building-with-ninja-debugging-with-xcode |
| 56 |
| 57 ### Without Visual Studio |
| 58 |
| 59 That is, building with just the WinDDK. This is documented in the [regular build
instructions](http://dev.chromium.org/developers/how-tos/build-instructions-win
dows#TOC-Setting-up-the-environment-for-building-with-Visual-C-2010-Express-or-W
indows-7.1-SDK). |
| 60 |
| 61 ## Tweaks |
| 62 |
| 63 ### Building through errors |
| 64 Pass a flag like `-k3` to make Ninja build until it hits three errors instead of
stopping at the first. |
| 65 |
| 66 ### Parallelism |
| 67 Pass a flag like `-j8` to use 8 parallel processes, or `-j1` to compile just one
at a time (helpful if you're getting weird compiler errors). By default Ninja
tries to use all your processors. |
| 68 |
| 69 ### More options |
| 70 There are more options. Run `ninja --help` to see them all. |
| 71 |
| 72 ### Custom build configs |
| 73 |
| 74 You can write a specific build config to a specific output directory via the `-G
` flags to gyp. Here's an example from jamesr: |
| 75 `build/gyp_chromium -Gconfig=Release -Goutput_dir=out_profiling -Dprofiling=1 -D
linux_fpic=0` |
| 76 |
| 77 ## Bugs |
| 78 |
| 79 If you encounter any problems, please file a bug at http://crbug.com/new with la
bel `ninja` and cc `thakis@` or `scottmg@`. Assume that it is a bug in Ninja be
fore you bother anyone about e.g. link problems. |
OLD | NEW |