summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/node-gyp/lib/configure.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/node-gyp/lib/configure.js')
-rw-r--r--deps/npm/node_modules/node-gyp/lib/configure.js34
1 files changed, 31 insertions, 3 deletions
diff --git a/deps/npm/node_modules/node-gyp/lib/configure.js b/deps/npm/node_modules/node-gyp/lib/configure.js
index 66c33e6947..3349e9fedf 100644
--- a/deps/npm/node_modules/node-gyp/lib/configure.js
+++ b/deps/npm/node_modules/node-gyp/lib/configure.js
@@ -19,9 +19,11 @@ var fs = require('graceful-fs')
, cp = require('child_process')
, extend = require('util')._extend
, processRelease = require('./process-release')
- , win = process.platform == 'win32'
+ , win = process.platform === 'win32'
, findNodeDirectory = require('./find-node-directory')
, msgFormat = require('util').format
+if (win)
+ var findVS2017 = require('./find-vs2017')
exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module'
@@ -86,11 +88,22 @@ function configure (gyp, argv, callback) {
mkdirp(buildDir, function (err, isNew) {
if (err) return callback(err)
log.verbose('build dir', '"build" dir needed to be created?', isNew)
- createConfigFile()
+ if (win && (!gyp.opts.msvs_version || gyp.opts.msvs_version === '2017')) {
+ findVS2017(function (err, vsSetup) {
+ if (err) {
+ log.verbose('Not using VS2017:', err.message)
+ createConfigFile()
+ } else {
+ createConfigFile(null, vsSetup)
+ }
+ })
+ } else {
+ createConfigFile()
+ }
})
}
- function createConfigFile (err) {
+ function createConfigFile (err, vsSetup) {
if (err) return callback(err)
var configFilename = 'config.gypi'
@@ -137,6 +150,19 @@ function configure (gyp, argv, callback) {
// disable -T "thin" static archives by default
variables.standalone_static_library = gyp.opts.thin ? 0 : 1
+ if (vsSetup) {
+ // GYP doesn't (yet) have support for VS2017, so we force it to VS2015
+ // to avoid pulling a floating patch that has not landed upstream.
+ // Ref: https://chromium-review.googlesource.com/#/c/433540/
+ gyp.opts.msvs_version = '2015'
+ process.env['GYP_MSVS_VERSION'] = 2015
+ process.env['GYP_MSVS_OVERRIDE_PATH'] = vsSetup.path
+ defaults['msbuild_toolset'] = 'v141'
+ defaults['msvs_windows_target_platform_version'] = vsSetup.sdk
+ variables['msbuild_path'] = path.join(vsSetup.path, 'MSBuild', '15.0',
+ 'Bin', 'MSBuild.exe')
+ }
+
// loop through the rest of the opts and add the unknown ones as variables.
// this allows for module-specific configure flags like:
//
@@ -272,6 +298,8 @@ function configure (gyp, argv, callback) {
argv.push('-Dnode_gyp_dir=' + nodeGypDir)
argv.push('-Dnode_lib_file=' + release.name + '.lib')
argv.push('-Dmodule_root_dir=' + process.cwd())
+ argv.push('-Dnode_engine=' +
+ (gyp.opts.node_engine || process.jsEngine || 'v8'))
argv.push('--depth=.')
argv.push('--no-parallel')