blob: a32e49cdd7ceaff469311ec69f7f88ee3fb9a9de [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
Wyatt Hepler818e3312020-01-16 14:19:21 -080055config("cpp11") {
56 cflags_cc = [ "-std=c++11" ]
57}
58
59config("cpp14") {
60 cflags_cc = [ "-std=c++14" ]
61}
62
Alexei Frolov1a82c142019-10-31 17:37:12 -070063config("cpp17") {
Wyatt Hepler979890d2019-11-06 17:17:45 -080064 cflags_cc = [
65 "-std=c++17",
66
67 # Allow uses of the register keyword, which may appear in C headers.
68 "-Wno-register",
69 ]
Alexei Frolov1a82c142019-10-31 17:37:12 -070070}
71
Rob Mohr49de4922019-12-10 20:10:41 -080072pw_doc_group("docs") {
73 sources = [
74 "docs.rst",
75 ]
76}
Alexei Frolovc15a9882019-12-23 14:29:02 -080077
78# Pool to limit a single thread to download external Go packages at a time.
79pool("go_download_pool") {
80 depth = 1
81}