BUILD.gn (917B)
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 5 import("//chromium/build/rust/rust_bindgen.gni") 6 import("//chromium/build/rust/rust_executable.gni") 7 import("//chromium/build/rust/rust_static_library.gni") 8 9 source_set("c_lib_headers") { 10 sources = [ 11 "lib.h", 12 "lib2.h", 13 ] 14 } 15 16 component("c_lib") { 17 sources = [ "lib.c" ] 18 19 deps = [ ":c_lib_headers" ] 20 21 defines = [ "COMPONENT_IMPLEMENTATION" ] 22 } 23 24 rust_bindgen("c_lib_bindgen") { 25 header = "lib.h" 26 deps = [ ":c_lib_headers" ] 27 } 28 29 rust_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 40 rust_executable("bindgen_test") { 41 deps = [ ":bindgen_test_lib" ] 42 sources = [ "main.rs" ] 43 crate_root = "main.rs" 44 }