编译 Rust EXE - 使用 vi.ico 图标,单文件,无控制台

This commit is contained in:
xiaji
2026-03-31 13:16:42 +08:00
parent 15e56120f4
commit 905e5b173f
3696 changed files with 4228 additions and 8382 deletions

19
push_screen_rust/build.rs Normal file
View File

@@ -0,0 +1,19 @@
use std::env;
fn main() {
let target = env::var("TARGET").unwrap();
let out_dir = env::var("OUT_DIR").unwrap();
// 只在 Windows 目标下链接资源文件
if target.contains("windows") {
// 使用已编译的 .res 文件
let res_path = std::path::Path::new("app.res");
if res_path.exists() {
println!("cargo:rustc-link-arg=app.res");
}
}
// 重新编译当资源文件变化时
println!("cargo:rerun-if-changed=app.rc");
println!("cargo:rerun-if-changed=vi.ico");
}