-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add support for Visual Studio 2017 #1101
Conversation
Add comtypes library: https://github.com/enthought/comtypes. It adds support for using COM, which we need to find Visual Studio 2017 location.
Adds support for generating solutions and building with Visual Studio 2017
Python will be also used by build stage
Add support for building with Visual Studio 2017
@bzoz Great job tracking down the COM api 👍 but isn't |
tiny tool 29KB made from Microsoft/vs-setup-samples.
and the env manipulation bat is at |
VS2017 build tools on Windows 7SP1:
Apparently the COM interface doesn't get registered |
@refack sorry, I cannot reproduce. After installing "Build Tools for Visual Studio 2017 RC" on Windows 7 python script can locate it. However, I can get this error for clean Windows installation, when VS2017 was never installed. Fixed the script. |
I trying with some minimal component set and found that the COM server wasn't registered... P.S. funny thing, the Installer is an |
I own the COM APIs. They are registered when you install VS, though in some older previews there were some circumstances in which they would get prematurely unregistered. That was fixed, IIRC, in RC2. I recommend using the native COM APIs with |
@heaths thank for the reply. Since this is a nodejs / python project, we're trying not to cloud it with other languages or precompiled EXEs. I just converted my C# code to be .NET 2.0 compatible so now we have a way to call it from powershell 2.0. @heaths funny thing that the Installer is |
Sounds like the build tools are missing a dependency, then. I'll track this down. |
@heaths moving to microsoft/vs-setup-samples#5 |
Not needed since #1130 landed. |
The officially supported vswhere tool is now available as part of the install starting today with Visual Studio 15.2 preview 2: https://blogs.msdn.microsoft.com/heaths/2017/04/21/vswhere-is-now-installed-with-visual-studio-2017/. This doesn't fix all the existing installs of VS 2017 but going forward you can now detect the VS install locations and whether C++ tools are available from a scripted environment. I hope this helps your scenario. |
Add support for Visual Studio 2017 to node-gyp
With this version VS does not use Windows registry any more, instead it installs a COM server that one can query to obtain list of installed modules and their locations - see this blogpost: https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studio-15-setup/.
Python does not support communicating with COM servers directly. Chromium project when updating
GN
did not add extra library, instead assuming default installation path with environment variable override (see https://cs.chromium.org/chromium/src/build/vs_toolchain.py?q=vs_toolchain&sq=package:chromium&l=150). I've used the same method to updateGYP
- default installation path and default Windows SDK version with override. PR forGYP
has been also opened upstream: https://chromium-review.googlesource.com/#/c/433540/To ease usage for node-gyp users, a Python script that can obtain VS installation path and installed SDK version is provided. It depends on
comtypes
Python library (https://github.com/enthought/comtypes) which adds support for COM to Python. This script is in turn used bynode-gyp
to set proper environment variables overrides.For easier review this PR is split into 4 commits:
First commit adds
comtypes
Python library. It is needed to query VS COM server about installation paths.Second commit adds support for VS2017 to
gyp
. Similar to the way it was implemented ingn
, it assumes that VS2017 Professional was installed in the default location. User can use two environment variables to overwrite this:VS2017_INSTALL
for installation path andVS2017_SDK
for installed SDK version. This patch was also commited upstream: https://chromium-review.googlesource.com/#/c/433540/Third commit moves
PythonFinder
to separate file. We will use Python in build stage to locate newmsbuild
installation location.Fourth commit adds VS2017 support to
node-gyp
. It includes Python script that can communicate with VS2017 COM server, and necessary changes to configure and build stages.Ref: nodejs/node#11084,
#1056