windows: Support compiling with MinGW toolchain (#9815)
Fixes #9757: compile manifest using `embed-manifest` crate, which supports both MSVC and MinGW Release Notes: - N/A
This commit is contained in:
parent
35b39e02ce
commit
d77cda1ea9
3 changed files with 14 additions and 7 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -3293,6 +3293,12 @@ dependencies = [
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embed-manifest"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41cd446c890d6bed1d8b53acef5f240069ebef91d6fae7c5f52efe61fe8b5eae"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "emojis"
|
name = "emojis"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
|
@ -12506,6 +12512,7 @@ dependencies = [
|
||||||
"db",
|
"db",
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
"editor",
|
"editor",
|
||||||
|
"embed-manifest",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"extension",
|
"extension",
|
||||||
"extensions_ui",
|
"extensions_ui",
|
||||||
|
|
|
@ -91,6 +91,7 @@ workspace.workspace = true
|
||||||
zed_actions.workspace = true
|
zed_actions.workspace = true
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.build-dependencies]
|
[target.'cfg(target_os = "windows")'.build-dependencies]
|
||||||
|
embed-manifest = "1.4.0"
|
||||||
winresource = "0.1"
|
winresource = "0.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -46,19 +46,18 @@ fn main() {
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
// todo(windows): This is to avoid stack overflow. Remove it when solved.
|
if std::env::var("CARGO_CFG_TARGET_ENV").ok() == Some("msvc".to_string()) {
|
||||||
println!("cargo:rustc-link-arg=/stack:{}", 8 * 1024 * 1024);
|
// todo(windows): This is to avoid stack overflow. Remove it when solved.
|
||||||
|
println!("cargo:rustc-link-arg=/stack:{}", 8 * 1024 * 1024);
|
||||||
|
}
|
||||||
|
|
||||||
let manifest = std::path::Path::new("resources/windows/manifest.xml");
|
let manifest = std::path::Path::new("resources/windows/manifest.xml");
|
||||||
let icon = std::path::Path::new("resources/windows/app-icon.ico");
|
let icon = std::path::Path::new("resources/windows/app-icon.ico");
|
||||||
println!("cargo:rerun-if-changed={}", manifest.display());
|
println!("cargo:rerun-if-changed={}", manifest.display());
|
||||||
println!("cargo:rerun-if-changed={}", icon.display());
|
println!("cargo:rerun-if-changed={}", icon.display());
|
||||||
|
|
||||||
println!("cargo:rustc-link-arg-bins=/MANIFEST:EMBED");
|
embed_manifest::embed_manifest(embed_manifest::new_manifest(manifest.to_str().unwrap()))
|
||||||
println!(
|
.unwrap();
|
||||||
"cargo:rustc-link-arg-bins=/MANIFESTINPUT:{}",
|
|
||||||
manifest.canonicalize().unwrap().display()
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut res = winresource::WindowsResource::new();
|
let mut res = winresource::WindowsResource::new();
|
||||||
res.set_icon(icon.to_str().unwrap());
|
res.set_icon(icon.to_str().unwrap());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue