• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/rust/rust_bindgen.gni")
6import("//build/rust/rust_executable.gni")
7import("//build/rust/rust_static_library.gni")
8
9source_set("c_lib_headers") {
10  sources = [ "lib.h" ]
11}
12
13component("c_lib") {
14  sources = [ "lib.c" ]
15
16  deps = [ ":c_lib_headers" ]
17
18  defines = [ "COMPONENT_IMPLEMENTATION" ]
19}
20
21rust_bindgen("c_lib_bindgen") {
22  header = "lib.h"
23  deps = [ ":c_lib_headers" ]
24  wrap_static_fns = true
25}
26
27rust_static_library("bindgen_static_fns_test_lib") {
28  allow_unsafe = true
29  deps = [
30    ":c_lib",
31    ":c_lib_bindgen",
32  ]
33  sources = [ "src/lib.rs" ]
34  build_native_rust_unit_tests = true
35  crate_root = "src/lib.rs"
36}
37
38rust_executable("bindgen_static_fns_test") {
39  deps = [ ":bindgen_static_fns_test_lib" ]
40  sources = [ "main.rs" ]
41  crate_root = "main.rs"
42}
43