From 69c9d6c1d846d8dcae947fec5ad828b5abeff3c7 Mon Sep 17 00:00:00 2001 From: NewtonChutney <70827815+NewtonChutney@users.noreply.github.com> Date: Mon, 18 Dec 2023 00:39:11 +0530 Subject: [PATCH] alternate method of injecting the icon through a resource file, no extra deps --- Cargo.lock | 29 +++--------------- ...{helix-256p.ico => helix-icon-windows.lib} | Bin 10530 -> 10636 bytes contrib/helix-windows.rc | 1 + helix-term/Cargo.toml | 4 --- helix-term/build.rs | 6 +--- 5 files changed, 7 insertions(+), 33 deletions(-) rename contrib/{helix-256p.ico => helix-icon-windows.lib} (98%) create mode 100644 contrib/helix-windows.rc diff --git a/Cargo.lock b/Cargo.lock index 952e5a0f89834..f58ac4ff0f09e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1075,7 +1075,7 @@ dependencies = [ "smallvec", "smartstring", "textwrap", - "toml 0.7.6", + "toml", "tree-sitter", "unicode-general-category", "unicode-segmentation", @@ -1119,7 +1119,7 @@ dependencies = [ "serde", "tempfile", "threadpool", - "toml 0.7.6", + "toml", "tree-sitter", "which", ] @@ -1187,10 +1187,9 @@ dependencies = [ "tempfile", "tokio", "tokio-stream", - "toml 0.7.6", + "toml", "url", "which", - "winres", ] [[package]] @@ -1253,7 +1252,7 @@ dependencies = [ "slotmap", "tokio", "tokio-stream", - "toml 0.7.6", + "toml", "url", "which", ] @@ -2141,15 +2140,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "0.7.6" @@ -2610,15 +2600,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winres" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" -dependencies = [ - "toml 0.5.11", -] - [[package]] name = "xtask" version = "23.10.0" @@ -2627,7 +2608,7 @@ dependencies = [ "helix-loader", "helix-term", "helix-view", - "toml 0.7.6", + "toml", ] [[package]] diff --git a/contrib/helix-256p.ico b/contrib/helix-icon-windows.lib similarity index 98% rename from contrib/helix-256p.ico rename to contrib/helix-icon-windows.lib index f95d653c37aff729b4011322425642faa80ccdab..faaf44ee8705419114495113415863f861ed5f12 100644 GIT binary patch delta 135 zcmZ1!)DvvW00as^{Qo}$gZRjRM-wK`3{=AimJ$%)WC1fa3iE3^hya;7K>YtdAA=)9 i01$dII5YS&_<@x$Fc`p8gZYdM5HlEowt~!NWB>rj+7Rae delta 28 fcmeAPUKAwEz`zKEAi&6=z`&!)z#z8KmR}P9IphO- diff --git a/contrib/helix-windows.rc b/contrib/helix-windows.rc new file mode 100644 index 0000000000000..864aeba321fed --- /dev/null +++ b/contrib/helix-windows.rc @@ -0,0 +1 @@ +APPICON ICON helix256p.ico \ No newline at end of file diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index f9c2b9df03ba6..4ff7fc0b1798c 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -81,10 +81,6 @@ crossterm = { version = "0.27", features = ["event-stream", "use-dev-tty"] } [build-dependencies] helix-loader = { path = "../helix-loader" } -[target.'cfg(windows)'.build-dependencies] -# winres to inject icon into Windows binary -winres = "0.1.12" - [dev-dependencies] smallvec = "1.11" indoc = "2.0.4" diff --git a/helix-term/build.rs b/helix-term/build.rs index f805c6c345449..7986cf8260066 100644 --- a/helix-term/build.rs +++ b/helix-term/build.rs @@ -1,5 +1,3 @@ -extern crate winres; - use helix_loader::grammar::{build_grammars, fetch_grammars}; fn main() { @@ -9,8 +7,6 @@ fn main() { .expect("Failed to compile tree-sitter grammars"); } if cfg!(target_os = "windows") { - let mut res = winres::WindowsResource::new(); - res.set_icon("../contrib/helix-256p.ico"); - res.compile().unwrap(); + println!("cargo:rustc-link-lib=./contrib/helix-icon-windows"); } }