| # 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("//build/rust/fidl_rust_library.gni") |
| import("//build/rust/toolchain.gni") |
| import("//src/tests/benchmarks/fidl/benchmark_suite/benchmark_suite.gni") |
| import("//tools/fidl/gidl/gidl.gni") |
| |
| fidl("benchmark_suite_fidl") { |
| testonly = true |
| name = "benchmarkfidl" |
| sources = benchmark_suite_fidl_files |
| public_deps = [ "//zircon/vdso/zx" ] |
| } |
| |
| template("benchmark_fidl") { |
| library_name = "benchmarkfidl${invoker.fidl_library_suffix}" |
| |
| copy_target = "${target_name}__copy_replace" |
| |
| action_foreach(copy_target) { |
| hermetic_deps = false |
| script = "copy_replace_fidl_library.py" |
| |
| sources = invoker.sources |
| outputs = [ "{{source_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" ] |
| } |
| } |
| |
| 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 |
| } |
| } |
| } |
| } |