diff options
author | Karl Wiberg <kwiberg@webrtc.org> | 2017-09-07 17:05:31 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2017-09-08 10:24:16 +0000 |
commit | 91d0ab71ef330d8f1f0f40962791ab8f97f96a72 (patch) | |
tree | 86578adbbdfbb9a5872d4d027f53eb366d70e3a2 /style-guide.md | |
parent | 5b4b52264132eefba10bc6880871715f9692da90 (diff) | |
download | webrtc-91d0ab71ef330d8f1f0f40962791ab8f97f96a72.tar.gz |
Style guide: Link to Chromium's GN style guide
BUG=none
NOTRY=true
Change-Id: I26f2588ef4bfecb39ab0f491508fd21797a8be5c
Reviewed-on: https://chromium-review.googlesource.com/652607
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Niels Möller <nisse@chromium.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19740}
Diffstat (limited to 'style-guide.md')
-rw-r--r-- | style-guide.md | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/style-guide.md b/style-guide.md index b39ab35fe1..bb2524a73a 100644 --- a/style-guide.md +++ b/style-guide.md @@ -7,7 +7,7 @@ style guides. In cases where they conflict, the Chromium style guide trumps the Google style guide, and the rules in this file trump them both. -[chr-style]: https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md +[chr-style]: https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/c++.md [goog-style]: https://google.github.io/styleguide/cppguide.html Some older parts of the code violate the style guide in various ways. @@ -48,10 +48,34 @@ pre-dates the use of the current C++ style guide for this code base. ## Build files +The WebRTC build files are written in [GN][gn], and we follow +the [Chromium GN style guide][chr-gn-style]. Additionally, there are +some WebRTC-specific rules below; in case of conflict, they trump the +Chromium style guide. + +[gn]: https://chromium.googlesource.com/chromium/src/tools/gn/ +[chr-gn-style]: https://chromium.googlesource.com/chromium/src/tools/gn/+/HEAD/docs/style_guide.md + +### WebRTC-specific GN templates + +Use the following [GN templates][gn-templ] to ensure that all +our [targets][gn-target] are built with the same configuration: + +instead of | use +-----------------|--------------------- +`executable` | `rtc_executable` +`shared_library` | `rtc_shared_library` +`source_set` | `rtc_source_set` +`static_library` | `rtc_static_library` +`test` | `rtc_test` + +[gn-templ]: https://chromium.googlesource.com/chromium/src/tools/gn/+/HEAD/docs/language.md#Templates +[gn-target]: https://chromium.googlesource.com/chromium/src/tools/gn/+/HEAD/docs/language.md#Targets + ### Conditional compilation with the C preprocessor Avoid using the C preprocessor to conditionally enable or disable -pieces of code. But if you can’t avoid it, introduce a gn variable, +pieces of code. But if you can’t avoid it, introduce a GN variable, and then set a preprocessor constant to either 0 or 1 in the build targets that need it: |