Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 1 | # Copyright 2019 The Pigweed Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
| 14 | |
Rob Mohr | 49de492 | 2019-12-10 20:10:41 -0800 | [diff] [blame] | 15 | import("$dir_pw_docgen/docs.gni") |
| 16 | |
Wyatt Hepler | b9db09f | 2020-01-27 17:40:08 -0800 | [diff] [blame] | 17 | # The default config is applied to all targets in Pigweed's BUILDCONFIG.gn. |
| 18 | config("default") { |
| 19 | configs = [ |
| 20 | ":debugging", |
| 21 | ":reduced_size", |
| 22 | ":strict_warnings", |
| 23 | ] |
| 24 | } |
| 25 | |
| 26 | config("debugging") { |
| 27 | # Enable debug symbol generation. This has no effect on final code size. |
| 28 | cflags = [ "-g" ] |
| 29 | } |
| 30 | |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 31 | # Standard compiler flags to reduce output binary size. |
| 32 | config("reduced_size") { |
| 33 | cflags = [ |
| 34 | "-fno-common", |
| 35 | "-fno-exceptions", |
| 36 | "-ffunction-sections", |
| 37 | "-fdata-sections", |
| 38 | ] |
| 39 | cflags_cc = [ "-fno-rtti" ] |
| 40 | } |
| 41 | |
| 42 | config("strict_warnings") { |
| 43 | cflags = [ |
| 44 | "-Wall", |
| 45 | "-Wextra", |
Keir Mierle | 243e32a | 2019-11-05 10:29:26 -0800 | [diff] [blame] | 46 | |
Wyatt Hepler | 979890d | 2019-11-06 17:17:45 -0800 | [diff] [blame] | 47 | # Make all warnings errors, except for the exemptions below. |
| 48 | "-Werror", |
| 49 | "-Wno-error=cpp", # preprocessor #warning statement |
| 50 | "-Wno-error=deprecated-declarations", # [[deprecated]] attribute |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 51 | ] |
Wyatt Hepler | 1919c64 | 2019-12-06 10:06:13 -0800 | [diff] [blame] | 52 | cflags_cc = [ "-Wnon-virtual-dtor" ] |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 53 | } |
| 54 | |
Armando Montanez | 888370d | 2020-05-01 18:29:22 -0700 | [diff] [blame^] | 55 | # This config contains warnings that we don't necessarily recommend projects |
| 56 | # enable, but are enabled for upstream Pigweed for maximum project |
| 57 | # compatibility. |
| 58 | config("extra_strict_warnings") { |
| 59 | cflags = [ "-Wshadow" ] |
| 60 | } |
| 61 | |
Wyatt Hepler | 818e331 | 2020-01-16 14:19:21 -0800 | [diff] [blame] | 62 | config("cpp11") { |
| 63 | cflags_cc = [ "-std=c++11" ] |
| 64 | } |
| 65 | |
| 66 | config("cpp14") { |
| 67 | cflags_cc = [ "-std=c++14" ] |
| 68 | } |
| 69 | |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 70 | config("cpp17") { |
Wyatt Hepler | 979890d | 2019-11-06 17:17:45 -0800 | [diff] [blame] | 71 | cflags_cc = [ |
| 72 | "-std=c++17", |
| 73 | |
| 74 | # Allow uses of the register keyword, which may appear in C headers. |
| 75 | "-Wno-register", |
| 76 | ] |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Rob Mohr | 49de492 | 2019-12-10 20:10:41 -0800 | [diff] [blame] | 79 | pw_doc_group("docs") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 80 | sources = [ "docs.rst" ] |
Rob Mohr | 49de492 | 2019-12-10 20:10:41 -0800 | [diff] [blame] | 81 | } |
Alexei Frolov | c15a988 | 2019-12-23 14:29:02 -0800 | [diff] [blame] | 82 | |
| 83 | # Pool to limit a single thread to download external Go packages at a time. |
| 84 | pool("go_download_pool") { |
| 85 | depth = 1 |
| 86 | } |