Skip to content

Conversation

ThomasFOG
Copy link
Contributor

@ThomasFOG ThomasFOG commented Jun 11, 2025

CMake and MSBuild are not defined in PATH by default on Windows.

This PR checks if they are on PATH like expected.

If they aren't, it will try to retrieve the latest Visual Studio installation and retrieve the tools from there.

This enables to build SDL without additional steps other than installing Visual Studio with the C++ workload (this helps debugging this repository and the native backend).


The way it retrieves the VS installation is kind of convoluted, but comes from what MS does to retrieve it (because it turns out finding recent VS installs is not as trivial as querying a register key; this method is the robust one).

@ThomasFOG ThomasFOG requested a review from harry-cpp June 11, 2025 22:02
@ThomasFOG
Copy link
Contributor Author

Linux is failing because the runner uses a deprecated ubuntu version. We'll need to fix this in a separate PR first.

@harry-cpp
Copy link
Member

Oh you are gonna hate me for telling you this, but you should probably use vshwere.exe, CAKE already has wrapper methods for it as well 😅

https://cakebuild.net/dsl/vswhere/

@ThomasFOG
Copy link
Contributor Author

Ah. I didn't use vswhere because it looked like an .exe that you had to download and the Microsoft documentation didn't mention that you could have it as a nuget and that Cake has a wrapper for it... gotta love official documentation.

It's likely a cleaner and lighter code to use vswhere, I'll check it out and update the PR if need be.

@ThomasFOG
Copy link
Contributor Author

I've updated this to use vswhere directly. We don't need a nuget for this, it has a fixed installation path.

@ThomasFOG
Copy link
Contributor Author

It doesn't build on arm anymore because of this: libsdl-org/SDL#13254

This is due to a recent change in Visual Studio C++ compiler (since v15.44).

We will need to wait for SDL 2.32.9 to release and point to it so that the latest Visual Studio can build arm64 again.

Alternatively, we can inject /forceInterlockedFunctions- (with the dash) to MSVC arguments.

@ThomasFOG
Copy link
Contributor Author

I've updated to use Cake's vswhere, but this is still blocked while we wait for SDL 2.32.9 to release to fix the win-arm64 build.

@ThomasFOG ThomasFOG removed the blocked label Aug 11, 2025
@ThomasFOG
Copy link
Contributor Author

There's no sign of a new SDL 2 release in the coming days, so I upgraded SDL 2 to basically 2.32.8 + the ARM fix. I think it's safe to just grab that and tag it 2.32.8. It's pretty much the only change and it's not a functional one, so it's pretty much a bare 2.32.8.

Once merged, I'll update the main repository.

@ThomasFOG
Copy link
Contributor Author

SDL 2.34.10 has released.

This PR is ready to be merged and updated upstream.

@SimonDarksideJ SimonDarksideJ merged commit 3d537dc into MonoGame:main Sep 2, 2025
5 checks passed
@ThomasFOG ThomasFOG deleted the manual branch September 2, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants