# windows: Automatically find Windows SDK when building gpui \(\#38711\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/769a8a650e18b93df93feb036c9a7f95ec1f701f)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 769a8a650e18b93df93feb036c9a7f95ec1f701f

Requested commit: 769a8a650e18b93df93feb036c9a7f95ec1f701f

Commit: 769a8a650e18b93df93feb036c9a7f95ec1f701f

Tree: 2fdf8325677a79266f6915e05599a59f9f945084

Author: Sergey Cherepanoff

Committer: GitHub

## Message

```
windows: Automatically find Windows SDK when building gpui (#38711)

### Summary

This PR changes `gpui/build.rs` to look up the Windows SDK directory in
the registry instead of falling back to a hard-coded path.

---

### Problem

Currently, building `gpui` on Windows requires `fxc.exe` to be in `PATH`
or at a predefined location (unless `GPUI_FXC_PATH` is set). This
requires to maintain a certain build environment with proper paths/vars
or to install the specific SDK version.

It is possible to find the SDK automatically using the registry keys it
creates upon installation. Specifically in
`SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0`
branch there are:
* `InstallationFolder` telling the SDK installation location;
* `ProductVersion` telling the SDK version in use.

These keys provide enough information to locate the SDK binaries, with
added robustness:
* handles non-standard SDK installation path;
* deterministically selects the latest SDK when multiple versions are
present.

---

### Changes Made

* **Updated `crates/gpui/build.rs`**:

  * added dependency on `winreg`
  * introduced `find_latest_windows_sdk_binary()` helper
  * updated fallback logic to use registry lookup

This PR only changes the fallback location, and does not touch the
established environment-based workflow.

Release Notes:

- N/A

---

### Impact

Reduces manual configuration needed to build GPUI on Windows.

---------

Co-authored-by: John Tur <john-tur@outlook.com>
```

## Parents

- [94ff4aa4b2b67aa1e6fd36b41a8101dc9b987196](https://git.cafe/gitcafe/zed/commit/94ff4aa4b2b67aa1e6fd36b41a8101dc9b987196?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/769a8a650e18b93df93feb036c9a7f95ec1f701f?format=markdown)
