| # Copyright 2022 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") |
| |
| import("$dir_pigweed/targets/host/target_toolchains.gni") |
| import("$dir_pigweed_experimental/targets/common_backends.gni") |
| import("$dir_pigweed_experimental/third_party/imgui/imgui.gni") |
| import("$dir_pw_protobuf_compiler/proto.gni") |
| import("$dir_pw_third_party/nanopb/nanopb.gni") |
| |
| target_toolchain_host = { |
| _excluded_members = [ |
| "defaults", |
| "name", |
| ] |
| |
| _excluded_defaults = [ |
| "pw_trace_BACKEND", |
| "pw_trace_tokenizer_time", |
| ] |
| |
| clang_debug = { |
| name = "host_debug" |
| if (host_os == "win") { |
| _toolchain_base = pw_target_toolchain_host.gcc_debug |
| } else { |
| _toolchain_base = pw_target_toolchain_host.clang_debug |
| } |
| forward_variables_from(_toolchain_base, "*", _excluded_members) |
| defaults = { |
| forward_variables_from(_toolchain_base.defaults, "*", _excluded_defaults) |
| forward_variables_from(toolchain_overrides, "*") |
| |
| # Force hosts to use basic log backend to avoid generating and loading its |
| # own tokenized database. |
| pw_log_BACKEND = dir_pw_log_basic |
| |
| # Configure backend for pw_sys_io facade. |
| pw_sys_io_BACKEND = dir_pw_sys_io_stdio |
| |
| app_common_BACKEND = |
| "$dir_pigweed_experimental/applications/app_common_impl:host_null" |
| pw_app_common_DISPLAY_WIDTH = "320" |
| pw_app_common_DISPLAY_HEIGHT = "240" |
| pw_display_DISPLAY_RESIZE = 1 |
| |
| # pw_display_host_imgui uses imgui and opengl3 |
| # See //pw_display_host_imgui/README.md for instructions. |
| if (dir_pw_third_party_imgui != "") { |
| app_common_BACKEND = |
| "$dir_pigweed_experimental/applications/app_common_impl:host_imgui" |
| } |
| |
| pw_board_led_BACKEND = dir_pw_board_led_host |
| pw_spin_delay_BACKEND = dir_pw_spin_delay_host |
| } |
| } |
| |
| clang_debug_cpp20 = { |
| name = "host_debug_cpp20" |
| _toolchain_base = clang_debug |
| forward_variables_from(_toolchain_base, "*", _excluded_members) |
| defaults = { |
| forward_variables_from(_toolchain_base.defaults, "*", _excluded_defaults) |
| forward_variables_from(toolchain_overrides, "*") |
| pw_toolchain_CXX_STANDARD = pw_toolchain_STANDARD.CXX20 |
| } |
| } |
| |
| # Toolchain for tests only. |
| clang_debug_tests = { |
| name = "host_debug_tests" |
| if (host_os == "win") { |
| _toolchain_base = pw_target_toolchain_host.gcc_debug |
| } else { |
| _toolchain_base = pw_target_toolchain_host.clang_debug |
| } |
| forward_variables_from(_toolchain_base, "*", _excluded_members) |
| defaults = { |
| forward_variables_from(_toolchain_base.defaults, "*", _excluded_defaults) |
| forward_variables_from(toolchain_overrides, "*") |
| |
| # Force tests to use basic log backend to avoid generating and loading its |
| # own tokenized database. |
| pw_log_BACKEND = dir_pw_log_basic |
| } |
| } |
| |
| # Toolchain for size-optimized builds. |
| clang_size_optimized = { |
| name = "host_size_optimized" |
| if (host_os == "win") { |
| _toolchain_base = pw_target_toolchain_host.gcc_size_optimized |
| } else { |
| _toolchain_base = pw_target_toolchain_host.clang_size_optimized |
| } |
| forward_variables_from(_toolchain_base, "*", _excluded_members) |
| defaults = { |
| forward_variables_from(_toolchain_base.defaults, "*", _excluded_defaults) |
| forward_variables_from(toolchain_overrides, "*") |
| |
| # Force tests to use basic log backend to avoid generating and loading its |
| # own tokenized database. |
| pw_log_BACKEND = dir_pw_log_basic |
| } |
| } |
| |
| clang_debug_tests_cpp20 = { |
| name = "host_debug_tests_cpp20" |
| _toolchain_base = clang_debug_tests |
| forward_variables_from(_toolchain_base, "*", _excluded_members) |
| defaults = { |
| forward_variables_from(_toolchain_base.defaults, "*", _excluded_defaults) |
| forward_variables_from(toolchain_overrides, "*") |
| pw_toolchain_CXX_STANDARD = pw_toolchain_STANDARD.CXX20 |
| } |
| } |
| } |
| |
| toolchains_list = [ |
| target_toolchain_host.clang_debug, |
| target_toolchain_host.clang_debug_cpp20, |
| target_toolchain_host.clang_debug_tests, |
| target_toolchain_host.clang_debug_tests_cpp20, |
| target_toolchain_host.clang_size_optimized, |
| ] |