crosvm/media/libvda/build.rs
Dennis Kempin 278e5ffeba test_runner: Add separate cargo target dir for each platform
Using the same CARGO_TARGET_DIR for all builds prevents us from
building for platforms in parallel, since cargo will lock the
directory to only run one build at a time.

Use the same directory for clippy as well, and ensure that
clippy won't invalidate caches created by run_tests.

This reduces the build time for tools/presubmit by about 50%.

Another advantage is that rust_analyzer and run_tests will no longer
block each other or invalidate the cache when run with different
feature flags.

Note: This introduces two subtle changes to the build that required nit
fixes:
- build.rs files are now run through clippy as well
- common/* crates are now also built for the target architecture instead
  the host.

BUG=None
TEST=tools/presubmit

Change-Id: I8da9ef53418c0b15827d512a04e77828621aef88
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3984416
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-31 21:33:33 +00:00

14 lines
631 B
Rust

// Copyright 2019 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
fn main() {
// libvda is only avalable on chromeos build.
// To enable clippy checks with this feature enabled upstream we will just skip
// linking the library, allowing the crate to be compiled, but not linked.
println!("cargo:rerun-if-env-changed=CROSVM_BUILD_VARIANT");
if std::env::var("CROSVM_BUILD_VARIANT").unwrap_or_default() == "chromeos" {
pkg_config::probe_library("libvda").unwrap();
println!("cargo:rustc-link-lib=dylib=vda");
}
}