use std::env;

fn main() {
    println!("cargo:rerun-if-changed=build.rs");
    let target = env::var("TARGET").expect("Cargo provides TARGET");
    if target.contains("msvc") {
        vcpkg::Config::new()
            .find_package("opus")
            .expect("WebRTC voice requires libopus 1.3 or newer from vcpkg");
    } else {
        pkg_config::Config::new()
            .atleast_version("1.3")
            .probe("opus")
            .expect("WebRTC voice requires pkg-config and libopus 1.3 or newer");
    }
}
