| OLD | NEW |
| (Empty) |
| 1 # Ninja Build | |
| 2 | |
| 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. | |
| 6 | |
| 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.) | |
| 10 | |
| 11 Read more about Ninja at [the Ninja home page](https://ninja-build.org/). | |
| 12 | |
| 13 ## Using it | |
| 14 | |
| 15 ### Configure your system to use Ninja | |
| 16 | |
| 17 #### Install | |
| 18 | |
| 19 Ninja is included in `depot_tools` so there's nothing to install. | |
| 20 | |
| 21 ## Build instructions | |
| 22 | |
| 23 To build Chrome: | |
| 24 | |
| 25 cd /path/to/chrome/src | |
| 26 ninja -C out/Debug chrome | |
| 27 | |
| 28 Specify `out/Release` for a release build. I recommend setting up an alias so | |
| 29 that you don't need to type out that build directory path. | |
| 30 | |
| 31 If you want to build all targets, use `ninja -C out/Debug all`. It's faster to | |
| 32 build only the target you're working on, like `chrome` or `unit_tests`. | |
| 33 | |
| 34 ## Android | |
| 35 | |
| 36 Identical to Linux, just make sure `OS=android` is in your `GYP_DEFINES`. You | |
| 37 want to build one of the apk targets, e.g. `content_shell_apk`. | |
| 38 | |
| 39 ## Windows | |
| 40 | |
| 41 Similar to Linux. It uses MSVS's `cl.exe`, `link.exe`, etc. so you still need to | |
| 42 have VS installed. To use it, open `cmd.exe`, go to your chrome checkout, and | |
| 43 run: | |
| 44 | |
| 45 set GYP_DEFINES=component=shared_library | |
| 46 python build\gyp_chromium | |
| 47 ninja -C out\Debug chrome.exe | |
| 48 | |
| 49 `component=shared_library` is optional but recommended for faster links. | |
| 50 | |
| 51 You can also set `GYP_GENERATORS=ninja,msvs-ninja` to get both VS projects | |
| 52 generated if you want to use VS just to browse/edit (but then gyp takes twice as | |
| 53 long to run). | |
| 54 | |
| 55 If you're using Express or the Windows SDK by itself (rather than using a Visual | |
| 56 Studio install), you'll need to run from a vcvarsall command prompt. | |
| 57 | |
| 58 ### Debugging | |
| 59 | |
| 60 Miss VS for debugging? | |
| 61 | |
| 62 ``` | |
| 63 devenv.com /debugexe chrome.exe --my-great-args "go here" --single-process etc | |
| 64 ``` | |
| 65 | |
| 66 Miss Xcode for debugging? Read | |
| 67 http://dev.chromium.org/developers/debugging-on-os-x/building-with-ninja-debuggi
ng-with-xcode | |
| 68 | |
| 69 ### Without Visual Studio | |
| 70 | |
| 71 That is, building with just the WinDDK. This is documented in the | |
| 72 [regular build instructions](http://dev.chromium.org/developers/how-tos/build-in
structions-windows#TOC-Setting-up-the-environment-for-building-with-Visual-C-201
0-Express-or-Windows-7.1-SDK). | |
| 73 | |
| 74 ## Tweaks | |
| 75 | |
| 76 ### Building through errors | |
| 77 | |
| 78 Pass a flag like `-k3` to make Ninja build until it hits three errors instead of | |
| 79 stopping at the first. | |
| 80 | |
| 81 ### Parallelism | |
| 82 | |
| 83 Pass a flag like `-j8` to use 8 parallel processes, or `-j1` to compile just one | |
| 84 at a time (helpful if you're getting weird compiler errors). By default Ninja | |
| 85 tries to use all your processors. | |
| 86 | |
| 87 ### More options | |
| 88 | |
| 89 There are more options. Run `ninja --help` to see them all. | |
| 90 | |
| 91 ### Custom build configs | |
| 92 | |
| 93 You can write a specific build config to a specific output directory via the | |
| 94 `-G` flags to gyp. Here's an example from jamesr: | |
| 95 `build/gyp_chromium -Gconfig=Release -Goutput_dir=out_profiling -Dprofiling=1 | |
| 96 -Dlinux_fpic=0` | |
| 97 | |
| 98 ## Bugs | |
| 99 | |
| 100 If you encounter any problems, please file a bug at http://crbug.com/new with | |
| 101 label `ninja` and cc `thakis@` or `scottmg@`. Assume that it is a bug in Ninja | |
| 102 before you bother anyone about e.g. link problems. | |
| OLD | NEW |