blob: deeada570d0928cd3bd47953e283cb3c551e3585 [file] [log] [blame]
# Copyright 2020 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/fidl/fidl.gni")
import("//build/go/go_library.gni")
import("//tools/fidl/gidl/gidl.gni")
import("benchmark_suite.gni")
fidl("benchmark_suite_fidl") {
testonly = true
name = "test.benchmarkfidl"
sources = benchmark_suite_fidl_files
public_deps = [ "//zircon/vdso/zx" ]
enable_hlcpp = true
contains_drivers = true
}
template("benchmark_fidl") {
library_name = "test.benchmarkfidl${invoker.fidl_library_suffix}"
copy_target = "${target_name}__copy_replace"
action_foreach(copy_target) {
script = "copy_replace_fidl_library.py"
sources = invoker.sources
outputs = [ "${target_gen_dir}/${library_name}_{{source_file_part}}" ]
args = [
"{{source}}",
"{{source_gen_dir}}/${library_name}_{{source_file_part}}",
library_name,
]
}
fidl(target_name) {
testonly = true
name = library_name
sources = get_target_outputs(":${copy_target}")
non_fidl_deps = [ ":${copy_target}" ]
public_deps = [ "//zircon/vdso/zx" ]
enable_hlcpp = true
disable_rustdoc = true
forward_variables_from(invoker, [ "contains_drivers" ])
}
}
if (current_toolchain != go_toolchain) {
seen = []
foreach(suite, benchmark_suites) {
# Only generate each FIDL library target once.
if (seen != seen + [ suite.fidl_target ] - [ suite.fidl_target ] +
[ suite.fidl_target ]) {
seen += [ suite.fidl_target ]
benchmark_fidl(get_label_info(suite.fidl_target, "name")) {
fidl_library_suffix = suite.fidl_library_suffix
sources = suite.fidl
forward_variables_from(suite, [ "contains_drivers" ])
}
}
}
}