Skip to content

Fixed auto generator selection on windows #178

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

Closed
wants to merge 7 commits into from
Closed

Fixed auto generator selection on windows #178

wants to merge 7 commits into from

Conversation

nicole-mcg
Copy link
Contributor

@nicole-mcg nicole-mcg commented May 27, 2019

Fixes #168

Credit to @BurningEnlightenment for the vswhere command execution code.

This PR takes the approach of ignoring the "C++ Build Tools" Visual Studio workload during the cmake-js dependency check stage.

To include a message, warning users they don't have the dependency one of the following could be done:

  • Add another check after getting the windows generator, and make sure that the generator version has the C++ build tools installed
  • Add output to failed project generation indicating they may be missing the package.
    • E.g "Could not generate project. Are Visual Studio C++ tools and CMake 3.14+ installed?"
    • This is the approach I took with my small no-configuration generate + build scripts and always promptly reminded me

@BurningEnlightenment
Copy link

@nik-m2 thanks, for doing the work! In principle this is a much better and thorough solution than the quick fix proposed in #171 (will close it if this gets merged).
Using vswhere to drive the version selection process also eliminates the currently buggy behavior to not always selecting the newest available VS version. Nevertheless, checking whether CMake supports the selected version seems like a good idea.

However, ignoring the VC++ Build Tools Workload would be a showstopper for me, because none of the nodejs only developers in my Team need nor want a full Visual Studio installation which is also the case for (transitive) package consumers and CI environments. Furthermore this would make the cursed but widely used windows-build-tools unusable with cmake-js.
@nik-m2 Did you encounter any technical obstacles which led to the exclusion? Would you mind me adding support for said workload?

@nicole-mcg
Copy link
Contributor Author

nicole-mcg commented May 28, 2019

@BurningEnlightenment No problem! I'm glad you like my solution. I love deleting code 😈

That's great to know I don't need the full Visual Studio version, I have only testing a few work flows. Do you know if windows-build-tools will still work with, and won't break a normal Visual Studio installation?

I didn't run into any technical problems, just haven't used it before. I mentioned it in case it would be a problem, so go ahead by all means!

EDIT:

I added the check for the C++ build tools, but unfortunately -property installationPath doesn't seem to work with only windows-build-tools or VC++ 2017 Build Tools. Maybe there is another property that could be used, I couldn't find much documentation on the available properties

EDIT2:

Added a check for windows-build-tools npm package. Only workflow mentioned that has not been tested is C++ build tools without windows-build-tools and Visual Studio

One easy solution at this point would be to add a --force flag to cmake-js configure to continue even if generator checks fail

or

Use the old method as a fallback

@unbornchikken
Copy link
Member

It got kinda complicated in the end. Please help me on verify this. If you have a complete VS or just build tools installation at hand tell us the results there.

@nicole-mcg
Copy link
Contributor Author

nicole-mcg commented Jun 5, 2019

@unbornchikken With what I currently have I am able to detect a full installation only. I added detecting windows-build-tools as an attempt to give better support. I have tried with a partial installation but I'm not certain that I will be able to create a typical use case as I haven't used a partial VS installation. It would probably be best if someone who has used that workflow before has tested it.

This would probably work best if I dropped the windows-build-tools check, restored the old detection, then added check using -property installationPath that would try and use the backup method on failure.

The overall effect of this PR would then simply added better support for people who do have -property installationPath (maybe just full install), and leave any workflow that didn't have that property alone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ERR! OMG There is no Visual C++ compiler installed. Install Visual C++ Build Toolset or Visual Studio.
3 participants