xref: /aosp_15_r20/external/crosvm/media/libvda/build.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1*bb4ee6a4SAndroid Build Coastguard Worker // Copyright 2019 The ChromiumOS Authors
2*bb4ee6a4SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*bb4ee6a4SAndroid Build Coastguard Worker // found in the LICENSE file.
4*bb4ee6a4SAndroid Build Coastguard Worker 
main()5*bb4ee6a4SAndroid Build Coastguard Worker fn main() {
6*bb4ee6a4SAndroid Build Coastguard Worker     // libvda is only avalable on chromeos build.
7*bb4ee6a4SAndroid Build Coastguard Worker     // To enable clippy checks with this feature enabled upstream we will just skip
8*bb4ee6a4SAndroid Build Coastguard Worker     // linking the library, allowing the crate to be compiled, but not linked.
9*bb4ee6a4SAndroid Build Coastguard Worker     println!("cargo:rerun-if-env-changed=CROSVM_BUILD_VARIANT");
10*bb4ee6a4SAndroid Build Coastguard Worker     if std::env::var("CROSVM_BUILD_VARIANT").unwrap_or_default() == "chromeos" {
11*bb4ee6a4SAndroid Build Coastguard Worker         pkg_config::probe_library("libvda").unwrap();
12*bb4ee6a4SAndroid Build Coastguard Worker         println!("cargo:rustc-link-lib=dylib=vda");
13*bb4ee6a4SAndroid Build Coastguard Worker     }
14*bb4ee6a4SAndroid Build Coastguard Worker }
15