diff --git a/lib/configure.js b/lib/configure.js index 33906fabce..44e2af1fac 100644 --- a/lib/configure.js +++ b/lib/configure.js @@ -26,6 +26,7 @@ function configure (gyp, argv, callback) { var python = gyp.opts.python || process.env.PYTHON || 'python' , buildDir = path.resolve('build') , hasVCExpress = false + , hasVC2012Express = false , hasWin71SDK = false , configPath , nodeDir @@ -124,11 +125,24 @@ function configure (gyp, argv, callback) { }) } + function checkVC2012Express(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) + console.log('hasVC2012Express', hasVC2012Express); + 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() + } }) } @@ -239,8 +253,12 @@ function configure (gyp, argv, callback) { 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' + if (win && variables.target_arch === 'x64') { + if (hasVC2012Express) { + defaults.msbuild_toolset = 'v110' + } else if (hasVCExpress && hasWin71SDK) { + defaults.msbuild_toolset = 'Windows7.1SDK' + } } // set the node development directory