-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
win: enable build with vs2017 #11852
Conversation
Ref: boostorg/build#170 |
cc @indutny ;) |
@nodejs/build |
Are we separately maintaining our copy of gyp now or should the changes in |
some changes in |
A better version of |
Should we just copy that version then? Do your changes here diverge it much from the node-gyp version? @joaocgreis can you comment on this? It looks a bit different to the approach you've taken in node-gyp and I wouldn't mind seeing a unified approach to both. |
Rebased on top of |
Took me a few more hours to finish my work on this, but I had it almost done so I completed testing and open a PR: #11867 . We can now compare and use the best or merge. About this version, I'd like to see the gyp changes in a separate commit. If a user has multiple versions of VS installed and only one with a C++ compiler, does this filter to choose that one? About the gyp update, I think it's easier to maintain if we update to the upstream version and float patches, as we've been doing. The gyp from node-gyp is missing some floating patches that we have here, at least those would have to be added (compare https://github.com/nodejs/node-gyp/commits/ae141e1/gyp with https://github.com/nodejs/node/commits/1a210c4/tools/gyp). This would be easier to review in a separate PR. (For reference, there's a good guide about floating patches for V8: https://github.com/nodejs/node/blob/master/doc/guides/maintaining-V8.md) |
@joaocgreis In Hebrew we say "rivalry among scholars brings much wisdom" 😉 |
@joaocgreis so I've refactored the C# file, and now the scripts can pass filter criteria to the C# class (such as if if instance has all requirements for VC compilation) and it's easier to get values via P.S. I'm working on a PR for |
@joaocgreis as for the floating |
7eaabde
to
69e8d07
Compare
What are the major differences between approach here and #11867 ? |
I have 3 major reservation
|
Alright, 👍 to this PR then. |
I'd prefer to avoid shipping a hand-rolled JSON stringifier. |
Should we consider using If I'll have enough time, I will make |
993fe48
to
3d41612
Compare
@joaocgreis PTAL. If you approve I'll land. |
vcbuild.bat
Outdated
@@ -51,7 +51,8 @@ if /i "%1"=="clean" set target=Clean&goto arg-ok | |||
if /i "%1"=="ia32" set target_arch=x86&goto arg-ok | |||
if /i "%1"=="x86" set target_arch=x86&goto arg-ok | |||
if /i "%1"=="x64" set target_arch=x64&goto arg-ok | |||
if /i "%1"=="vc2015" set target_env=vc2015&goto arg-ok | |||
if /i "%1"=="vs2015" set target_env=vs2015&goto arg-ok | |||
if /i "%1"=="vs2017" set target_env=vs2017&goto arg-ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those should be vc2015
and vc2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't bikeshed over this if you feel strongly.
But a lllooooonnngggg and boring discussion on the boost mailing list came to a conclusion it should be vs
since vc2015 or vc2017 are misnomers, the VC++ versions are either 14.0 and 15.0 or v140 and v141.
Ref: https://lists.boost.org/Archives/boost/2017/03/233597.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People right now can have setups that call vcbuild vc2015
, no reason to break those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add it as an "undocumented" switch, what do you think:
if /i "%1"=="vc2015" set target_env=vs2015&goto arg-ok
@@ -144,7 +145,33 @@ if defined noprojgen if defined nobuild if not defined sign if not defined msi g | |||
|
|||
@rem Set environment for msbuild | |||
|
|||
set msvs_host_arch=x86 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this go inside :vs-set-2017
? It looks like it is only used there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually should be added to the VS2015 case as well, but that's for a different PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it's kinda consistent with the rem
two lines above ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm testing the implication on calling the VS2016 with a host_target
arch
vcbuild.bat
Outdated
call tools\msvs\vswhere_usability_wrapper.cmd | ||
if "_%VCINSTALLDIR%_" == "__" goto vs-set-2015 | ||
set vcvars_call="%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg% | ||
echo %vcvars_call% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ECHO
?
It's used in:
The call to configure
https://github.com/refack/node/blob/3d416125b23827f76eae2c5e69a84a9b12557075/vcbuild.bat#L213
The call to cctest
https://github.com/refack/node/blob/3d416125b23827f76eae2c5e69a84a9b12557075/vcbuild.bat#L403
Personally I find it very helpful, but it could move to a "verbosing" PR
/cc @nodejs/build @nodejs/platform-windows |
ping @nodejs/build @nodejs/platform-windows @joaocgreis @bzoz @indutny |
LGTM as long as @seishun @bzoz and @joaocgreis are okay with it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a337f63163544df70d86cc318eaf4bda0bf5ae76 LGTM (CI pending)
Nit: casing on the commit title is wrong, make should be lowercase and VS uppercase.
This is missing at least the WiX warning and using the latest installed version that works, but we can improve on that afterwards.
@rem usualy vcvarsall takes an argument: host + '_' + target | ||
set vcvarsall_arg=%msvs_host_arch%_%target_arch% | ||
@rem unless both host and taget are x64 | ||
if %target_arch%==x64 if %msvs_host_arch%==amd64 set vcvarsall_arg=amd64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use VsDevCmd
to avoid having to detect the host arch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda don't trust VsDevCmd
🤷♀️ I think it does too much.
Also both of them, for x86 it choose a native compiler over a 64bit host cross compiler:
c:\code$ "c:\bin\dev\VS\Microsoft Visual Studio 2017 Community\Common7\Tools\VsDevCmd.bat" -arch=x86
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26403.7
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
c:\code$ where cl
c:\bin\dev\VS\Microsoft Visual Studio 2017 Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86\cl.exe
And apparently that matters: https://chromium-review.googlesource.com/c/486400/#message-04d641d86728a1b1832181033b692eb9a85e55de
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*"does too much" == "runs longer" (probably does .NET setup)
@bzoz PTAL, vc2015 is retained as an "undocumented" compatibility switch |
* Set default to `vs2015` since `vs2017` is not CI-green yet * changes vcbuild.bat arg from `vc2015` to `vs2015`/`vs2017` `vc` as in Visual C++ is actually versions 14.0 or 14.10 `vs` as in Visual Studio is 2015 or 2017 Ref: http://lists.boost.org/Archives/boost/2017/03/233597.php 🤦 * keep `vc2015` for backward compatibility but "undocumented" * tools: transplant vswhere wrapper from `msvs-com-helper` Ref: https://github.com/node4good/msvs-com-helper
@joaocgreis @gibfahn are we waiting for @bzoz? I've addressed his comments... |
Landed in 1c93e8c |
* Set default to `vs2015` since `vs2017` is not CI-green yet * changes vcbuild.bat arg from `vc2015` to `vs2015`/`vs2017` `vc` as in Visual C++ is actually versions 14.0 or 14.10 `vs` as in Visual Studio is 2015 or 2017 Ref: http://lists.boost.org/Archives/boost/2017/03/233597.php 🤦 * keep `vc2015` for backward compatibility but "undocumented" * tools: transplant vswhere wrapper from `msvs-com-helper` Ref: https://github.com/node4good/msvs-com-helper PR-URL: #11852 Reviewed-By: João Reis <[email protected]> Reviewed-By: Bartosz Sosnowski <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
Thanks I didn't even notice... |
* Set default to `vs2015` since `vs2017` is not CI-green yet * changes vcbuild.bat arg from `vc2015` to `vs2015`/`vs2017` `vc` as in Visual C++ is actually versions 14.0 or 14.10 `vs` as in Visual Studio is 2015 or 2017 Ref: http://lists.boost.org/Archives/boost/2017/03/233597.php 🤦 * keep `vc2015` for backward compatibility but "undocumented" * tools: transplant vswhere wrapper from `msvs-com-helper` Ref: https://github.com/node4good/msvs-com-helper PR-URL: nodejs#11852 Reviewed-By: João Reis <[email protected]> Reviewed-By: Bartosz Sosnowski <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
Add support for building node with Visual Studio 2017
Dependent upon #12450
[Inspired by @bzoz and #11084]
With this version VS does not use Windows registry any more, instead it installs a COM server and a tools called
vswhere
that one can query to obtain list of installed modules and their locations - see this blogpost: https://blogs.msdn.microsoft.com/heaths/2017/04/21/vswhere-is-now-installed-with-visual-studio-2017/ by @heathsI've written a script that wraps
vswhere
with all the needed arguments for finding a VC++ toolchain, transplanted fromnode4good/msvs-com-helper
Checklist
vcbuild test
(Windows) passesAffected core subsystem(s)
win, build, tools
Ref: nodejs/node-gyp#1130, nodejs/node-gyp#1103
/cc @nodejs/build @nodejs/platform-windows