blob: 978d0f19ecdb2f9931792d2bd9a8016cd0d27530 [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
}
sdk_atom("${target_name}_sdk") {
domain = "exe"
name = output_name
category = invoker.category
if (is_fuchsia) {
tags = [ "arch:target" ]
} else {
tags = [ "arch:host" ]
}
files = [
{
source = "$root_out_dir/$output_name"
dest = output_name
},
]
non_sdk_deps = [ ":$main_target_name" ]
}
}