-
Notifications
You must be signed in to change notification settings - Fork 146
Added check for VS generator using vswhere.exe #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Ok, finally I got a Win laptop with VC++ 2019 Build Tools. I'm gonna verify this later today. |
@unbornchikken Any update on this? |
@jmcker #178 was originally based on the assumption that my method would work for all workflows. This has PR has the same effect as that one, but with this PR it will continue with the current methods of finding msbuild.exe Some workflows will still have to resort to more hacky or unreliable methods of finding msbuild.exe |
This PR, in its current state, does not detect the VS2017 or VS2019 Build Tools installs that I have (via Modifying EDIT: Just found the I'm happy to make my own PR to discuss the changes after this merges, especially since this might be part of a larger shift to Toolset.prototype._getGeneratorFromVSWhere = async(function*() {
let programFilesPath = _.get(process.env, "ProgramFiles(x86)", _.get(process.env, "ProgramFiles"));
let vswhereCommand = path.resolve(programFilesPath, "Microsoft Visual Studio", "Installer", "vswhere.exe");
const vswhereOutput = yield processHelpers.exec(`"${vswhereCommand}" -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationVersion`);
if (!vswhereOutput) {
return null;
}
let versions = vswhereOutput.trim().split('\r\n');
// Find the max since the first result isn't necessarily the top supported
let maxVer = 0;
for (let ver of versions) {
ver = ver.trim();
ver = ver.substring(0, ver.indexOf("."));
ver = parseInt(ver);
if (ver > maxVer) {
maxVer = ver;
}
}
if (maxVer == 0) {
return null;
}
return {
14: "Visual Studio 14 2015",
15: "Visual Studio 15 2017",
16: "Visual Studio 16 2019",
}[maxVer] || null;
}); |
Yeah, I still have issues with this. I've accidentally installed a previous version of VS Tools. Then uninstalled, then installed the latest. And it seems the older version got selected for CMake.js. Anyway I'm merging this, and looking forward to see a PR from @jmcker. Thanks for your efforts. |
@BurningEnlightenment @unbornchikken
I tried to take a larger approach to this in #178 but discovered mid way that my solution didn't work with all workflows. Here is a solution that will add the generator check using
vswhere.exe
, but will continue if it fails.