add icon on windows

This commit is contained in:
Crispy 2024-01-02 14:32:10 +01:00
parent 3bb155e728
commit dc6386d428
5 changed files with 39 additions and 10 deletions

10
Cargo.lock generated
View file

@ -774,6 +774,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"crossterm", "crossterm",
"rodio", "rodio",
"winres",
] ]
[[package]] [[package]]
@ -1082,3 +1083,12 @@ name = "windows_x86_64_msvc"
version = "0.42.1" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "winres"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c"
dependencies = [
"toml",
]

View file

@ -8,3 +8,6 @@ edition = "2021"
[dependencies] [dependencies]
crossterm = "0.25.0" crossterm = "0.25.0"
rodio = { version = "0.16.0", default_features = false, features = ["mp3"] } rodio = { version = "0.16.0", default_features = false, features = ["mp3"] }
[target.'cfg(windows)'.build-dependencies]
winres = "0.1.12"

15
build.rs Normal file
View file

@ -0,0 +1,15 @@
use std::io;
#[cfg(target_os = "windows")]
use winres::WindowsResource;
fn main() -> io::Result<()> {
#[cfg(target_os = "windows")]
{
WindowsResource::new().set_icon("icon.ico").compile()
}
#[cfg(not(target_os = "windows"))]
{
Ok(())
}
}

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

1
rustfmt.toml Normal file
View file

@ -0,0 +1 @@
hard_tabs = true