Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/node-gyp/lib/configure.js')
-rw-r--r--node_modules/node-gyp/lib/configure.js38
1 files changed, 33 insertions, 5 deletions
diff --git a/node_modules/node-gyp/lib/configure.js b/node_modules/node-gyp/lib/configure.js
index 54bb2ccb3..3349e9fed 100644
--- a/node_modules/node-gyp/lib/configure.js
+++ b/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')
@@ -315,9 +343,9 @@ function configure (gyp, argv, callback) {
}
/**
- * Returns the first file or directory from an array of candidates that is
+ * Returns the first file or directory from an array of candidates that is
* readable by the current user, or undefined if none of the candidates are
- * readable.
+ * readable.
*/
function findAccessibleSync (logprefix, dir, candidates) {
for (var next = 0; next < candidates.length; next++) {