fn main() {
println!("cargo:rerun-if-changed=build.rs");
if std::env::var_os("CARGO_FEATURE_LIBASS_COMPARE").is_none() {
return;
}
link_libass();
}
#[cfg(target_os = "windows")]
fn link_libass() {
match vcpkg::Config::new().find_package("libass") {
Ok(_) => {}
Err(e) => panic!(
"libass-compare: vcpkg could not find libass ({e}).\n\
Install it with `vcpkg install libass:x64-windows-static-md` and set \
VCPKG_ROOT, or build without the libass-compare feature."
),
}
for lib in ["gdi32", "user32", "dwrite", "ole32", "oleaut32"] {
println!("cargo:rustc-link-lib=dylib={lib}");
}
}
#[cfg(not(target_os = "windows"))]
fn link_libass() {
match pkg_config::Config::new().probe("libass") {
Ok(_) => {}
Err(e) => panic!(
"libass-compare: pkg-config could not find libass ({e}).\n\
Install libass-dev (Linux) / libass (brew) or set PKG_CONFIG_PATH, \
or build without the libass-compare feature."
),
}
}