编译 Rust EXE - 使用 vi.ico 图标,单文件,无控制台
This commit is contained in:
19
push_screen_rust/build.rs
Normal file
19
push_screen_rust/build.rs
Normal 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");
|
||||
}
|
||||
Reference in New Issue
Block a user