crosvm/media/ffmpeg/build.rs
Dennis Kempin acc162000f Add conditional compilation for unix-only crates
Instead of configuring which crates to --exclude in
test_config.py, we can use conditional compilation to
exclude code that is not supported on windows.

This allows more fine-grained control and also allows
us to use plain cargo for building without complicated
configuration and exclusions.

BUG=b:265829867
TEST=cargo test --lib --bins --workspace
	--target=x86_64-pc-windows-gnu
	--features=all-mingw64

Change-Id: I8422c3f08053bc27d9896b220876a56bd25543d6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4165868
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-01-19 21:21:59 +00:00

31 lines
823 B
Rust

// Copyright 2022 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use pkg_config::Config;
fn main() {
// Skip building dependencies when generating documents.
if std::env::var("CARGO_DOC").is_ok() {
return;
}
// ffmpeg is currently only supported on unix
if std::env::var("CARGO_CFG_UNIX").is_err() {
return;
}
// Match all ffmpeg 5.0 versions with which our generated bindings are compatible.
Config::new()
.range_version("59".."60")
.probe("libavcodec")
.unwrap();
Config::new()
.range_version("57".."58")
.probe("libavutil")
.unwrap();
Config::new()
.range_version("6".."7")
.probe("libswscale")
.unwrap();
}