Update WebRTC style guide about GN.

No-Try: True
Bug: None
Change-Id: Iaee25f35eba70d05c0bd2abd1a578db44414ede9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/288363
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38907}
This commit is contained in:
Mirko Bonadei 2022-12-16 11:08:01 +01:00 committed by WebRTC LUCI CQ
parent 50454ef84a
commit ab397ddec4

View File

@ -222,16 +222,27 @@ guide.
### <a name="webrtc-gn-templates"></a>WebRTC-specific GN templates
Use the following [GN templates][gn-templ] to ensure that all our
[GN targets][gn-target] are built with the same configuration:
As shown in the table below, for library targets (`source_set` and
`static_library`), you should default on using `rtc_library` (which abstracts
away the complexity of using the correct target type for Chromium component
builds).
| instead of | use |
|------------------|----------------------|
| `executable` | `rtc_executable` |
| `shared_library` | `rtc_shared_library` |
| `source_set` | `rtc_source_set` |
| `static_library` | `rtc_static_library` |
| `test` | `rtc_test` |
The general rule is for library targets is:
1. Use `rtc_library`.
2. If the library is a header only target use `rtc_source_set`.
3. If you really need to generate a static library, use `rtc_static_library`
(same for shared libraries, in such case use `rtc_shared_library`).
To ensure that all our [GN targets][gn-target] are built with the same
configuration, only use the following [GN templates][gn-templ].
| instead of | use |
|------------------|-----------------------------------------------------------------------------------------|
| `executable` | `rtc_executable` |
| `shared_library` | `rtc_shared_library` |
| `source_set` | `rtc_source_set` (only for header only libraries, for everything else use `rtc_library` |
| `static_library` | `rtc_static_library` (use `rtc_library` unless you really need `rtc_static_library` |
| `test` | `rtc_test` |
[gn-templ]: https://gn.googlesource.com/gn/+/HEAD/docs/language.md#Templates