blob: cffcdec280d38403fd9c11c2fd2394247d61cb05 [file] [log] [blame]
# 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/sdk/sdk_atom.gni")
# An executable which can be bundled in an SDK.
#
# An equivalent to the built-in executable which adds an SDK atom declaration to
# allow the resulting binary to be included in an SDK.
#
# category (required)
# Publication level of the library in SDKs.
# See //build/sdk/sdk_atom.gni.
template("sdk_executable") {
assert(defined(invoker.category), "Must define an SDK category")
main_target_name = target_name
executable(main_target_name) {
forward_variables_from(invoker, "*", [
"category",
])
}
output_name = target_name
if (defined(invoker.output_name)) {
output_name = invoker.output_name
}
if (!is_fuchsia) {
file_base = "tools/$output_name"
sdk_atom("${target_name}_sdk") {
domain = "exe"
name = output_name
id = "sdk://tools/$output_name"
category = invoker.category
meta = {
dest = "$file_base-meta.json"
schema = "host_tool"
value = {
type = "host_tool"
name = output_name
root = "tools"
files = [
file_base,
]
}
}
tags = [ "arch:host" ]
files = [
{
source = "$root_out_dir/$output_name"
dest = output_name
},
]
new_files = [
{
source = "$root_out_dir/$output_name"
dest = file_base
}
]
non_sdk_deps = [ ":$main_target_name" ]
}
}
}