Skip to content

Commit 8d3b929

Browse files
committed
configure: supply target_arch define to gyp.js
Since version 1.1.1 gyp.js uses environment files. Set --target_arch command-line option with value of node-gyp --arch option in order to generate proper ninja environment file. Removed findMSVS() function and `vcvars.bat` invocation before building with `ninja` because `gyp.js` supports target environments and the actual `target_arch` is set before on `configure` stage.
1 parent 5b0a17b commit 8d3b929

File tree

1 file changed

+2
-35
lines changed

1 file changed

+2
-35
lines changed

lib/build.js

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ function build (gyp, argv, callback) {
3636
, config
3737
, arch
3838
, nodeDir
39-
, vcDir
4039

4140
if (gyp.opts.gypjs) {
4241
command = gyp.opts.ninja || process.env.NINJA || 'ninja'
@@ -75,41 +74,14 @@ function build (gyp, argv, callback) {
7574
log.verbose('architecture', arch)
7675
log.verbose('node dev dir', nodeDir)
7776

78-
if (win) {
79-
gyp.opts.gypjs? findMSVS() : findSolutionFile()
77+
if (!gyp.opts.gypjs && win) {
78+
findSolutionFile()
8079
} else {
8180
doWhich()
8281
}
8382
})
8483
}
8584

86-
/**
87-
* On Windows, find Visual C++ toolset
88-
*/
89-
90-
function findMSVS () {
91-
var msvs_version = gyp.opts.msvs_version || 'auto'
92-
var vs_versions = (msvs_version === 'auto'? [14, 12, 10] : [msvs_version])
93-
vs_versions.find(function(version) {
94-
var vscomntools = process.env['VS' + version + '0COMNTOOLS']
95-
if (vscomntools) {
96-
// remove quotes to work with path.join()
97-
if (vscomntools.substr(0, 1) === '"' && vscomntools.substr(-1, 1) === '"') {
98-
vscomntools = vscomntools.substr(1, vscomntools.length - 2)
99-
}
100-
vcDir = path.join(vscomntools, '..', '..', 'VC')
101-
if (vcDir) {
102-
log.verbose('found Visual C++ in ', vcDir)
103-
return true
104-
}
105-
}
106-
})
107-
if (!vcDir) {
108-
callback(new Error('Visual C++ not found, please setup a C++ compiler toolset'))
109-
}
110-
doWhich()
111-
}
112-
11385
/**
11486
* On Windows, find the first build/*.sln file.
11587
*/
@@ -281,11 +253,6 @@ function build (gyp, argv, callback) {
281253
argv.push('-j' + j)
282254
}
283255
}
284-
// invoke vcvarsall.bat before build
285-
if (win && vcDir) {
286-
argv.unshift(arch === 'ia32'? 'x86' : arch, '&', command)
287-
command = path.join(vcDir, 'vcvarsall.bat')
288-
}
289256
}
290257

291258
var proc = gyp.spawn(command, argv)

0 commit comments

Comments
 (0)