Skip to content

Commit

Permalink
alternate method of injecting the icon through a resource file, no ex…
Browse files Browse the repository at this point in the history
…tra deps
  • Loading branch information
NewtonChutney committed Dec 25, 2023
1 parent 3aaa895 commit f545704
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 33 deletions.
29 changes: 5 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
4 changes: 0 additions & 4 deletions helix-term/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 8 additions & 5 deletions helix-term/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate winres;

use helix_loader::grammar::{build_grammars, fetch_grammars};

fn main() {
Expand All @@ -8,9 +6,14 @@ fn main() {
build_grammars(Some(std::env::var("TARGET").unwrap()))
.expect("Failed to compile tree-sitter grammars");
}

// link icon to windows executable
if cfg!(target_os = "windows") {
let mut res = winres::WindowsResource::new();
res.set_icon("../contrib/helix-256p.ico");
res.compile().unwrap();
// fetch manifest dir from env var set by Cargo:
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR should be set by Cargo");

// link against the helix-icon-windows library from contrib dir:
println!("cargo:rustc-link-search=native={}", manifest_dir.replace("helix-term", "contrib"));
println!("cargo:rustc-link-lib=dylib=helix-icon-windows");
}
}

0 comments on commit f545704

Please sign in to comment.