GENie
GENie copied to clipboard
vs2017 projects should use Windows 10 SDK
I installed Visual Studio 2017 Community and generated projects for it. Unfortunately they don't work out of the box:
118>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Platforms\x64\PlatformToolsets\v141\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".
After doing the retarget the projects only have the following changed:
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
It seems Microsoft complicated things a bit with Windows 10 and now made a target for each Feature Update (I see 5 different versions in the installer) so it doesn't seem straight forward which value to add there.
What's unfortunate about this is, that it seems even though the whole project was already compiled before and all the output files are there it will re-compile everything even though just a few files have changed - probably because the project files changed. This is pretty bad with very big projects when files were added.
Here's my workaround, if it helps! Pretty annoying that there's not an easier way to get an appropriate value.
-- utility function to find latest installed Windows 10 SDK version
-- TODO: should we read it out of this registry key?
-- HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0
function FindLocalWindows10SDKVersion()
-- look for the highest in C:\Program Files (x86)\Windows Kits\10\Include
-- matching 10.x.xxxxx.x
local sdkFolders = os.matchdirs("C:/Program Files (x86)/Windows Kits/10/Include/10.*")
if #sdkFolders == 0 then
error("Must have a Windows 10 SDK installed!")
end
table.sort(sdkFolders)
return path.getname(sdkFolders[#sdkFolders]) -- return as version, like "10.0.10240.0"
end
-- this comes in the project I want it set it for
windowstargetplatformversion(FindLocalWindows10SDKVersion())
Thanks. Should probably something more platform-independent and possibly less convenient like a build parameter. For now I will be using the 8.1 SDK. Also the complete rebuild is also triggered when just re-generating the files even if they didn't change - it's not related to the "retarget". So need to work around that or make genie smarter so it won't override files which are identical for Visual Studio. But that would be a different issue.
I would double-check that. I re-run GENie as a pre-build step on every compile, and if the .vcxproj
hasn't change, GENie doesn't even touch the file. Even if something has changed and it does touch it, VS will only rebuild files if their compile settings have changed (as it should!).
Windows SDK usually sets WindowsSDKVersion
environment variable.
See: https://github.com/bkaradzic/bx/blob/64b969e89835568319b7150fba976a79a705daf7/scripts/toolchain.lua#L134
@bkaradzic Thanks - I will look into it
@fitzymj It seems the problem is, that some of the files generated are not reproducible - meaning the order of entries changes on each re-genie. Not sure if this is caused by genie, by the invoking project or by using because I used -j (a lot of files are being processed during the genie step and -j speeds that up a whole lot).
WindowsSDKVersion is only defined if you run the Native Tools command prompt which isn't a deal breaker, but is a little inconvenient as it means that if anyone builds the project in a normal command prompt it won't be set.
I'm a little confused by the bx/blob link. Is this behaviour supposed to be supported "out of the box" for GENie (as I couldn't get it to work) or is that just the way you approach it in another project? For the time being I have copied the "hack" (example?) in my script, but it's a bit ugliness to an otherwise elegant system.
@Teknogrebo
WindowsSDKVersion is only defined if you run the Native Tools command prompt which isn't a deal breaker, but is a little inconvenient as it means that if anyone builds the project in a normal command prompt it won't be set.
Propose way how to obtain windows SDK version installed, because it's impossible to guess which exact version is installed.
@Teknogrebo
WindowsSDKVersion is only defined if you run the Native Tools command prompt which isn't a deal breaker, but is a little inconvenient as it means that if anyone builds the project in a normal command prompt it won't be set.
Propose way how to obtain windows SDK version installed, because it's impossible to guess which exact version is installed.
I'm not sure it needs to be guessed at, but specifically specified in the script. I know GENie is cross platform, but I think there is room for platform specific options. Maybe "platformsdk" option or something? It's been a while sinces+ I did any MacOS work, but I'm pretty sure there is some relevance to that platform as well.
Anyway. Thanks for the response, and keep up the good work :)
I'm not sure it needs to be guessed at, but specifically specified in the script. I know GENie is cross platform, but I think there is room for platform specific options. Maybe "platformsdk" option or something?
It already has that: https://github.com/bkaradzic/bx/blob/5a14ea6c36d21c827b499c83d6a9f6313ef4f8a4/scripts/toolchain.lua#L397-L399
I'm not sure it needs to be guessed at, but specifically specified in the script. I know GENie is cross platform, but I think there is room for platform specific options. Maybe "platformsdk" option or something?
It already has that: https://github.com/bkaradzic/bx/blob/5a14ea6c36d21c827b499c83d6a9f6313ef4f8a4/scripts/toolchain.lua#L397-L399
That's what i was referring to in my first post about bx/blob. I didn't know if that was actually a part of GENie or not, and my attempts to get a correct platform SDK set failed. I ran my script within a native tools command prompt for VS2017 where the WindowsSDKVersion environment variable is set correctly, and I still got a platform SDK of 8.1
That specific implementation isn't part of GENie, but the vstudio. windowsTargetPlatformVersion and vstudio.windowsTargetPlatformMinVersion properties it sets on the action are. I do agree that it is an odd outlier from how you interface with the system. It's one of the few cases where I need to directly access the action members instead of the high level configuration interface (e.g. "defines { "blah" }"). I'm not sure what the current long term architectural direction is, however.
On Wed, Feb 20, 2019 at 10:48 AM Teknogrebo [email protected] wrote:
I'm not sure it needs to be guessed at, but specifically specified in the script. I know GENie is cross platform, but I think there is room for platform specific options. Maybe "platformsdk" option or something?
It already has that:
https://github.com/bkaradzic/bx/blob/5a14ea6c36d21c827b499c83d6a9f6313ef4f8a4/scripts/toolchain.lua#L397-L399
That's what i was referring to in my first post about bx/blob. I didn't know if that was actually a part of GENie or not, and my attempts to get a correct platform SDK set failed. I ran my script within a native tools command prompt for VS2017 where the WindowsSDKVersion environment variable is set correctly, and I still got a platform SDK of 8.1
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bkaradzic/GENie/issues/325#issuecomment-465633486, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMsZNG-n0MLWSWb81rXJlcvOAq1QYhKks5vPW4xgaJpZM4RZGDh .
The elegant solution would be that MSVC allows wildcards when selecting SDK, like 10.* as any. They are changing version so much, and it's actually impossible to know which exactly you have installed.
defines
are literally preprocessor defines that are passed to compiler's preprocessor.
Other issue with WindowsSDK is when you generate solution/project files on one machine and distribute it to other.
So far registry solution mentioned above is the most promising, just someone needs to figure out details...
I did another reread of the changelog and there is mention of adding "windowstargetplatformversion" which does what I want. It's annoying that I missed it before, but we've had a good discussion :)