Skip to content

Commit

Permalink
Add Windows 8 and MSVC 2012 support.
Browse files Browse the repository at this point in the history
Closes #149.

Squashed commit of the following:

commit 73af254
Author: Frederico Silva <[email protected]>
Date:   Tue Oct 23 17:46:38 2012 +0100

    add windows 8 sdk check

commit 37077ef
Author: Frederico Silva <[email protected]>
Date:   Sat Oct 20 17:12:30 2012 +0100

    remove arch check

commit 731b001
Author: Frederico Silva <[email protected]>
Date:   Sat Oct 20 16:34:02 2012 +0100

    add windows 8 32 bits support

commit 5ce8be8
Author: Frederico Silva <[email protected]>
Date:   Fri Oct 19 02:33:48 2012 +0100

    remove debug log

commit b3705b6
Author: Frederico Silva <[email protected]>
Date:   Fri Oct 19 00:56:12 2012 +0100

    check VS2012Express and set toolset
  • Loading branch information
fredericosilva authored and TooTallNate committed Oct 29, 2012
1 parent be66ecd commit 63a3426
Showing 1 changed file with 51 additions and 7 deletions.
58 changes: 51 additions & 7 deletions lib/configure.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

module.exports = exports = configure

/**
* Module dependencies.
*/
Expand All @@ -26,14 +25,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 {
Expand Down Expand Up @@ -116,6 +118,12 @@ function configure (gyp, argv, callback) {
+ '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) {
spawn('reg', ['query', 'HKLM\\Software\\Microsoft\\Microsoft SDKs\\Windows\\v7.1', '/v', 'InstallationFolder'])
.on('exit', function (code) {
Expand All @@ -124,11 +132,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()
}
})
}

Expand Down Expand Up @@ -238,9 +278,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
Expand Down

0 comments on commit 63a3426

Please sign in to comment.