@@ -429,6 +429,12 @@ def configuration_dirname(self):
429429 else :
430430 return 'Default'
431431
432+ def configuration_platform (self ):
433+ if self .configuration and '|' in self .configuration :
434+ return self .configuration .split ('|' )[1 ]
435+ else :
436+ return ''
437+
432438 def configuration_buildname (self ):
433439 if self .configuration :
434440 return self .configuration
@@ -802,7 +808,10 @@ def FindVisualStudioInstallation():
802808 '-requires' , 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' ,
803809 ]
804810 vswhere_json = subprocess .check_output (args1 )
805- top_vs_info = json .loads (vswhere_json )[0 ]
811+ vswhere_infos = json .loads (vswhere_json )
812+ if len (vswhere_infos ) == 0 :
813+ raise IOError ("vswhere did not find any MSVS instances." )
814+ top_vs_info = vswhere_infos [0 ]
806815 if top_vs_info :
807816 inst_path = top_vs_info ['installationPath' ]
808817 args2 = ['cmd.exe' , '/d' , '/c' ,
@@ -972,8 +981,6 @@ def build(self, gyp_file, target=None, rebuild=False, clean=False, **kw):
972981 from the specified gyp_file.
973982 """
974983 if '15.0' in self .build_tool or 'Current' in self .build_tool :
975- configuration = '/p:Configuration=' + (
976- self .configuration or self .configuration_buildname ())
977984 build = '/t'
978985 if target not in (None , self .ALL , self .DEFAULT ):
979986 build += ':' + target
@@ -984,19 +991,21 @@ def build(self, gyp_file, target=None, rebuild=False, clean=False, **kw):
984991 elif ':' not in build :
985992 build += ':Build'
986993 arguments = kw .get ('arguments' , [])[:]
987- arguments .extend ([gyp_file .replace ('.gyp' , '.sln' ),
988- build , configuration ])
994+ configuration_arg = '/p:Configuration=%s' % self .configuration_dirname ()
995+ arguments .extend ([gyp_file .replace ('.gyp' , '.sln' ), build , configuration_arg ])
996+ platform = self .configuration_platform ()
997+ if platform :
998+ arguments .append ('/p:Platform=%s' % platform )
989999 else :
990- configuration = self .configuration_buildname ()
1000+ configuration_arg = self .configuration_buildname ()
9911001 if clean :
9921002 build = '/Clean'
9931003 elif rebuild :
9941004 build = '/Rebuild'
9951005 else :
9961006 build = '/Build'
9971007 arguments = kw .get ('arguments' , [])[:]
998- arguments .extend ([gyp_file .replace ('.gyp' , '.sln' ),
999- build , configuration ])
1008+ arguments .extend ([gyp_file .replace ('.gyp' , '.sln' ), build , configuration_arg ])
10001009 # Note: the Visual Studio generator doesn't add an explicit 'all'
10011010 # target, so we just treat it the same as the default.
10021011 if target not in (None , self .ALL , self .DEFAULT ):
0 commit comments