crosvm/crosvm_control/build.rs
Anton Romanov c79d5f838c crosvm: crosvm_control: use OUT_DIR instead of CARGO_TARGET_DIR in build script
CARGO_TARGET_DIR is not meant to be used in build scripts as that is an
optional variable that *may* be passed to cargo. The one that is set by
cargo itself is OUT_DIR and is always present to specify where build
scripts are expected to place output

BUG=none
TEST=cq

Change-Id: I118eebf914dbefd93f2cafb6950c7a6b4c01c574
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3598239
Auto-Submit: Anton Romanov <romanton@google.com>
Reviewed-by: Kameron Lutes <kalutes@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-04-20 23:05:48 +00:00

21 lines
591 B
Rust

// Copyright 2022 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
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("OUT_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);
}