1 # Copyright 2020 The Pigweed Authors
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
7 # https://www.apache.org/licenses/LICENSE-2.0
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
15 import("//build_overrides/pigweed.gni")
17 import("$dir_pw_build/python.gni")
18 import("$dir_pw_docgen/docs.gni")
20 # IMPORTANT: The compilation flags in this file must be kept in sync with
21 # the CMake flags pw_build/CMakeLists.txt.
23 config("colorize_output") {
25 # Colorize output. Ninja's Clang invocation disables color by default.
26 "-fdiagnostics-color",
32 # Enable debug symbol generation. This has no effect on final code size.
36 config("extra_debugging") {
37 # Include things like macro expansion in debug info.
42 config("optimize_debugging") {
47 config("optimize_speed") {
52 config("optimize_more_speed") {
57 config("optimize_size") {
62 # Standard compiler flags to reduce output binary size.
63 config("reduced_size") {
67 "-ffunction-sections",
70 cflags_cc = [ "-fno-rtti" ]
73 config("strict_warnings") {
77 "-Wimplicit-fallthrough",
82 # Make all warnings errors, except for the exemptions below.
84 "-Wno-error=cpp", # preprocessor #warning statement
85 "-Wno-error=deprecated-declarations", # [[deprecated]] attribute
87 cflags_cc = [ "-Wnon-virtual-dtor" ]
90 # This config contains warnings that we don't necessarily recommend projects
91 # enable, but are enabled for upstream Pigweed for maximum project
93 config("extra_strict_warnings") {
101 cflags_cc = [ "-std=c++11" ]
105 cflags_cc = [ "-std=c++14" ]
112 # Allow uses of the register keyword, which may appear in C headers.
117 # This empty target is used as the default value for module configurations.
118 # Projects may set pw_build_DEFAULT_MODULE_CONFIG to a different GN target that
119 # overrides modules' configuration options via macro definitions or a header
120 # forcibly included with `-include`.
128 # Requirements for the pw_python_package lint targets.
129 pw_python_requirements("python_lint") {
136 pw_doc_group("docs") {
137 sources = [ "docs.rst" ]
140 # Pool to limit a single thread to download external Go packages at a time.
141 pool("go_download_pool") {