ci(release): migrate release workflow to ubuntu-latest with cargo-zigbuild cross-compilation
This commit is contained in:
1 parent
d93b03322e
commit
a84b2ccf9f
3 files changed
+159
-114
No files matched your search
@@ -14,14 +14,34 @@ fn main() {
|
||||
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);
|
||||
let mut compiled = false;
|
||||
|
||||
for tool in ["windres", "x86_64-w64-mingw32-windres"] {
|
||||
if let Ok(s) = std::process::Command::new(tool)
|
||||
.args(["-i", &rc_path, "-O", "coff", "-o", &res_path])
|
||||
.status()
|
||||
{
|
||||
if s.success() {
|
||||
compiled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !compiled {
|
||||
if let Ok(s) = std::process::Command::new("zig")
|
||||
.args(["rc", "--", &rc_path, &res_path])
|
||||
.status()
|
||||
{
|
||||
if s.success() {
|
||||
compiled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if compiled {
|
||||
println!("cargo:rustc-link-arg={}", res_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user