# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/banjo/toolchain.gni")
import("//build/compiled_action.gni")

# C/C++ bindings for a Banjo protocol.
#
# The parameters for this template are defined in //build/banjo/banjo.gni. The
# relevant parameters in this template are:
#   name: string, name of the Banjo protocol

template("banjo_c_target") {
  assert(is_fuchsia, "This template can only be used in $target_toolchain.")

  not_needed(invoker, [ "sources" ])

  main_target_name = target_name

  library_name = invoker.name

  ddk_root = string_replace(string_replace(library_name, ".", "/"), "_", "-")
  ddktl_root = string_replace(ddk_root, "ddk", "ddktl")
  banjo_root_gen_dir =
      get_label_info(":$target_name($banjo_toolchain)", "root_gen_dir")
  ddk_header = "$banjo_root_gen_dir/$ddk_root.h"
  ddktl_header = "$banjo_root_gen_dir/$ddktl_root.h"
  ddktl_internal_header = "$banjo_root_gen_dir/$ddktl_root-internal.h"

  # The C/C++ headers are generated by the frontend, so we just need to
  # produce a target with the generated file name and configuration information.
  source_set(main_target_name) {
    forward_variables_from(invoker,
                           [
                             "deps",
                             "testonly",
                             "visibility",
                           ])

    public = [
      ddk_header,
      ddktl_header,
      ddktl_internal_header,
    ]

    # Let dependencies use `#include "$file_stem.h"`.
    public_configs = [ "//build/c:banjo_gen_config" ]

    deps += [
              ":${main_target_name}_c_compile($banjo_toolchain)",
              ":${main_target_name}_cpp_compile($banjo_toolchain)",
              ":${main_target_name}_cpp_i_compile($banjo_toolchain)",
   ]

    libs = [ "zircon" ]
  }
}

template("banjo_dummy_c_target") {
  assert(is_fuchsia, "This template can only be used in $target_toolchain.")

  not_needed(invoker,
             [
               "sources",
               "name",
             ])

  main_target_name = target_name

  # The headers referenced by a dummy target all exist in the sysroot.
  source_set(main_target_name) {
    forward_variables_from(invoker,
                           [
                             "deps",
                             "testonly",
                             "visibility",
                           ])

    public_deps = [
      "//zircon/public/sysroot",
    ]
    libs = [ "zircon" ]
  }
}
