Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 5576234

Browse files
authored
Merge pull request #892 from DeeDeeG/support_visual_studio_2017_and_2019
Better Support for Visual Studio 2017 and 2019
2 parents 3df25f9 + 596b3de commit 5576234

File tree

6 files changed

+6
-26
lines changed

6 files changed

+6
-26
lines changed

src/apm.coffee

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,15 @@ module.exports =
9898
# Use the explictly-configured version when set
9999
return process.env.GYP_MSVS_VERSION if process.env.GYP_MSVS_VERSION
100100

101+
return '2019' if @visualStudioIsInstalled("2019")
102+
return '2017' if @visualStudioIsInstalled("2017")
101103
return '2015' if @visualStudioIsInstalled("14.0")
102-
return '2013' if @visualStudioIsInstalled("12.0")
103-
return '2012' if @visualStudioIsInstalled("11.0")
104-
return '2010' if @visualStudioIsInstalled("10.0")
105104

106105
visualStudioIsInstalled: (version) ->
107-
fs.existsSync(path.join(@x86ProgramFilesDirectory(), "Microsoft Visual Studio #{version}", "Common7", "IDE"))
106+
if version < 2017
107+
fs.existsSync(path.join(@x86ProgramFilesDirectory(), "Microsoft Visual Studio #{version}", "Common7", "IDE"))
108+
else
109+
fs.existsSync(path.join(@x86ProgramFilesDirectory(), "Microsoft Visual Studio", "#{version}", "BuildTools", "Common7", "IDE")) or fs.existsSync(path.join(@x86ProgramFilesDirectory(), "Microsoft Visual Studio", "#{version}", "Community", "Common7", "IDE")) or fs.existsSync(path.join(@x86ProgramFilesDirectory(), "Microsoft Visual Studio", "#{version}", "Enterprise", "Common7", "IDE")) or fs.existsSync(path.join(@x86ProgramFilesDirectory(), "Microsoft Visual Studio", "#{version}", "Professional", "Common7", "IDE")) or fs.existsSync(path.join(@x86ProgramFilesDirectory(), "Microsoft Visual Studio", "#{version}", "WDExpress", "Common7", "IDE"))
108110

109111
loadNpm: (callback) ->
110112
npmOptions =

src/ci.coffee

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ class Ci extends Command
4848
]
4949
installArgs.push('--verbose') if options.argv.verbose
5050

51-
if vsArgs = @getVisualStudioFlags()
52-
installArgs.push(vsArgs)
53-
5451
fs.makeTreeSync(@atomDirectory)
5552

5653
env = _.extend({}, process.env, {HOME: @atomNodeDirectory, RUSTUP_HOME: config.getRustupHomeDirPath()})

src/command.coffee

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ class Command
112112
env.npm_config_arch = config.getElectronArch()
113113
env.npm_config_target_arch = config.getElectronArch() # for node-pre-gyp
114114

115-
getVisualStudioFlags: ->
116-
if vsVersion = config.getInstalledVisualStudioFlag()
117-
"--msvs_version=#{vsVersion}"
118-
119115
getNpmBuildFlags: ->
120116
["--target=#{@electronVersion}", "--disturl=#{config.getElectronUrl()}", "--arch=#{config.getElectronArch()}"]
121117

src/dedupe.coffee

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ class Dedupe extends Command
4343
dedupeArgs.push('--silent') if options.argv.silent
4444
dedupeArgs.push('--quiet') if options.argv.quiet
4545

46-
if vsArgs = @getVisualStudioFlags()
47-
dedupeArgs.push(vsArgs)
48-
4946
dedupeArgs.push(packageName) for packageName in options.argv._
5047

5148
fs.makeTreeSync(@atomDirectory)

src/install.coffee

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ class Install extends Command
7171
installArgs.push('--production') if options.argv.production
7272
installArgs.push('--verbose') if options.argv.verbose
7373

74-
if vsArgs = @getVisualStudioFlags()
75-
installArgs.push(vsArgs)
76-
7774
fs.makeTreeSync(@atomDirectory)
7875

7976
env = _.extend({}, process.env, {HOME: @atomNodeDirectory, RUSTUP_HOME: config.getRustupHomeDirPath()})
@@ -166,9 +163,6 @@ class Install extends Command
166163
installArgs.push('--quiet') if options.argv.quiet
167164
installArgs.push('--production') if options.argv.production
168165

169-
if vsArgs = @getVisualStudioFlags()
170-
installArgs.push(vsArgs)
171-
172166
fs.makeTreeSync(@atomDirectory)
173167

174168
env = _.extend({}, process.env, {HOME: @atomNodeDirectory, RUSTUP_HOME: config.getRustupHomeDirPath()})
@@ -379,9 +373,6 @@ class Install extends Command
379373
buildArgs.push(path.resolve(__dirname, '..', 'native-module'))
380374
buildArgs.push(@getNpmBuildFlags()...)
381375

382-
if vsArgs = @getVisualStudioFlags()
383-
buildArgs.push(vsArgs)
384-
385376
fs.makeTreeSync(@atomDirectory)
386377

387378
env = _.extend({}, process.env, {HOME: @atomNodeDirectory, RUSTUP_HOME: config.getRustupHomeDirPath()})

src/rebuild.coffee

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ class Rebuild extends Command
3838
rebuildArgs.push(@getNpmBuildFlags()...)
3939
rebuildArgs.push(options.argv._...)
4040

41-
if vsArgs = @getVisualStudioFlags()
42-
rebuildArgs.push(vsArgs)
43-
4441
fs.makeTreeSync(@atomDirectory)
4542

4643
env = _.extend({}, process.env, {HOME: @atomNodeDirectory, RUSTUP_HOME: config.getRustupHomeDirPath()})

0 commit comments

Comments
 (0)