Use favicon + winres when building target artifact

This commit is contained in:
James 2018-08-03 22:21:34 +10:00
parent 09406d40e2
commit bf2ce22de6
8 changed files with 39 additions and 2 deletions

10
Cargo.lock generated
View File

@ -306,6 +306,7 @@ dependencies = [
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"web-view 0.2.1 (git+https://github.com/Boscop/web-view.git?rev=555f422d09cbb94e82a728d47e9e07ca91963f6e)", "web-view 0.2.1 (git+https://github.com/Boscop/web-view.git?rev=555f422d09cbb94e82a728d47e9e07ca91963f6e)",
"winres 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"zip 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1029,6 +1030,14 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winres"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ws2_32-sys" name = "ws2_32-sys"
version = "0.2.1" version = "0.2.1"
@ -1176,5 +1185,6 @@ dependencies = [
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum winres 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f07dabda4e79413ecac65bc9a2234ad3d85dc49f9d289f868cd9d8611d88f28d"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
"checksum zip 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "e7341988e4535c60882d5e5f0b7ad0a9a56b080ade8bdb5527cb512f7b2180e0" "checksum zip 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "e7341988e4535c60882d5e5f0b7ad0a9a56b080ade8bdb5527cb512f7b2180e0"

View File

@ -5,6 +5,11 @@ authors = ["James <jselby@jselby.net>"]
repository = "https://github.com/j-selby/liftinstall.git" repository = "https://github.com/j-selby/liftinstall.git"
documentation = "https://liftinstall.jselby.net" documentation = "https://liftinstall.jselby.net"
description = "An adaptable installer for your application." description = "An adaptable installer for your application."
build = "build.rs"
[package.metadata.winres]
ProductName = "yuzu Installer"
FileDescription = "An interactive installer for yuzu"
[dependencies] [dependencies]
web-view = {git = "https://github.com/Boscop/web-view.git", rev = "555f422d09cbb94e82a728d47e9e07ca91963f6e"} web-view = {git = "https://github.com/Boscop/web-view.git", rev = "555f422d09cbb94e82a728d47e9e07ca91963f6e"}
@ -31,3 +36,6 @@ zip = "0.2.8"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
# NFD is needed on Windows, as web-view doesn't work correctly here # NFD is needed on Windows, as web-view doesn't work correctly here
nfd = "0.0.4" nfd = "0.0.4"
[target.'cfg(windows)'.build-dependencies]
winres = "0.1"

View File

@ -17,7 +17,10 @@ This is designed to be a more modern interpretation of Qt's Installer Framework,
Building Building
-------- --------
Add your logo to `static/img/logo.png`, modify the configuration file, then run: - Add your favicon to `static/favicon.ico`
- Modify the configuration file as needed
- Tweak `package.metadata.winres` metadata in `Cargo.toml`
- Run:
```bash ```bash
cargo build --release cargo build --release

13
build.rs Normal file
View File

@ -0,0 +1,13 @@
#[cfg(windows)]
extern crate winres;
#[cfg(windows)]
fn main() {
let mut res = winres::WindowsResource::new();
res.set_icon("static/favicon.ico");
res.compile().unwrap();
}
#[cfg(not(windows))]
fn main() {
}

View File

@ -33,9 +33,9 @@ pub fn file_from_string(file_path: &str) -> Option<(String, &'static [u8])> {
let contents = include_files_as_assets!( let contents = include_files_as_assets!(
file_path, file_path,
"/index.html", "/index.html",
"/favicon.ico",
"/css/bulma.min.css", "/css/bulma.min.css",
"/css/main.css", "/css/main.css",
"/img/logo.png",
"/js/helpers.js", "/js/helpers.js",
"/js/vue.min.js" "/js/vue.min.js"
)?; )?;

BIN
static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -7,6 +7,9 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>yuzu Installer</title> <title>yuzu Installer</title>
<link rel="icon" href="/favicon.ico" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="/css/bulma.min.css" type="text/css"> <link rel="stylesheet" href="/css/bulma.min.css" type="text/css">
<link rel="stylesheet" href="/css/main.css" type="text/css"> <link rel="stylesheet" href="/css/main.css" type="text/css">
</head> </head>