49 lines
1.0 KiB
Plaintext
49 lines
1.0 KiB
Plaintext
# 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/rust_bindgen.gni")
|
|
import("//build/rust/rust_executable.gni")
|
|
import("//build/rust/rust_static_library.gni")
|
|
|
|
source_set("c_lib_headers") {
|
|
sources = [
|
|
"lib.h",
|
|
"lib2.h",
|
|
]
|
|
}
|
|
|
|
component("c_lib") {
|
|
sources = [ "lib.c" ]
|
|
|
|
deps = [ ":c_lib_headers" ]
|
|
|
|
defines = [ "COMPONENT_IMPLEMENTATION" ]
|
|
}
|
|
|
|
rust_bindgen("c_lib_bindgen") {
|
|
header = "lib.h"
|
|
deps = [ ":c_lib_headers" ]
|
|
}
|
|
|
|
rust_static_library("bindgen_test_lib") {
|
|
allow_unsafe = true
|
|
deps = [
|
|
":c_lib",
|
|
":c_lib_bindgen",
|
|
]
|
|
sources = [ "src/lib.rs" ]
|
|
build_native_rust_unit_tests = true
|
|
crate_root = "src/lib.rs"
|
|
|
|
bindgen_output = get_target_outputs(":c_lib_bindgen")
|
|
inputs = bindgen_output
|
|
rustenv = [ "BINDGEN_RS_FILE=" + rebase_path(bindgen_output[0]) ]
|
|
}
|
|
|
|
rust_executable("bindgen_test") {
|
|
deps = [ ":bindgen_test_lib" ]
|
|
sources = [ "main.rs" ]
|
|
crate_root = "main.rs"
|
|
}
|