blob: 2b20cc289e8f2123040359e23036e08598c625d3 [file] [log] [blame]
Alexei Frolov844ff0f2020-05-06 12:15:29 -07001# Copyright 2020 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
15# Importing this file provides the $pw_build_defaults scope.
16# This includes target-agnostic default variables. It may also includes
17# target-specific default variables if $pw_target_toolchain or
18# $pw_target_defaults is set (and recognized).
19
20import("$dir_pigweed/modules.gni")
21
22declare_args() {
23 # Default configs and dependencies targets provided by the toolchain. These
24 # are applied to all of the pw_* target types. They are set from a toolchain's
25 # toolchain_args for cross-toolchain deps, e.g. for
26 #
27 # `deps = [ //pw_some_module(//pw_toolchain:not_default) ]`
28 #
29 # The default toolchain is never used.
30 default_configs = []
31 default_public_deps = []
32}
33
34# Combine target-specifc and target-agnostic default variables.
35_pw_build_defaults = {
36 configs = default_configs
37 public_deps = default_public_deps
38
39 # The target-agnostic defaults.
40 configs += [
41 "$dir_pw_build:colorize_output",
42 "$dir_pw_build:debugging",
43 "$dir_pw_build:reduced_size",
44 "$dir_pw_build:strict_warnings",
45 "$dir_pw_build:cpp17",
46 ]
47 public_deps = [ "$dir_pw_polyfill:overrides" ]
48}
49
50# One more pass, to remove configs
51pw_build_defaults = {
52 configs = []
53 forward_variables_from(_pw_build_defaults, "*", [ "remove_configs" ])
54 if (defined(_pw_build_defaults.remove_configs)) {
55 # Add them first to ensure they are present to be removed.
56 configs += _pw_build_defaults.remove_configs
57 configs -= _pw_build_defaults.remove_configs
58 }
59}