OLD | NEW |
1 # The Chrome Component Build | 1 # The Chrome Component Build |
2 | 2 |
3 ## Introduction | 3 ## Introduction |
4 | 4 |
5 Release builds are “static” builds which compile to one executable and | 5 Release builds are “static” builds which compile to one executable and |
6 zero-to-two shared libraries (depending on the platform). This is efficient at | 6 zero-to-two shared libraries (depending on the platform). This is efficient at |
7 runtime, but can take a long time to link because so much code goes into a | 7 runtime, but can take a long time to link because so much code goes into a |
8 single binary. When you set the GN build variable | 8 single binary. |
| 9 |
| 10 In a component build, many smaller shared libraries will be generated. This |
| 11 speeds up link times, and means that many changes only require that the local |
| 12 shared library be linked rather than the full executable, but at the expense of |
| 13 program load-time performance. |
| 14 |
| 15 The component build is currently the default for debug non-iOS builds (it |
| 16 doesn’t work for iOS). You can force it on for release builds using the |
| 17 [GN build arg](https://www.chromium.org/developers/gn-build-configuration): |
9 | 18 |
10 ```python | 19 ```python |
11 is_component_build = true | 20 is_component_build = true |
12 ``` | 21 ``` |
13 | 22 |
14 the build will generate many smaller shared libraries. This speeds up link | |
15 times, and means that many changes only require that the local shared library | |
16 be linked rather than the full executable, but at the expense of program | |
17 load-time performance. | |
18 | |
19 ### How to make a component | 23 ### How to make a component |
20 | 24 |
21 Defining a component just means using the GN “component” template instead | 25 Defining a component just means using the GN “component” template instead |
22 of a shared library, static library, or source set. The template will | 26 of a shared library, static library, or source set. The template will |
23 generate a shared library when `is_component_build` is enabled, and a static | 27 generate a shared library when `is_component_build` is enabled, and a static |
24 library otherwise. | 28 library otherwise. |
25 | 29 |
26 ```python | 30 ```python |
27 component("browser") { | 31 component("browser") { |
28 output_name = "chrome_browser" | 32 output_name = "chrome_browser" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 cases above where `_IMPLEMENTATION` is inappropriately defined or inappropriatel
y | 246 cases above where `_IMPLEMENTATION` is inappropriately defined or inappropriatel
y |
243 undefined. Use GN visibility to make sure callers don’t screw up. | 247 undefined. Use GN visibility to make sure callers don’t screw up. |
244 | 248 |
245 ### Putting exported symbols in static libraries | 249 ### Putting exported symbols in static libraries |
246 | 250 |
247 As discussed above, exported symbols should not be in static libraries because | 251 As discussed above, exported symbols should not be in static libraries because |
248 the object file might not be brought into the link. Even if it is brought in | 252 the object file might not be brought into the link. Even if it is brought in |
249 today, it might not be brought in due to completely unrelated changes in the | 253 today, it might not be brought in due to completely unrelated changes in the |
250 future. The result will be undefined symbol errors from other components. Use | 254 future. The result will be undefined symbol errors from other components. Use |
251 source sets if your component is made up of more than one target. | 255 source sets if your component is made up of more than one target. |
OLD | NEW |