blob: 6efd0d10f5abcaaacdb8a6590c66b5fb983fd9fe [file] [log] [blame] [edit]
# Copyright 2024 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/gn_internal/build_target.gni")
# Note: In general, prefer to import target_types.gni rather than this file.
#
# This template wraps a configurable target type specified by the current
# toolchain to be used for all pw_rust_bindgen targets. It wraps a creation of
# an action target `rust_bindgen_action.gni`.
#
# Args:
# cflags: C flags passed to bindgen.
#
# cflags_c: Suppliment C flags. Useful for override toolchain C flags.
#
# configs: Configs specify sets of compiler flags, includes, defines, etc
#
# deps: Dependencies for this target.
#
# header: C header file for generating bindings.
#
# libclang_path: Optional. Path to directory of libclang.so for bindgen to use.
# By default bindgen dynamically links to system wide libclang.
#
# public_deps: Public dependencies for this target. In addition to outputs from
# this target, outputs generated by public dependencies can be used as inputs
# from targets that depend on this one. This is not the case for private
# deps.
#
# public_configs: Configs to be applied on dependents.
#
# outputs: Output path of the generated rust bindings source file.
#
# visibility: GN visibility to apply to the underlying target.
#
# For more information on the features provided by this template, see the full
# docs at https://pigweed.dev/pw_build/?highlight=pw_rust_bindgen
_action_gni_path = get_path_info("rust_bindgen_action.gni", "abspath")
template("pw_rust_bindgen") {
pw_internal_build_target(target_name) {
forward_variables_from(invoker, "*")
target_type_file = _action_gni_path
underlying_target_type = "rust_bindgen_action"
add_global_link_deps = false
}
}