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

Commit

Permalink
Merge pull request #892 from DeeDeeG/support_visual_studio_2017_and_2019
Browse files Browse the repository at this point in the history
Better Support for Visual Studio 2017 and 2019
  • Loading branch information
sadick254 authored Jan 29, 2021
2 parents 3df25f9 + 596b3de commit 5576234
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 26 deletions.
10 changes: 6 additions & 4 deletions src/apm.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ module.exports =
# Use the explictly-configured version when set
return process.env.GYP_MSVS_VERSION if process.env.GYP_MSVS_VERSION

return '2019' if @visualStudioIsInstalled("2019")
return '2017' if @visualStudioIsInstalled("2017")
return '2015' if @visualStudioIsInstalled("14.0")
return '2013' if @visualStudioIsInstalled("12.0")
return '2012' if @visualStudioIsInstalled("11.0")
return '2010' if @visualStudioIsInstalled("10.0")

visualStudioIsInstalled: (version) ->
fs.existsSync(path.join(@x86ProgramFilesDirectory(), "Microsoft Visual Studio #{version}", "Common7", "IDE"))
if version < 2017
fs.existsSync(path.join(@x86ProgramFilesDirectory(), "Microsoft Visual Studio #{version}", "Common7", "IDE"))
else
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"))

loadNpm: (callback) ->
npmOptions =
Expand Down
3 changes: 0 additions & 3 deletions src/ci.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ class Ci extends Command
]
installArgs.push('--verbose') if options.argv.verbose

if vsArgs = @getVisualStudioFlags()
installArgs.push(vsArgs)

fs.makeTreeSync(@atomDirectory)

env = _.extend({}, process.env, {HOME: @atomNodeDirectory, RUSTUP_HOME: config.getRustupHomeDirPath()})
Expand Down
4 changes: 0 additions & 4 deletions src/command.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ class Command
env.npm_config_arch = config.getElectronArch()
env.npm_config_target_arch = config.getElectronArch() # for node-pre-gyp

getVisualStudioFlags: ->
if vsVersion = config.getInstalledVisualStudioFlag()
"--msvs_version=#{vsVersion}"

getNpmBuildFlags: ->
["--target=#{@electronVersion}", "--disturl=#{config.getElectronUrl()}", "--arch=#{config.getElectronArch()}"]

Expand Down
3 changes: 0 additions & 3 deletions src/dedupe.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ class Dedupe extends Command
dedupeArgs.push('--silent') if options.argv.silent
dedupeArgs.push('--quiet') if options.argv.quiet

if vsArgs = @getVisualStudioFlags()
dedupeArgs.push(vsArgs)

dedupeArgs.push(packageName) for packageName in options.argv._

fs.makeTreeSync(@atomDirectory)
Expand Down
9 changes: 0 additions & 9 deletions src/install.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ class Install extends Command
installArgs.push('--production') if options.argv.production
installArgs.push('--verbose') if options.argv.verbose

if vsArgs = @getVisualStudioFlags()
installArgs.push(vsArgs)

fs.makeTreeSync(@atomDirectory)

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

if vsArgs = @getVisualStudioFlags()
installArgs.push(vsArgs)

fs.makeTreeSync(@atomDirectory)

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

if vsArgs = @getVisualStudioFlags()
buildArgs.push(vsArgs)

fs.makeTreeSync(@atomDirectory)

env = _.extend({}, process.env, {HOME: @atomNodeDirectory, RUSTUP_HOME: config.getRustupHomeDirPath()})
Expand Down
3 changes: 0 additions & 3 deletions src/rebuild.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ class Rebuild extends Command
rebuildArgs.push(@getNpmBuildFlags()...)
rebuildArgs.push(options.argv._...)

if vsArgs = @getVisualStudioFlags()
rebuildArgs.push(vsArgs)

fs.makeTreeSync(@atomDirectory)

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

0 comments on commit 5576234

Please sign in to comment.