Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 1 | # 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 | |
Armando Montanez | fb3d3fb | 2020-06-09 18:12:12 -0700 | [diff] [blame] | 15 | import("//build_overrides/pigweed.gni") |
Wyatt Hepler | d49f8fe | 2020-10-15 10:13:47 -0700 | [diff] [blame] | 16 | |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 17 | declare_args() { |
| 18 | # Default configs and dependencies targets provided by the toolchain. These |
| 19 | # are applied to all of the pw_* target types. They are set from a toolchain's |
| 20 | # toolchain_args for cross-toolchain deps, e.g. for |
| 21 | # |
| 22 | # `deps = [ //pw_some_module(//pw_toolchain:not_default) ]` |
| 23 | # |
| 24 | # The default toolchain is never used. |
| 25 | default_configs = [] |
| 26 | default_public_deps = [] |
Alexei Frolov | e9bc14b | 2020-06-15 10:25:10 -0700 | [diff] [blame] | 27 | remove_default_configs = [] |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | # Combine target-specifc and target-agnostic default variables. |
| 31 | _pw_build_defaults = { |
| 32 | configs = default_configs |
| 33 | public_deps = default_public_deps |
| 34 | |
| 35 | # The target-agnostic defaults. |
| 36 | configs += [ |
| 37 | "$dir_pw_build:colorize_output", |
| 38 | "$dir_pw_build:debugging", |
| 39 | "$dir_pw_build:reduced_size", |
| 40 | "$dir_pw_build:strict_warnings", |
| 41 | "$dir_pw_build:cpp17", |
Wyatt Hepler | ea55939 | 2021-07-07 16:37:12 -0700 | [diff] [blame] | 42 | "$dir_pw_build:relative_paths", |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 43 | ] |
Alexei Frolov | 3e7fe26 | 2020-09-17 12:25:46 -0700 | [diff] [blame] | 44 | public_deps += [ "$dir_pw_polyfill:overrides" ] |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | # One more pass, to remove configs |
| 48 | pw_build_defaults = { |
| 49 | configs = [] |
Alexei Frolov | e9bc14b | 2020-06-15 10:25:10 -0700 | [diff] [blame] | 50 | forward_variables_from(_pw_build_defaults, "*") |
| 51 | if (remove_default_configs != []) { |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 52 | # Add them first to ensure they are present to be removed. |
Alexei Frolov | e9bc14b | 2020-06-15 10:25:10 -0700 | [diff] [blame] | 53 | configs += remove_default_configs |
| 54 | configs -= remove_default_configs |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 55 | } |
| 56 | } |