feat(branding): add 3D shield logo, embed Windows PE icon, and update README banner
Sanctum Release / Build & Release (Windows x86_64) (push) Canceled after 0s
Sanctum Release / Build & Release (Windows x86_64) (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=assets/icon.ico");
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
||||
if target_os == "windows" {
|
||||
let out_dir = std::env::var("OUT_DIR").unwrap();
|
||||
let rc_path = format!("{}/sanctum.rc", out_dir);
|
||||
let res_path = format!("{}/sanctum.res", out_dir);
|
||||
|
||||
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let ico_path = format!("{}/assets/icon.ico", manifest_dir).replace('\\', "/");
|
||||
|
||||
if std::path::Path::new(&ico_path).exists() {
|
||||
let rc_content = format!("1 ICON \"{}\"\n", ico_path);
|
||||
if std::fs::write(&rc_path, rc_content).is_ok() {
|
||||
let status = std::process::Command::new("windres")
|
||||
.args(["-i", &rc_path, "-O", "coff", "-o", &res_path])
|
||||
.status();
|
||||
if let Ok(s) = status {
|
||||
if s.success() {
|
||||
println!("cargo:rustc-link-arg={}", res_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user