blob: 525faa38d9fd1d2a2ba59f566f33620766a268a3 [file] [log] [blame]
# Copyright 2022 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/rust/rs_bindings_from_cc.gni")
import("//build/rust/rust_executable.gni")
rust_executable("test_rs_bindings_from_cc") {
crate_root = "main.rs"
sources = [ "main.rs" ]
deps = [
":self_contained_target_rs_api",
":target_depending_on_another_rs_api",
"//third_party/crubit:ctor",
]
build_native_rust_unit_tests = true
}
rs_bindings_from_cc("self_contained_target_rs_api") {
# This is the target that the bindings are for / call into.
bindings_target = ":self_contained_target"
# Lists public headers from `sources` of `self_contained_target`.
public_headers = [
"self_contained_target_header1.h",
"self_contained_target_header2.h",
]
}
source_set("self_contained_target") {
sources = [
"self_contained_target_header1.h",
"self_contained_target_header2.cc",
"self_contained_target_header2.h",
]
}
rs_bindings_from_cc("target_depending_on_another_rs_api") {
# This is the target that the bindings are for / call into.
bindings_target = ":target_depending_on_another"
# Lists public headers from `sources` of `target_depending_on_another`.
#
# TODO(crbug.com/1297592): Is there something we can do (a convention?) to
# avoid this duplication/repetition?
public_headers = [ "target_depending_on_another.h" ]
# Parallels `public_deps` of `target_depending_on_another`
#
# TODO(crbug.com/1297592): Is there something we can do (a convention?) to
# avoid this duplication/repetition?
deps = [ ":self_contained_target_rs_api" ]
}
source_set("target_depending_on_another") {
sources = [ "target_depending_on_another.h" ]
public_deps = [ ":self_contained_target" ]
}