embed icon into OutFly.exe

This commit is contained in:
yuni 2024-04-19 23:47:40 +02:00
parent 6a1dadfd3a
commit cf71a23aec
5 changed files with 66 additions and 3 deletions

52
Cargo.lock generated
View file

@ -1600,6 +1600,19 @@ version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]]
name = "embed-resource"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e62abb876c07e4754fae5c14cafa77937841f01740637e17d78dc04352f32a5e"
dependencies = [
"cc",
"rustc_version",
"toml",
"vswhom",
"winreg",
]
[[package]] [[package]]
name = "encase" name = "encase"
version = "0.7.0" version = "0.7.0"
@ -2774,6 +2787,7 @@ dependencies = [
"bevy", "bevy",
"bevy_embedded_assets", "bevy_embedded_assets",
"bevy_xpbd_3d", "bevy_xpbd_3d",
"embed-resource",
"fastrand", "fastrand",
"regex", "regex",
"serde", "serde",
@ -3542,6 +3556,15 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "toml"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "0.6.5" version = "0.6.5"
@ -3716,6 +3739,26 @@ version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "vswhom"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b"
dependencies = [
"libc",
"vswhom-sys",
]
[[package]]
name = "vswhom-sys"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3b17ae1f6c8a2b28506cd96d412eebf83b4a0ff2cbefeeb952f2f9dfa44ba18"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.5.0" version = "2.5.0"
@ -4416,6 +4459,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "x11-dl" name = "x11-dl"
version = "2.21.0" version = "2.21.0"

View file

@ -8,6 +8,7 @@ categories = ["game", "aerospace", "simulation"]
keywords = ["game", "space", "3d"] keywords = ["game", "space", "3d"]
license = "GPL-3.0-only" license = "GPL-3.0-only"
rust-version = "1.76.0" rust-version = "1.76.0"
build = "build/build.rs"
[dependencies] [dependencies]
regex = "1" regex = "1"
@ -18,6 +19,9 @@ fastrand = "2.0"
serde = "1.0" serde = "1.0"
serde_yaml = "0.9" serde_yaml = "0.9"
[build-dependencies]
embed-resource = "1.6.3" # embedding of .exe metadata
[features] [features]
default = ["x11"] default = ["x11"]
dev = ["bevy/dynamic_linking", "bevy/file_watcher"] dev = ["bevy/dynamic_linking", "bevy/file_watcher"]

7
build/build.rs Normal file
View file

@ -0,0 +1,7 @@
fn main() {
let target = std::env::var("TARGET").unwrap();
if target.contains("windows") {
println!("cargo:warning=Embedding Windows Icon");
embed_resource::compile("build/windows/icon.rc");
}
}

View file

@ -21,10 +21,10 @@ SRCPATH="outfly_v$VERSION"
mkdir "$SRCPATH" mkdir "$SRCPATH"
cp ../README.md "$SRCPATH" cp ../README.md "$SRCPATH"
cp ../target/x86_64-pc-windows-gnu/release/outfly.exe "$SRCPATH" cp ../target/x86_64-pc-windows-gnu/release/outfly.exe "$SRCPATH"/OutFly.exe
zip -v -r -9 ../"outfly_v${VERSION}_windows.zip" "$SRCPATH" zip -v -r -9 ../"outfly_v${VERSION}_windows.zip" "$SRCPATH"
rm "$SRCPATH"/outfly.exe rm "$SRCPATH"/OutFly.exe
cp ../target/x86_64-unknown-linux-gnu/release/outfly "$SRCPATH" cp ../target/x86_64-unknown-linux-gnu/release/outfly "$SRCPATH"
zip -v -r -9 ../"outfly_v${VERSION}_linux.zip" "$SRCPATH" zip -v -r -9 ../"outfly_v${VERSION}_linux.zip" "$SRCPATH"

View file

@ -1 +1 @@
app_icon ICON "icon.ico" app_icon ICON "outfly.ico"