2020-06-10 22:00:29 +00:00
|
|
|
# Copyright 2020 The Pigweed 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.
|
|
|
|
|
|
|
|
import("//build_overrides/pigweed.gni")
|
|
|
|
|
2020-06-11 23:36:11 +00:00
|
|
|
import("$dir_pw_protobuf_compiler/proto.gni")
|
2020-08-11 17:04:01 +00:00
|
|
|
import("$dir_pw_third_party/nanopb/nanopb.gni")
|
2020-06-10 22:00:29 +00:00
|
|
|
import("$dir_pw_toolchain/host_clang/toolchains.gni")
|
|
|
|
import("$dir_pw_toolchain/host_gcc/toolchains.gni")
|
2020-10-15 17:13:47 +00:00
|
|
|
|
2020-06-10 22:00:29 +00:00
|
|
|
_host_common = {
|
|
|
|
# Use logging-based test output on host.
|
|
|
|
pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main"
|
|
|
|
|
|
|
|
# Configure backend for assert facade.
|
|
|
|
pw_assert_BACKEND = "$dir_pw_assert_basic"
|
|
|
|
|
|
|
|
# Configure backend for logging facade.
|
|
|
|
pw_log_BACKEND = "$dir_pw_log_basic"
|
|
|
|
|
|
|
|
# Configure backend for pw_sys_io facade.
|
|
|
|
pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio"
|
2020-06-11 23:36:11 +00:00
|
|
|
|
2020-05-12 19:41:52 +00:00
|
|
|
# Configure backend for trace facade.
|
|
|
|
pw_trace_BACKEND = "$dir_pw_trace_tokenized"
|
|
|
|
|
2020-07-13 19:10:42 +00:00
|
|
|
# Tokenizer trace time.
|
|
|
|
pw_trace_tokenizer_time = "$dir_pw_trace_tokenized:host_trace_time"
|
2020-05-12 19:41:52 +00:00
|
|
|
|
2020-06-11 23:36:11 +00:00
|
|
|
# Allow nanopb to be toggled via a build arg on host for easy testing.
|
2020-06-15 21:25:07 +00:00
|
|
|
_has_nanopb = pw_protobuf_GENERATORS + [ "nanopb" ] - [ "nanopb" ] !=
|
|
|
|
pw_protobuf_GENERATORS
|
|
|
|
if (dir_pw_third_party_nanopb != "" && !_has_nanopb) {
|
2020-06-11 23:36:11 +00:00
|
|
|
pw_protobuf_GENERATORS += [ "nanopb" ]
|
|
|
|
}
|
2020-08-13 23:04:19 +00:00
|
|
|
|
|
|
|
# Specify builtin GN variables.
|
|
|
|
current_os = host_os
|
|
|
|
current_cpu = host_cpu
|
2020-06-10 22:00:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Linux-specific target configuration.
|
|
|
|
_linux_config = {
|
|
|
|
pw_bloat_BLOATY_CONFIG = get_path_info("linux.bloaty", "abspath")
|
|
|
|
pw_unit_test_AUTOMATIC_RUNNER = get_path_info("run_test", "abspath")
|
|
|
|
}
|
|
|
|
|
|
|
|
# macOS-specific target configuration.
|
|
|
|
_mac_config = {
|
|
|
|
pw_bloat_BLOATY_CONFIG = get_path_info("macos.bloaty", "abspath")
|
|
|
|
pw_unit_test_AUTOMATIC_RUNNER = get_path_info("run_test", "abspath")
|
|
|
|
}
|
|
|
|
|
|
|
|
# Windows-specific target configuration.
|
|
|
|
_win_config = {
|
|
|
|
# This is here as bloaty_config_file cannot be an empty string or GN fails.
|
|
|
|
# TODO(frolv): Add this file and enable size reports on Windows.
|
|
|
|
pw_bloat_BLOATY_CONFIG = get_path_info("windows.bloaty", "abspath")
|
|
|
|
pw_unit_test_AUTOMATIC_RUNNER = get_path_info("run_test.bat", "abspath")
|
|
|
|
}
|
|
|
|
|
|
|
|
_os_specific_config = {
|
|
|
|
if (host_os == "linux") {
|
|
|
|
forward_variables_from(_linux_config, "*")
|
|
|
|
} else if (host_os == "mac") {
|
|
|
|
forward_variables_from(_mac_config, "*")
|
|
|
|
} else if (host_os == "win") {
|
|
|
|
forward_variables_from(_win_config, "*")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pw_target_toolchain_host = {
|
2020-06-11 20:42:03 +00:00
|
|
|
_excluded_members = [
|
|
|
|
"defaults",
|
|
|
|
"name",
|
|
|
|
]
|
|
|
|
|
2020-06-10 22:00:29 +00:00
|
|
|
clang_debug = {
|
2020-06-11 20:42:03 +00:00
|
|
|
name = "host_clang_debug"
|
|
|
|
_toolchain_base = pw_toolchain_host_clang.debug
|
|
|
|
forward_variables_from(_toolchain_base, "*", _excluded_members)
|
2020-06-10 22:00:29 +00:00
|
|
|
defaults = {
|
|
|
|
forward_variables_from(_toolchain_base.defaults, "*")
|
|
|
|
forward_variables_from(_host_common, "*")
|
|
|
|
forward_variables_from(_os_specific_config, "*")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
clang_speed_optimized = {
|
2020-06-11 20:42:03 +00:00
|
|
|
name = "host_clang_speed_optimized"
|
|
|
|
_toolchain_base = pw_toolchain_host_clang.speed_optimized
|
|
|
|
forward_variables_from(_toolchain_base, "*", _excluded_members)
|
2020-06-10 22:00:29 +00:00
|
|
|
defaults = {
|
|
|
|
forward_variables_from(_toolchain_base.defaults, "*")
|
|
|
|
forward_variables_from(_host_common, "*")
|
|
|
|
forward_variables_from(_os_specific_config, "*")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
clang_size_optimized = {
|
2020-06-11 20:42:03 +00:00
|
|
|
name = "host_clang_size_optimized"
|
|
|
|
_toolchain_base = pw_toolchain_host_clang.size_optimized
|
|
|
|
forward_variables_from(_toolchain_base, "*", _excluded_members)
|
2020-06-10 22:00:29 +00:00
|
|
|
defaults = {
|
|
|
|
forward_variables_from(_toolchain_base.defaults, "*")
|
|
|
|
forward_variables_from(_host_common, "*")
|
|
|
|
forward_variables_from(_os_specific_config, "*")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gcc_debug = {
|
2020-06-11 20:42:03 +00:00
|
|
|
name = "host_gcc_debug"
|
|
|
|
_toolchain_base = pw_toolchain_host_gcc.debug
|
|
|
|
forward_variables_from(_toolchain_base, "*", _excluded_members)
|
2020-06-10 22:00:29 +00:00
|
|
|
defaults = {
|
|
|
|
forward_variables_from(_toolchain_base.defaults, "*")
|
|
|
|
forward_variables_from(_host_common, "*")
|
|
|
|
forward_variables_from(_os_specific_config, "*")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gcc_speed_optimized = {
|
2020-06-11 20:42:03 +00:00
|
|
|
name = "host_gcc_speed_optimized"
|
|
|
|
_toolchain_base = pw_toolchain_host_gcc.speed_optimized
|
|
|
|
forward_variables_from(_toolchain_base, "*", _excluded_members)
|
2020-06-10 22:00:29 +00:00
|
|
|
defaults = {
|
|
|
|
forward_variables_from(_toolchain_base.defaults, "*")
|
|
|
|
forward_variables_from(_host_common, "*")
|
|
|
|
forward_variables_from(_os_specific_config, "*")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gcc_size_optimized = {
|
2020-06-11 20:42:03 +00:00
|
|
|
name = "host_gcc_size_optimized"
|
|
|
|
_toolchain_base = pw_toolchain_host_gcc.size_optimized
|
|
|
|
forward_variables_from(_toolchain_base, "*", _excluded_members)
|
2020-06-10 22:00:29 +00:00
|
|
|
defaults = {
|
|
|
|
forward_variables_from(_toolchain_base.defaults, "*")
|
|
|
|
forward_variables_from(_host_common, "*")
|
|
|
|
forward_variables_from(_os_specific_config, "*")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-11 20:42:03 +00:00
|
|
|
# This list just contains the members of the above scope for convenience to make
|
|
|
|
# it trivial to generate all the toolchains in this file via a
|
|
|
|
# `generate_toolchains` target.
|
2020-06-10 22:00:29 +00:00
|
|
|
pw_target_toolchain_host_list = [
|
|
|
|
pw_target_toolchain_host.clang_debug,
|
|
|
|
pw_target_toolchain_host.clang_speed_optimized,
|
|
|
|
pw_target_toolchain_host.clang_size_optimized,
|
|
|
|
pw_target_toolchain_host.gcc_debug,
|
|
|
|
pw_target_toolchain_host.gcc_speed_optimized,
|
|
|
|
pw_target_toolchain_host.gcc_size_optimized,
|
|
|
|
]
|