blob: ce3069dd8bd6a5409ac8993b27c8e876280abdcd [file] [log] [blame]
Andrew Sculle9827712018-10-19 14:54:20 +01001# Copyright 2018 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of 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,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Andrew Sculla158e912018-07-16 11:32:13 +010015# Configuration of the build toolchain.
16declare_args() {
Andrew Scullb401ba32018-11-09 10:30:54 +000017 # The name of the project being built.
18 project = "reference"
19
Andrew Sculla158e912018-07-16 11:32:13 +010020 # Enable extra debugging.
21 is_debug = true
22
Andrew Scullb401ba32018-11-09 10:30:54 +000023 # Whether to build against the platform for embedded images consisting of
24 # include paths and defines. This is also used for host targets that simulate
25 # an embedded image.
26 use_platform = false
Andrew Sculla158e912018-07-16 11:32:13 +010027}
28
Andrew Scull23e93a82018-10-26 14:56:04 +010029# Check that we support the attempted build.
30assert(host_os == "linux", "Only linux builds are currently supported.")
Andrew Sculla158e912018-07-16 11:32:13 +010031
Andrew Scull23e93a82018-10-26 14:56:04 +010032# Setup the standard variables.
Andrew Sculla158e912018-07-16 11:32:13 +010033if (target_os == "") {
34 target_os = host_os
35}
36if (target_cpu == "") {
37 target_cpu = host_cpu
38}
39if (current_os == "") {
40 current_os = target_os
41}
42if (current_cpu == "") {
43 current_cpu = target_cpu
44}
45
Andrew Scull23e93a82018-10-26 14:56:04 +010046assert(target_os == host_os, "Cross compiles not yet supported.")
47assert(target_cpu == host_cpu, "Cross compiles not yet supported.")
Andrew Sculla158e912018-07-16 11:32:13 +010048
Andrew Scull23e93a82018-10-26 14:56:04 +010049# All binary targets will get this list of configs by default.
50_shared_binary_target_configs = [ "//build:compiler_defaults" ]
51
52# If it's not building a host utility, it's building against the platform so apply the configuration.
Andrew Scullb401ba32018-11-09 10:30:54 +000053if (use_platform) {
Andrew Scull23e93a82018-10-26 14:56:04 +010054 _shared_binary_target_configs += [ "//build:platform" ]
55}
Andrew Sculla158e912018-07-16 11:32:13 +010056
57# Apply that default list to the binary target types.
58set_defaults("executable") {
59 configs = _shared_binary_target_configs
Andrew Sculla158e912018-07-16 11:32:13 +010060}
61set_defaults("static_library") {
62 configs = _shared_binary_target_configs
63}
64set_defaults("shared_library") {
65 configs = _shared_binary_target_configs
66}
67set_defaults("source_set") {
68 configs = _shared_binary_target_configs
69}
70
Andrew Scull23e93a82018-10-26 14:56:04 +010071# The default toolchain is the target toolchain for building utilities and tests.
72set_default_toolchain("//build/toolchain:host_clang")