build: Add support for Visual Studio 2022 and VC143 DLLs (#31148)

* build: Add support for Visual Studio 2022 and VC143 DLLs

This change adds supports fot Visual Studio 2022 and the VC143 (current)
version of the Visual Studio CRT. In addition, it reworks the way that
Visual Studio is found, returning all installations in a generator,
separately finding it via vswhere.exe, searching paths, and via
environment variables.

All of these installations are searched for the DLLs with highest
priority given to the highest version of MS Visual Studio installed. The
hope is that this makes the process more robust and properly handles
having multiple versions installed, but only one with the correct
runtime DLLs.

* Update based on review comments

Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Martin Robinson 2024-01-23 12:04:01 +01:00 committed by GitHub
parent 45af1198aa
commit dc2df7b027
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 165 additions and 135 deletions

View file

@ -41,14 +41,21 @@ manually, try the [manual build setup][manual-build].
### Windows
- Download and run [`rustup-init.exe`](https://win.rustup.rs/) then follow the onscreen instructions.
- Download and run [`rustup-init.exe`](https://win.rustup.rs/)
- Make sure to select *Quick install via the Visual Studio Community
installer* or otherwise install Visual Studio 2022.
- In the *Visual Studio Installer* ensure the following components are installed for Visual Studio 2022:
- **Windows 10 SDK (10.0.19041.0)** (`Microsoft.VisualStudio.Component.Windows10SDK.19041`)
- **MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)** (`Microsoft.VisualStudio.Component.VC.Tools.x86.x64`)
- **C++ ATL for latest v143 build tools (x86 & x64)** (`Microsoft.VisualStudio.Component.VC.ATL`)
- **C++ MFC for latest v143 build tools (x86 & x64)** (`Microsoft.VisualStudio.Component.VC.ATLMFC`)
- Install [chocolatey](https://chocolatey.org/)
- Install [Python 3.11](https://apps.microsoft.com/detail/9NRWMJP3717K?hl=en-US&gl=US)
- Install [Python 3.11](https://www.python.org/downloads/windows/)
- Run `mach bootstrap`
- *This will install CMake, Git, Ninja, and the Visual Studio 2019 Build Tools
via choco in an Administrator console. It can take quite a while.*
- *If you already have Visual Studio 2019 installed, this may not install all necessary components.
Please follow the Visual Studio 2019 installation instructions in the [manual setup][manual-build].*
- *This will install CMake, Git, Ninja, via choco in an
+ *This will install CMake, Git, and Ninja via choco in an
Administrator console. Allow the scripts to run and once
the operation finishes, close the new console.*
- Run `refreshenv`
See also [Windows Troubleshooting Tips][windows-tips].