1# Copyright 2022 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 = [ 11 "lib.h", 12 "lib2.h", 13 ] 14} 15 16component("c_lib") { 17 sources = [ "lib.c" ] 18 19 deps = [ ":c_lib_headers" ] 20 21 defines = [ "COMPONENT_IMPLEMENTATION" ] 22} 23 24rust_bindgen("c_lib_bindgen") { 25 header = "lib.h" 26 deps = [ ":c_lib_headers" ] 27} 28 29rust_static_library("bindgen_test_lib") { 30 allow_unsafe = true 31 deps = [ 32 ":c_lib", 33 ":c_lib_bindgen", 34 ] 35 sources = [ "src/lib.rs" ] 36 build_native_rust_unit_tests = true 37 crate_root = "src/lib.rs" 38} 39 40rust_executable("bindgen_test") { 41 deps = [ ":bindgen_test_lib" ] 42 sources = [ "main.rs" ] 43 crate_root = "main.rs" 44} 45