use std::{env, path::PathBuf};

fn main() {
    let manifest_dir =
        PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR must be set"));
    let lib_dir = manifest_dir.join("lib");

    println!("cargo:rustc-link-search=native={}", lib_dir.display());
    println!("cargo:rerun-if-changed=build.rs");

    let open_lib = lib_dir.join("open.lib");
    if open_lib.exists() {
        println!("cargo:rerun-if-changed={}", open_lib.display());
    } else {
        println!(
            "cargo:warning=Expected to find open.lib in '{}'. Copy the vendor import library there.",
            lib_dir.display()
        );
    }
}
