use chrono::{Datelike, Local}; use std::{env, fs, io::Cursor, path::PathBuf}; extern crate winres; fn main() { let now = Local::now(); let copyright = format!("Copyright © {} Smart Code OOD", now.year()); let exe_name = format!("{}.exe", env::var("CARGO_PKG_NAME").unwrap()); let mut res = winres::WindowsResource::new(); res.set_manifest( r#" "#, ); res.set("FileDescription", "Freedom to Stream"); res.set("LegalCopyright", ©right); res.set("OriginalFilename", &exe_name); res.set_icon_with_id("images/stremio.ico", "MAINICON"); res.append_rc_content(r##"SPLASHIMAGE IMAGE "images/stremio.png""##); res.compile().unwrap(); //extract libmpv-2 let target = std::env::var("TARGET").unwrap(); let (arch, archive, flags) = match target.as_str() { "x86_64-pc-windows-msvc" => ("x64", "libmpv-2_x64.zip", "/LIBPATH:.\\mpv-x64"), "aarch64-pc-windows-msvc" => ("arm64", "libmpv-2_arm64.zip", "/LIBPATH:.\\mpv-arm64"), _ => panic!("Unsupported target {}", target), }; println!("cargo:rustc-env=ARCH={}", arch); println!("cargo:rustc-link-arg={}", flags); let archive = fs::read(archive).unwrap(); let target_dir = PathBuf::from("."); zip_extract::extract(Cursor::new(archive), &target_dir, true).ok(); }