Add RemoteDeviceLifeCycle to manage the life cycle of a remote Smart Lock phone.
[chromium-blink-merge.git] / docs / ninja_build.md
blob0a328536594322a86b0d2561db634e57c95d56ef
1 # Ninja Build
3 Ninja is a build system written with the specific goal of improving the
4 edit-compile cycle time. It is used by default everywhere except when building
5 for iOS.
7 Ninja behaves very similar to Make -- the major feature is that it starts
8 building files nearly instantly. (It has a number of minor user interface
9 improvements to make as well.)
11 Read more about Ninja at
12 [the Ninja home page](http://martine.github.com/ninja/).
14 ## Using it
16 ### Configure your system to use Ninja
18 #### Install
20 Ninja is included in `depot_tools` as well as `gyp`, so there's nothing to
21 install.
23 ## Build instructions
25 To build Chrome:
27     cd /path/to/chrome/src
28     ninja -C out/Debug chrome
30 Specify `out/Release` for a release build. I recommend setting up an alias so
31 that you don't need to type out that build directory path.
33 If you want to build all targets, use `ninja -C out/Debug all`. It's faster to
34 build only the target you're working on, like `chrome` or `unit_tests`.
36 ## Android
38 Identical to Linux, just make sure `OS=android` is in your `GYP_DEFINES`. You
39 want to build one of the apk targets, e.g. `content_shell_apk`.
41 ## Windows
43 Similar to Linux. It uses MSVS's `cl.exe`, `link.exe`, etc. so you still need to
44 have VS installed. To use it, open `cmd.exe`, go to your chrome checkout, and
45 run:
47     set GYP_DEFINES=component=shared_library
48     python build\gyp_chromium
49     ninja -C out\Debug chrome.exe
51 `component=shared_library` is optional but recommended for faster links.
53 You can also set `GYP_GENERATORS=ninja,msvs-ninja` to get both VS projects
54 generated if you want to use VS just to browse/edit (but then gyp takes twice as
55 long to run).
57 If you're using Express or the Windows SDK by itself (rather than using a Visual
58 Studio install), you'll need to run from a vcvarsall command prompt.
60 ### Debugging
62 Miss VS for debugging?
64 ```
65 devenv.com /debugexe chrome.exe --my-great-args "go here" --single-process etc
66 ```
68 Miss Xcode for debugging? Read
69 http://dev.chromium.org/developers/debugging-on-os-x/building-with-ninja-debugging-with-xcode
71 ### Without Visual Studio
73 That is, building with just the WinDDK. This is documented in the
74 [regular build instructions](http://dev.chromium.org/developers/how-tos/build-instructions-windows#TOC-Setting-up-the-environment-for-building-with-Visual-C-2010-Express-or-Windows-7.1-SDK).
76 ## Tweaks
78 ### Building through errors
80 Pass a flag like `-k3` to make Ninja build until it hits three errors instead of
81 stopping at the first.
83 ### Parallelism
85 Pass a flag like `-j8` to use 8 parallel processes, or `-j1` to compile just one
86 at a time (helpful if you're getting weird compiler errors). By default Ninja
87 tries to use all your processors.
89 ### More options
91 There are more options. Run `ninja --help` to see them all.
93 ### Custom build configs
95 You can write a specific build config to a specific output directory via the
96 `-G` flags to gyp. Here's an example from jamesr:
97 `build/gyp_chromium -Gconfig=Release -Goutput_dir=out_profiling -Dprofiling=1
98 -Dlinux_fpic=0`
100 ## Bugs
102 If you encounter any problems, please file a bug at http://crbug.com/new with
103 label `ninja` and cc `thakis@` or `scottmg@`.  Assume that it is a bug in Ninja
104 before you bother anyone about e.g. link problems.