crosvm/crosvm_control/build.rs
Kameron Lutes 1904e141b7 Reland "crosvm_control: Generate C header during build"
This is a reland of commit 06fca32aff

Original change's description:
> crosvm_control: Generate C header during build
>
> Generates a C header for the crosvm_control library during crosvm build.
>
> BUG=b:188858559
> TEST=cq
>
> Cq-Depend: chromium:3553666
> Change-Id: Ic6d57d654f546a4ddf9facad16d29a03c103ebbe
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553761
> Reviewed-by: Dennis Kempin <denniskempin@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Kameron Lutes <kalutes@chromium.org>

Bug: b:188858559
Change-Id: I041cf6452ecec2d3ef9581b07ee0c457ba81cf98
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3593855
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-04-20 18:29:20 +00:00

19 lines
455 B
Rust

extern crate cbindgen;
use std::env;
use std::path::PathBuf;
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let output_file = PathBuf::from(env::var("CARGO_TARGET_DIR").unwrap())
.join("crosvm_control.h")
.display()
.to_string();
cbindgen::Builder::new()
.with_crate(crate_dir)
.generate()
.expect("Unable to generate bindings")
.write_to_file(&output_file);
}