20 lines
556 B
Rust
20 lines
556 B
Rust
|
|
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");
|
||
|
|
}
|