1# Copyright 2024 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/gn_internal/build_target.gni") 18 19# Note: In general, prefer to import target_types.gni rather than this file. 20# 21# This template wraps a configurable target type specified by the current 22# toolchain to be used for all pw_rust_bindgen targets. It wraps a creation of 23# an action target `rust_bindgen_action.gni`. 24# 25# Args: 26# deps: Dependencies for this target. 27# 28# public_deps: Public dependencies for this target. In addition to outputs from 29# this target, outputs generated by public dependencies can be used as inputs 30# from targets that depend on this one. This is not the case for private 31# deps. 32# 33# visibility: GN visibility to apply to the underlying target. 34# 35# header: C header file for generating bindings. 36# 37# outputs: Output path of the generated rust bindings source file. 38# 39# flags: Additional flags passed to bindgen executable. 40# 41# For more information on the features provided by this template, see the full 42# docs at https://pigweed.dev/pw_build/?highlight=pw_rust_bindgen 43 44_action_gni_path = get_path_info("rust_bindgen_action.gni", "abspath") 45 46template("pw_rust_bindgen") { 47 pw_internal_build_target(target_name) { 48 forward_variables_from(invoker, "*") 49 50 target_type_file = _action_gni_path 51 underlying_target_type = "rust_bindgen_action" 52 add_global_link_deps = false 53 } 54} 55