Fix generating vsproj with SCons 4.6.0+ #85357
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Visual Studio project generation broke after the signature of
find_batch_file()
was changed in SCons 4.6.0+ (in SCons/scons@7082c53ff6). Thanks to mwichmann for pointing that out in #85262 (comment).I can confirm that with these changes,
vsproj=yes
once again produces a VS solution as before, while I could reproduce the build failing without these changes.I've also renamed the variable
version
tomsvc_version
for clarity. Otherwise, this just avoids passingenv
tofind_batch_file()
in SCons 4.6.0+, where that is no longer accepted. Instead, we need to find the product directory fromenv
ourselves, asfind_batch_file()
previously did internally viafind_vc_pdir()
, which we now call ourselves.find_vc_pdir()
can in theory throw exceptions if the MSVC version is unsupported (UnsupportedVersion
exception) or something unexpected occurs, but catching these wouldn't make much sense IMO, as we can't do much besides fail. Just having the build fail with these exceptions as in other cases here should be explicit enough.We should see if we can remove some of the reliance on SCons internals here in the future. Some other stuff could likely be improved as well, but I tried to keep this minimal to get builds working again ASAP, and considering the time in the 4.2 dev cycle.
Fixes #85262.