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 | |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 17 | # Standard compiler flags to reduce output binary size. |
| 18 | config("reduced_size") { |
| 19 | cflags = [ |
| 20 | "-fno-common", |
| 21 | "-fno-exceptions", |
| 22 | "-ffunction-sections", |
| 23 | "-fdata-sections", |
| 24 | ] |
| 25 | cflags_cc = [ "-fno-rtti" ] |
| 26 | } |
| 27 | |
| 28 | config("strict_warnings") { |
| 29 | cflags = [ |
| 30 | "-Wall", |
| 31 | "-Wextra", |
Keir Mierle | 243e32a | 2019-11-05 10:29:26 -0800 | [diff] [blame] | 32 | |
Wyatt Hepler | 979890d | 2019-11-06 17:17:45 -0800 | [diff] [blame] | 33 | # Make all warnings errors, except for the exemptions below. |
| 34 | "-Werror", |
| 35 | "-Wno-error=cpp", # preprocessor #warning statement |
| 36 | "-Wno-error=deprecated-declarations", # [[deprecated]] attribute |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 37 | ] |
Wyatt Hepler | 1919c64 | 2019-12-06 10:06:13 -0800 | [diff] [blame] | 38 | cflags_cc = [ "-Wnon-virtual-dtor" ] |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | config("cpp17") { |
Wyatt Hepler | 979890d | 2019-11-06 17:17:45 -0800 | [diff] [blame] | 42 | cflags_cc = [ |
| 43 | "-std=c++17", |
| 44 | |
| 45 | # Allow uses of the register keyword, which may appear in C headers. |
| 46 | "-Wno-register", |
| 47 | ] |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | # Default C++ version for Pigweed modules. |
| 51 | config("pw_default_cpp") { |
| 52 | configs = [ ":cpp17" ] |
| 53 | } |
Rob Mohr | 49de492 | 2019-12-10 20:10:41 -0800 | [diff] [blame^] | 54 | |
| 55 | pw_doc_group("docs") { |
| 56 | sources = [ |
| 57 | "docs.rst", |
| 58 | ] |
| 59 | } |