diff options
author | isaacs <i@izs.me> | 2012-11-30 01:46:27 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-11-30 01:46:27 +0400 |
commit | 00cba324d44885b3ba72ae32a64331bc9f77cc7c (patch) | |
tree | 4117b9ccbc58b901c00c6fb4eb7a666916b6e659 /node_modules/node-gyp/lib/configure.js | |
parent | 87ae66acf0ead2f85a388cb805b7cf9d835289ef (diff) |
node-gyp@0.7.3
Diffstat (limited to 'node_modules/node-gyp/lib/configure.js')
-rw-r--r-- | node_modules/node-gyp/lib/configure.js | 69 |
1 files changed, 57 insertions, 12 deletions
diff --git a/node_modules/node-gyp/lib/configure.js b/node_modules/node-gyp/lib/configure.js index 33906fabc..44611dcd0 100644 --- a/node_modules/node-gyp/lib/configure.js +++ b/node_modules/node-gyp/lib/configure.js @@ -26,14 +26,17 @@ function configure (gyp, argv, callback) { var python = gyp.opts.python || process.env.PYTHON || 'python' , buildDir = path.resolve('build') , hasVCExpress = false + , hasVC2012Express = false , hasWin71SDK = false + , hasWin8SDK = false , configPath , nodeDir + if (win) { checkVCExpress(function () { - if (hasVCExpress) { - checkWin71SDK(function () { + if (hasVCExpress || hasVC2012Express) { + checkWinSDK(function () { checkPython() }) } else { @@ -106,14 +109,20 @@ function configure (gyp, argv, callback) { } function failNoPython () { - callback(new Error('Can\'t find Python executable "' + python - + '", you can set the PYTHON env variable.')) + callback(new Error('Can\'t find Python executable "' + python + + '", you can set the PYTHON env variable.')) } function failPythonVersion (badVersion) { - callback(new Error('Python executable "' + python - + '" is v' + badVersion + ', which is not supported by gyp.\n' - + 'You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.')) + callback(new Error('Python executable "' + python + + '" is v' + badVersion + ', which is not supported by gyp.\n' + + 'You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.')) + } + + function checkWinSDK(cb) { + checkWin71SDK(function() { + checkWin8SDK(cb); + }) } function checkWin71SDK(cb) { @@ -124,11 +133,43 @@ function configure (gyp, argv, callback) { }) } + function checkWin8SDK(cb) { + var cp = spawn('reg', ['query', 'HKLM\\Software\\Microsoft\\Windows Kits\\Installed Products', '/f', 'Windows Software Development Kit x86', '/reg:32']) + cp.on('exit', function (code) { + hasWin8SDK = (code === 0) + cb() + }) + } + + function checkVC2012Express64(cb) { + var cp = spawn('reg', ['query', 'HKLM\\SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\11.0\\Setup\\VC', '/v', 'ProductDir']) + cp.on('exit', function (code) { + hasVC2012Express = (code === 0) + cb() + }) + } + + function checkVC2012Express(cb) { + var cp = spawn('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC', '/v', 'ProductDir']) + cp.on('exit', function (code) { + hasVC2012Express = (code === 0) + if (code !== 0) { + checkVC2012Express64(cb) + } else { + cb() + } + }) + } + function checkVCExpress64(cb) { var cp = spawn('cmd', ['/C', '%WINDIR%\\SysWOW64\\reg', 'query', 'HKLM\\Software\\Microsoft\\VCExpress\\10.0\\Setup\\VC', '/v', 'ProductDir']) cp.on('exit', function (code) { hasVCExpress = (code === 0) - cb() + if (code !== 0) { + checkVC2012Express(cb) + } else { + cb() + } }) } @@ -238,9 +279,13 @@ function configure (gyp, argv, callback) { // set the target_arch variable variables.target_arch = gyp.opts.arch || process.arch || 'ia32' - // set the toolset for 64-bit VCExpress users - if (win && variables.target_arch === 'x64' && hasVCExpress && hasWin71SDK) { - defaults.msbuild_toolset = 'Windows7.1SDK' + // set the toolset for VCExpress users + if (win) { + if (hasVC2012Express && hasWin8SDK) { + defaults.msbuild_toolset = 'v110' + } else if (hasVCExpress && hasWin71SDK) { + defaults.msbuild_toolset = 'Windows7.1SDK' + } } // set the node development directory @@ -300,7 +345,7 @@ function configure (gyp, argv, callback) { if ('msvs_version' in gyp.opts) { argv.push('-G', 'msvs_version=' + gyp.opts.msvs_version) } else { - argv.push('-G', 'msvs_version=2010') + argv.push('-G', 'msvs_version=auto') } } |