From 3c5d2a008dc81bcdbc22e414dbf31de6c760c589 Mon Sep 17 00:00:00 2001 From: LinkChou Date: Sat, 24 Feb 2024 15:34:38 +0800 Subject: [PATCH 1/2] add version info and etc. --- Cargo.toml | 4 ++++ build.rs | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 55ae841..cf5d716 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,10 @@ build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[package.metadata.winres] +LegalCopyright = "Copyright Alex-Beng © 2024" +FileDescription = "Yap for Genshin" + [dependencies] image = "0.24.6" imageproc = "0.23.0" diff --git a/build.rs b/build.rs index 97c8a60..c883a2f 100644 --- a/build.rs +++ b/build.rs @@ -5,10 +5,7 @@ fn main() { if std::env::var("CARGO_CFG_TARGET_OS").unwrap() != "windows" { return; } - - // only build the resource for release builds - // as calling rc.exe might be slow - // if std::env::var("PROFILE").unwrap() == "release" { + let mut res = winres::WindowsResource::new(); // if cfg!(unix) { // // paths for X64 on archlinux @@ -19,12 +16,16 @@ fn main() { // res.set_windres_path("/usr/bin/x86_64-w64-mingw32-windres"); // } - res - // .set_icon("icon.ico") - // can't use winapi crate constants for cross compiling - // MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US ) - // .set_language(0x0409) + let mut version = 0 as u64; + version |= 0 << 48; + version |= 2 << 32; + version |= 2 << 16; + version |= 0; + + res.set_version_info(VersionInfo::FILEVERSION, version) + .set_version_info(VersionInfo::PRODUCTVERSION, version) .set_manifest_file("manifest.xml"); + if let Err(e) = res.compile() { eprintln!("{}", e); std::process::exit(1); From 8cd10f46a893b0ea176c72374a42df8b4ffb41b2 Mon Sep 17 00:00:00 2001 From: LinkChou Date: Sat, 24 Feb 2024 15:35:08 +0800 Subject: [PATCH 2/2] correct some --- build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/build.rs b/build.rs index c883a2f..747ce10 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,5 @@ extern crate winres; +use winres::VersionInfo; fn main() { // only run if target os is windows