| # Copyright 2019 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/config/fuchsia/zircon.gni") |
| import("//build/sdk/sdk_atom.gni") |
| |
| template("zircon_host_tool") { |
| tool_name = target_name |
| |
| copy(tool_name) { |
| sources = [ |
| "$zircon_root_build_dir/${invoker.path}", |
| ] |
| outputs = [ |
| "$root_out_dir/$tool_name", |
| ] |
| } |
| |
| file_base = "tools/$tool_name" |
| tool_src = "$zircon_root_build_dir/tools-$current_os-$current_cpu/$tool_name" |
| |
| # TODO(fxb/42999): remove extra atom |
| if (current_cpu == host_cpu) { |
| sdk_atom("${target_name}_sdk_legacy") { |
| id = "sdk://$file_base" |
| category = "partner" |
| |
| meta = { |
| dest = "$file_base-meta.json" |
| schema = "host_tool" |
| value = { |
| type = "host_tool" |
| name = tool_name |
| root = "tools" |
| files = [ file_base ] |
| } |
| } |
| |
| files = [ |
| { |
| source = tool_src |
| dest = file_base |
| }, |
| ] |
| } |
| } |
| |
| if (host_os == "linux" || host_os == "mac") { |
| file_base = "tools/$current_cpu/$tool_name" |
| } |
| |
| sdk_atom("${tool_name}_sdk") { |
| id = "sdk://$file_base" |
| category = "partner" |
| |
| meta = { |
| dest = "$file_base-meta.json" |
| schema = "host_tool" |
| value = { |
| type = "host_tool" |
| name = tool_name |
| root = "tools" |
| files = [ file_base ] |
| } |
| } |
| |
| files = [ |
| { |
| source = tool_src |
| dest = file_base |
| }, |
| ] |
| } |
| } |