| # Copyright 2018 The Hafnium Authors. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # Configuration of the build toolchain. |
| declare_args() { |
| # The name of the project being built. |
| project = "reference" |
| |
| # Whether to build against the platform for embedded images consisting of |
| # include paths and defines. This is also used for host targets that simulate |
| # an embedded image. |
| use_platform = false |
| |
| # The level of debug logs to include. This should match one of the levels |
| # defined in dlog.h. |
| log_level = "LOG_LEVEL_INFO" |
| } |
| |
| # Check that we support the attempted build. |
| assert(host_os == "linux", "Only linux builds are currently supported.") |
| |
| # Setup the standard variables. |
| if (target_os == "") { |
| target_os = host_os |
| } |
| if (target_cpu == "") { |
| target_cpu = host_cpu |
| } |
| if (current_os == "") { |
| current_os = target_os |
| } |
| if (current_cpu == "") { |
| current_cpu = target_cpu |
| } |
| |
| assert(target_os == host_os, "Cross compiles not yet supported.") |
| assert(target_cpu == host_cpu, "Cross compiles not yet supported.") |
| |
| # All binary targets will get this list of configs by default. |
| _shared_binary_target_configs = [ "//build:compiler_defaults" ] |
| |
| # If it's not building a host utility, it's building against the platform so apply the configuration. |
| if (use_platform) { |
| _shared_binary_target_configs += [ "//build:platform" ] |
| } |
| |
| # Apply that default list to the binary target types. |
| set_defaults("executable") { |
| configs = _shared_binary_target_configs |
| } |
| set_defaults("static_library") { |
| configs = _shared_binary_target_configs |
| } |
| set_defaults("shared_library") { |
| configs = _shared_binary_target_configs |
| } |
| set_defaults("source_set") { |
| configs = _shared_binary_target_configs |
| } |
| |
| # The default toolchain is the target toolchain for building utilities and tests. |
| set_default_toolchain("//build/toolchain:host_clang") |