@@ -237,7 +237,11 @@ def GetExtension(self):
237237 def GetVSMacroEnv (self , base_to_build = None , config = None ):
238238 """Get a dict of variables mapping internal VS macro names to their gyp
239239 equivalents."""
240- target_platform = 'Win32' if self .GetArch (config ) == 'x86' else 'x64'
240+ target_arch = self .GetArch (config )
241+ if target_arch == 'x86' :
242+ target_platform = 'Win32'
243+ else :
244+ target_platform = target_arch
241245 target_name = self .spec .get ('product_prefix' , '' ) + \
242246 self .spec .get ('product_name' , self .spec ['target_name' ])
243247 target_dir = base_to_build + '\\ ' if base_to_build else ''
@@ -299,7 +303,7 @@ def GetArch(self, config):
299303 if not platform : # If no specific override, use the configuration's.
300304 platform = configuration_platform
301305 # Map from platform to architecture.
302- return {'Win32' : 'x86' , 'x64' : 'x64' }.get (platform , 'x86' )
306+ return {'Win32' : 'x86' , 'x64' : 'x64' , 'ARM64' : 'arm64' }.get (platform , 'x86' )
303307
304308 def _TargetConfig (self , config ):
305309 """Returns the target-specific configuration."""
@@ -563,7 +567,10 @@ def GetLdflags(self, config, gyp_to_build_path, expand_special,
563567 'VCLinkerTool' , append = ldflags )
564568 self ._GetDefFileAsLdflags (ldflags , gyp_to_build_path )
565569 ld ('GenerateDebugInformation' , map = {'true' : '/DEBUG' })
566- ld ('TargetMachine' , map = {'1' : 'X86' , '17' : 'X64' , '3' : 'ARM' },
570+ # TODO: These 'map' values come from machineTypeOption enum,
571+ # and does not have an official value for ARM64 in VS2017 (yet).
572+ # It needs to verify the ARM64 value when machineTypeOption is updated.
573+ ld ('TargetMachine' , map = {'1' : 'X86' , '17' : 'X64' , '3' : 'ARM' , '18' : 'ARM64' },
567574 prefix = '/MACHINE:' )
568575 ldflags .extend (self ._GetAdditionalLibraryDirectories (
569576 'VCLinkerTool' , config , gyp_to_build_path ))
@@ -860,7 +867,9 @@ def midl(name, default=None):
860867 ('iid' , iid ),
861868 ('proxy' , proxy )]
862869 # TODO(scottmg): Are there configuration settings to set these flags?
863- target_platform = 'win32' if self .GetArch (config ) == 'x86' else 'x64'
870+ target_platform = self .GetArch (config )
871+ if target_platform == 'x86' :
872+ target_platform = 'win32'
864873 flags = ['/char' , 'signed' , '/env' , target_platform , '/Oicf' ]
865874 return outdir , output , variables , flags
866875
0 commit comments