blob: 38afdf814c7ac602a6c6748c0ec8695300521c9d [file] [log] [blame]
Alexei Frolov1a82c142019-10-31 17:37:12 -07001# 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 Mohr49de4922019-12-10 20:10:41 -080015import("$dir_pw_docgen/docs.gni")
16
Wyatt Heplerb9db09f2020-01-27 17:40:08 -080017# The default config is applied to all targets in Pigweed's BUILDCONFIG.gn.
18config("default") {
19 configs = [
20 ":debugging",
21 ":reduced_size",
22 ":strict_warnings",
23 ]
24}
25
26config("debugging") {
27 # Enable debug symbol generation. This has no effect on final code size.
28 cflags = [ "-g" ]
29}
30
Alexei Frolov1a82c142019-10-31 17:37:12 -070031# Standard compiler flags to reduce output binary size.
32config("reduced_size") {
33 cflags = [
34 "-fno-common",
35 "-fno-exceptions",
36 "-ffunction-sections",
37 "-fdata-sections",
38 ]
39 cflags_cc = [ "-fno-rtti" ]
40}
41
42config("strict_warnings") {
43 cflags = [
44 "-Wall",
45 "-Wextra",
Keir Mierle243e32a2019-11-05 10:29:26 -080046
Wyatt Hepler979890d2019-11-06 17:17:45 -080047 # 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 Frolov1a82c142019-10-31 17:37:12 -070051 ]
Wyatt Hepler1919c642019-12-06 10:06:13 -080052 cflags_cc = [ "-Wnon-virtual-dtor" ]
Alexei Frolov1a82c142019-10-31 17:37:12 -070053}
54
Armando Montanez888370d2020-05-01 18:29:22 -070055# This config contains warnings that we don't necessarily recommend projects
56# enable, but are enabled for upstream Pigweed for maximum project
57# compatibility.
58config("extra_strict_warnings") {
59 cflags = [ "-Wshadow" ]
60}
61
Wyatt Hepler818e3312020-01-16 14:19:21 -080062config("cpp11") {
63 cflags_cc = [ "-std=c++11" ]
64}
65
66config("cpp14") {
67 cflags_cc = [ "-std=c++14" ]
68}
69
Alexei Frolov1a82c142019-10-31 17:37:12 -070070config("cpp17") {
Wyatt Hepler979890d2019-11-06 17:17:45 -080071 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 Frolov1a82c142019-10-31 17:37:12 -070077}
78
Rob Mohr49de4922019-12-10 20:10:41 -080079pw_doc_group("docs") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080080 sources = [ "docs.rst" ]
Rob Mohr49de4922019-12-10 20:10:41 -080081}
Alexei Frolovc15a9882019-12-23 14:29:02 -080082
83# Pool to limit a single thread to download external Go packages at a time.
84pool("go_download_pool") {
85 depth = 1
86}