premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.21k stars 618 forks source link

Windows 10 SDK Version isn't detected properly #1152

Open awesomekyle opened 6 years ago

awesomekyle commented 6 years ago

I'm on 64-bit Windows 10 and Premake is unable to detect my currently installed Win10 SDK version. It's looking for Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0\ProductVersion which for some reason isn't in my registry. I have the following:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\ProductVersion // the key that you're looking for
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots\10.0.17134.0 // this is a sub folder, not a key value

I'm not sure why my computer only has the WOW64 version of ProductVersion and a 64-bit tag. My MVSC installation is standard other that my installation drive: I installed on the D: drive instead of C:

My Visual Studio projects are coming out with WindowsTargetPlatformVersion unset, which means it defaults to the Windows 8.1 SDK, which I don't have installed.

samsinsane commented 6 years ago

Interesting, we should be checking both 32bit and 64bit locations.

samsinsane commented 4 years ago

Finally got around to looking into this, we only check the 64bit location on 64bit machines. On Windows this is determined a couple of ways, firstly, we assume if the current process is 64bit that it is a 64bit machine (so using a 64bit build of Premake will fix your issue), and secondly, we fall back to checking what the PROCESSOR_ARCHITECTURE environment variable is. It's possible that this doesn't contain any of the possible values here: https://github.com/premake/premake-core/blob/796f517511a2e868e7604a86a315290e55bafadf/src/base/os.lua#L286-L293

It also looks like the code that queries the registry is no longer called anywhere. I assume in favour of using $(LatestTargetPlatformVersion) in vs2017 and 10.0 in vs2019 and later.