Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 1 | # 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 | |
| 15 | import("modules.gni") |
| 16 | |
| 17 | # Default configs to use for all binary build targets. |
| 18 | _default_common_binary_configs = [ |
| 19 | "$dir_pw_build:reduced_size", |
| 20 | "$dir_pw_build:strict_warnings", |
| 21 | ] |
| 22 | |
| 23 | set_defaults("executable") { |
| 24 | configs = _default_common_binary_configs |
| 25 | } |
| 26 | |
| 27 | set_defaults("static_library") { |
| 28 | configs = _default_common_binary_configs |
| 29 | } |
| 30 | |
| 31 | set_defaults("shared_library") { |
| 32 | configs = _default_common_binary_configs |
| 33 | } |
| 34 | |
| 35 | set_defaults("source_set") { |
| 36 | configs = _default_common_binary_configs |
| 37 | } |
| 38 | |
| 39 | declare_args() { |
Alexei Frolov | e899dcf | 2019-11-13 14:49:14 -0800 | [diff] [blame] | 40 | # Path to the Pigweed variables config file for the build target. |
Alexei Frolov | 02dfcc4 | 2019-11-08 15:51:51 -0800 | [diff] [blame] | 41 | # |
Alexei Frolov | e899dcf | 2019-11-13 14:49:14 -0800 | [diff] [blame] | 42 | # When this is changed, you must run `ninja -t clean` to remove any files from |
| 43 | # the previous target's build before building again. |
| 44 | pw_target_config = "$dir_pigweed/targets/host/host.gni" |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Alexei Frolov | e899dcf | 2019-11-13 14:49:14 -0800 | [diff] [blame] | 47 | import(pw_target_config) |
| 48 | |
| 49 | assert(pw_target_toolchain != "", |
| 50 | "Build target must provide its own toolchain.") |
Alexei Frolov | 02dfcc4 | 2019-11-08 15:51:51 -0800 | [diff] [blame] | 51 | set_default_toolchain(pw_target_toolchain) |