blob: 157a75e39a6434d80ddb9d589046a95dfb9bfd47 [file] [edit]
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_rust//rust:defs.bzl", "rust_binary")
load("//bazel:rust_api_from_cpp.bzl", "rust_api_from_cpp")
load(
"//rs_bindings_from_cc/test/golden:golden_test.bzl",
"golden_test",
)
licenses(["notice"])
cc_library(
name = "example_lib",
hdrs = ["example.h"],
# Opt into using Crubit.
aspect_hints = ["//features:supported"],
)
rust_api_from_cpp(
name = "example_lib_rust",
cpp_target = ":example_lib",
)
rust_binary(
name = "main",
srcs = ["main.rs"],
edition = "2024",
# Declare a dependency on Rust bindings for calling into the C++ `example_lib` library:
deps = [":example_lib_rust"],
)
# This test rule is just to make sure we don't forget to keep the `example_generated.rs` updated!
golden_test(
name = "example_golden_test",
cc_library = "example_lib",
golden_rs = "example_generated.rs",
)