# 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_touchscreen_BACKEND = "$dir_pw_touchscreen_null"

      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,
]
