diff --git a/Cargo.lock b/Cargo.lock index d358f28f84..52c2558ed4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3438,6 +3438,20 @@ dependencies = [ "zeroize", ] +[[package]] +name = "embed-resource" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6985554d0688b687c5cb73898a34fbe3ad6c24c58c238a4d91d5e840670ee9d" +dependencies = [ + "cc", + "memchr", + "rustc_version", + "toml 0.8.10", + "vswhom", + "winreg 0.52.0", +] + [[package]] name = "emojis" version = "0.6.1" @@ -4536,6 +4550,7 @@ dependencies = [ "cosmic-text", "ctor", "derive_more", + "embed-resource", "env_logger", "etagere", "filedescriptor", @@ -5959,9 +5974,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.3" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memfd" @@ -7970,7 +7985,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", + "winreg 0.50.0", ] [[package]] @@ -9499,7 +9514,6 @@ dependencies = [ "strum", "theme", "ui", - "winresource", ] [[package]] @@ -11133,6 +11147,26 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b17ae1f6c8a2b28506cd96d412eebf83b4a0ff2cbefeeb952f2f9dfa44ba18" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "vte" version = "0.13.0" @@ -12206,6 +12240,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "winresource" version = "0.1.17" diff --git a/crates/gpui/Cargo.toml b/crates/gpui/Cargo.toml index 9198c99b7e..eb259dd41c 100644 --- a/crates/gpui/Cargo.toml +++ b/crates/gpui/Cargo.toml @@ -120,6 +120,9 @@ xkbcommon = { version = "0.7", features = ["wayland", "x11"] } [target.'cfg(windows)'.dependencies] windows.workspace = true +[target.'cfg(windows)'.build-dependencies] +embed-resource = "2.4" + [[example]] name = "hello_world" path = "examples/hello_world.rs" diff --git a/crates/gpui/build.rs b/crates/gpui/build.rs index 1c87b391f6..f9f38b626e 100644 --- a/crates/gpui/build.rs +++ b/crates/gpui/build.rs @@ -6,6 +6,15 @@ fn main() { #[cfg(target_os = "macos")] macos::build(); + + #[cfg(target_os = "windows")] + { + let manifest = std::path::Path::new("resources/windows/gpui.manifest.xml"); + let rc_file = std::path::Path::new("resources/windows/gpui.rc"); + println!("cargo:rerun-if-changed={}", manifest.display()); + println!("cargo:rerun-if-changed={}", rc_file.display()); + embed_resource::compile(rc_file, embed_resource::NONE); + } } #[cfg(target_os = "macos")] diff --git a/crates/zed/resources/windows/manifest.xml b/crates/gpui/resources/windows/gpui.manifest.xml similarity index 100% rename from crates/zed/resources/windows/manifest.xml rename to crates/gpui/resources/windows/gpui.manifest.xml diff --git a/crates/gpui/resources/windows/gpui.rc b/crates/gpui/resources/windows/gpui.rc new file mode 100644 index 0000000000..a6f37877e8 --- /dev/null +++ b/crates/gpui/resources/windows/gpui.rc @@ -0,0 +1,2 @@ +#define RT_MANIFEST 24 +1 RT_MANIFEST "resources/windows/gpui.manifest.xml" \ No newline at end of file diff --git a/crates/storybook/Cargo.toml b/crates/storybook/Cargo.toml index b7fae8ebbc..1d7a828dd7 100644 --- a/crates/storybook/Cargo.toml +++ b/crates/storybook/Cargo.toml @@ -35,8 +35,5 @@ strum = { version = "0.25.0", features = ["derive"] } theme.workspace = true ui = { workspace = true, features = ["stories"] } -[target.'cfg(target_os = "windows")'.build-dependencies] -winresource = "0.1" - [dev-dependencies] gpui = { workspace = true, features = ["test-support"] } diff --git a/crates/storybook/build.rs b/crates/storybook/build.rs index d165aee5d5..4975cd33b7 100644 --- a/crates/storybook/build.rs +++ b/crates/storybook/build.rs @@ -9,16 +9,5 @@ fn main() { { println!("cargo:rustc-link-arg=/stack:{}", 8 * 1024 * 1024); } - - let manifest = std::path::Path::new("../zed/resources/windows/manifest.xml"); - println!("cargo:rerun-if-changed={}", manifest.display()); - - let mut res = winresource::WindowsResource::new(); - res.set_manifest_file(manifest.to_str().unwrap()); - - if let Err(e) = res.compile() { - eprintln!("{}", e); - std::process::exit(1); - } } } diff --git a/crates/zed/build.rs b/crates/zed/build.rs index a1126afed7..4a8f2c81fd 100644 --- a/crates/zed/build.rs +++ b/crates/zed/build.rs @@ -52,14 +52,11 @@ fn main() { println!("cargo:rustc-link-arg=/stack:{}", 8 * 1024 * 1024); } - let manifest = std::path::Path::new("resources/windows/manifest.xml"); let icon = std::path::Path::new("resources/windows/app-icon.ico"); - println!("cargo:rerun-if-changed={}", manifest.display()); println!("cargo:rerun-if-changed={}", icon.display()); let mut res = winresource::WindowsResource::new(); res.set_icon(icon.to_str().unwrap()); - res.set_manifest_file(manifest.to_str().unwrap()); if let Err(e) = res.compile() { eprintln!("{}", e);