Windows no ARM build

This commit is contained in:
Владимир Борисов 2025-11-12 18:02:41 +02:00
parent 81fa5c902d
commit 53cfa3dc21
No known key found for this signature in database
GPG key ID: F9A584BE4FCB6603
15 changed files with 23 additions and 4 deletions

4
.cargo/config.toml Normal file
View file

@ -0,0 +1,4 @@
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "link-args=/LIBPATH:.\\mpv-x64"]
[target.aarch64-pc-windows-msvc]
rustflags = ["-C", "link-args=/LIBPATH:.\\mpv-arm64"]

View file

@ -1,5 +1,5 @@
use chrono::{Datelike, Local};
use std::{env, io::Cursor, path::PathBuf};
use std::{env, fs, io::Cursor, path::PathBuf};
extern crate winres;
fn main() {
@ -34,9 +34,15 @@ fn main() {
res.compile().unwrap();
//extract libmpv-2
println!("cargo:rerun-if-changed=libmpv-2.zip");
let target = std::env::var("TARGET").unwrap();
let archive = match target.as_str() {
"x86_64-pc-windows-msvc" => "libmpv-2_x64.zip",
"aarch64-pc-windows-msvc" => "libmpv-2_arm64.zip",
_ => panic!("Unsupported target {}", target),
};
println!("cargo:rerun-if-changed={}", archive);
{
let archive: Vec<u8> = include_bytes!("libmpv-2.zip").to_vec();
let archive = fs::read(archive).unwrap();
let target_dir = PathBuf::from(".");
zip_extract::extract(Cursor::new(archive), &target_dir, true).ok();
}

BIN
libmpv-2_arm64.zip Normal file

Binary file not shown.

BIN
mpv-arm64/libmpv-2.def Normal file

Binary file not shown.

BIN
mpv-arm64/libmpv-2.dll Normal file

Binary file not shown.

BIN
mpv-arm64/libmpv-2.exp Normal file

Binary file not shown.

BIN
mpv-arm64/mpv.lib Normal file

Binary file not shown.

View file

@ -1,3 +1,3 @@
[toolchain]
channel = "stable"
targets = ["x86_64-pc-windows-msvc"]
targets = ["aarch64-pc-windows-msvc", "x86_64-pc-windows-msvc"]

View file

@ -22,6 +22,8 @@ struct Opt {
help = "Start the app only in system tray and keep the window hidden"
)]
start_hidden: bool,
#[clap(long, help = "Do not show the splash image")]
no_splash: bool,
#[clap(long, help = "Enable dev tools when pressing F12")]
dev_tools: bool,
#[clap(long, help = "Disable the server and load the WebUI from localhost")]
@ -92,6 +94,7 @@ fn main() {
command,
commands_path: Some(commands_path),
webui_url,
no_splash: opt.no_splash,
dev_tools: opt.development || opt.dev_tools,
start_hidden: opt.start_hidden,
autoupdater_endpoint: opt.autoupdater_endpoint,

View file

@ -34,6 +34,7 @@ pub struct MainWindow {
pub command: String,
pub commands_path: Option<String>,
pub webui_url: String,
pub no_splash: bool,
pub dev_tools: bool,
pub start_hidden: bool,
pub autoupdater_endpoint: Option<Url>,
@ -135,6 +136,9 @@ impl MainWindow {
self.window.set_visible(!self.start_hidden);
self.tray.tray_show_hide.set_checked(!self.start_hidden);
if self.no_splash {
self.splash_screen.hide();
}
let player_channel = self.player.channel.borrow();
let (player_tx, player_rx) = player_channel

View file

@ -168,6 +168,8 @@ impl PartialUi for WebView {
window.qt={webChannelTransport:{send:window.chrome.webview.postMessage}};
window.chrome.webview.addEventListener('message',ev=>window.qt.webChannelTransport.onmessage(ev));
}}catch(e){}
window.addEventListener("load", function() {if(initShellComm) try { initShellComm() } catch(e) {}}, false)
"##, |_| Ok(())).expect("Cannot add script to webview");
Ok(())
}).expect("Cannot add content loading");