Skip to content

Commit

Permalink
check VS2012Express and set toolset
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericosilva committed Oct 19, 2012
1 parent 149d5bc commit b3705b6
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
})
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b3705b6

Please sign in to comment.