use std::path::PathBuf; fn main() { link_windows_libmpv(); tauri_build::build() } /// Point the MSVC linker at `mpv.lib` for a Windows target. /// /// `libmpv-sys` emits `rustc-link-lib=mpv` and nothing else; on Linux the /// system library satisfies it. For Windows the import library and the DLL it /// names are staged into `src-tauri/windows-libs/` by /// `scripts/build-windows-cross.sh` from the builder image's pinned libmpv /// build — the same directory `tauri.windows.conf.json` bundles the DLL from, /// so what is linked against and what is shipped cannot come from two places. /// /// TRACES: UR-004 | DR-237 fn link_windows_libmpv() { if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") { return; } let dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()).join("windows-libs"); println!("cargo:rerun-if-changed={}", dir.join("mpv.lib").display()); if !dir.join("mpv.lib").is_file() { panic!( "{} is missing. Windows builds link libmpv from the builder image; \ build through scripts/build-windows-cross.sh, which stages it.", dir.join("mpv.lib").display() ); } println!("cargo:rustc-link-search=native={}", dir.display()); }