Open aik6980 opened 7 years ago
Off the top of my head, I think max system version is only supported for macOS. Not sure how we would even do it for Windows? Does it have a setting like that?
This has been added I believed from this thread? https://github.com/premake/premake-core/pull/450
After looking at the code, I think this API seems to always pick the "min" instead of the latest version installed on the machine.
I found the same feature people asked on this same feature on CMake forum and the way to get the latest version of WINSDK is to read it from Window Registry key, https://public.kitware.com/Bug/view.php?id=15670
That works if you run Premake on the same machine you build from, but that isn't always the case! We could perhaps add an API to expose that value though, and then you could use it to set the version, maybe like…
systemversion(os.winSdkVersion())
…or something.
systemversion(os.winSdkVersion())
this looks like a good solution, yeah.
Now with os.getWindowsRegistry
you're able to supply this yourself:
function os.winSdkVersion()
local reg_arch = iif( os.is64bit(), "\\Wow6432Node\\", "\\" )
local sdk_verison = os.getWindowsRegistry( "HKLM:SOFTWARE" .. reg_arch .."Microsoft\\Microsoft SDKs\\Windows\\v10.0\\ProductVersion" )
if sdk_verison ~= nil then return sdk_version end
-- add more versions here ( "v8.1", "v7.1A" )
end
for example I'm using this:
filter "system:windows"
defines { "_WINDOWS" }
if os.getversion().majorversion == 10 then
local sRegArch = iif( os.is64bit(), "\\Wow6432Node\\", "\\" )
local sWin10SDK = os.getWindowsRegistry( "HKLM:SOFTWARE" .. sRegArch .. "Microsoft\\Microsoft SDKs\\Windows\\v10.0\\ProductVersion" )
-- apparently it needs an extra ".0" to be recognized by VS
if sWin10SDK ~= nil then systemversion( sWin10SDK .. ".0" ) end
end
Any word on when this will be fixed? I am running into a similar issue where the Target Platform Min. Version
field is not being set in Visual Studio 2019 when using systemversion ("10.0.18362.0:latest")
and as a result, WindowsTargetPlatformMinVersion
is not being set inside the project file.
Hi, i'm using premake5, here when I tried to use
systemversion
function withmin:max
syntax, somehow the min number is always been selected even though my machine doesn't have winsdk 10.0.10586.0 installed (I do have 10.0.14393.0)systemversion "10.0.10586.0:10.0.14393.0"
I'm trying to generated projects for VS2015
thanks! Aik