Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Introduction | |
| 2 | |
| 3 This page is about how to design a project that can build independently | |
| 4 with GN but also be brought into the Chrome build. | |
| 5 | |
| 6 GN is in principle no different than GYP in that there is some core | |
| 7 configuration that must be the same between both the standalone build | |
| 8 and the Chrome build. However, GN is much more explicit in its naming | |
| 9 and configuration, so the similarities between the two builds are also | |
| 10 much more explicit and there is less flexibility in how things are | |
| 11 configured. | |
| 12 | |
| 13 # What you need for a minimal GN build | |
| 14 | |
| 15 Requirements: | |
| 16 | |
| 17 * A master build config file. Chrome's is `//build/config/BUILDCONFIG.gn` | |
| 18 * A separate build file for the toolchain definition. It's not a good idea | |
| 19 to put these in a BUILD.gn file shared with any target definitions for | |
| 20 complex reasons. Chrome's are in `//build/toolchain/<platform>/BUILD.gn`. | |
| 21 * A `BUILD.gn` file in the root directory. This will be loaded after the | |
| 22 build config file to start the build. | |
| 23 | |
| 24 You may want a `.gn` file in the root directory. When you run GN it | |
| 25 recursively looks up the directory tree until it finds this file, and it | |
| 26 treats the containing directory as the "source root". This file also | |
| 27 defines the location of the master build config file: | |
| 28 | |
| 29 * See Chrome's `src/.gn` file. | |
| 30 * Unlike Chrome, you probably don't need to define a secondary root. | |
| 31 * see `gn help dotfile` for more. | |
| 32 | |
| 33 Adding a `.gn` file in a repository that is pulled into Chrome means | |
| 34 that then running GN in your subdirectory will configure a build for | |
| 35 your subproject rather than for all of Chrome. This could be an | |
| 36 advantage or a disadvantage. | |
| 37 | |
| 38 If you would rather avoid using this file, you can use the command-line | |
| 39 flags `--root` and `--dotfile` to set these values. | |
| 40 | |
| 41 # How the standalone and Chrome builds interact | |
|
Nico
2017/03/20 14:19:24
This looks truncated. Pasteboard mishap?
(I notic
| |
| OLD | NEW |