@@ -200,7 +200,11 @@ def GetExtension(self):
200200  def  GetVSMacroEnv (self , base_to_build = None , config = None ):
201201    """Get a dict of variables mapping internal VS macro names to their gyp 
202202    equivalents.""" 
203-     target_platform  =  'Win32'  if  self .GetArch (config ) ==  'x86'  else  'x64' 
203+     target_arch  =  self .GetArch (config )
204+     if  target_arch  ==  'x86' :
205+       target_platform  =  'Win32' 
206+     else :
207+       target_platform  =  target_arch 
204208    target_name  =  self .spec .get ('product_prefix' , '' ) +  self .spec .get ('product_name' , self .spec ['target_name' ])
205209    target_dir  =  base_to_build  +  '\\ '  if  base_to_build  else  '' 
206210    target_ext  =  '.'  +  self .GetExtension ()
@@ -276,7 +280,7 @@ def GetArch(self, config):
276280    if  not  platform :  # If no specific override, use the configuration's. 
277281      platform  =  configuration_platform 
278282    # Map from platform to architecture. 
279-     return  {'Win32' : 'x86' , 'x64' : 'x64' }.get (platform , 'x86' )
283+     return  {'Win32' : 'x86' , 'x64' : 'x64' ,  'ARM64' :  'arm64' }.get (platform , 'x86' )
280284
281285  def  _TargetConfig (self , config ):
282286    """Returns the target-specific configuration.""" 
@@ -475,7 +479,10 @@ def GetLibFlags(self, config, gyp_to_build_path):
475479    lib  =  self ._GetWrapper (self , self .msvs_settings [config ], 'VCLibrarianTool' , append = libflags )
476480    libflags .extend (self ._GetAdditionalLibraryDirectories ('VCLibrarianTool' , config , gyp_to_build_path ))
477481    lib ('LinkTimeCodeGeneration' , map = {'true' : '/LTCG' })
478-     lib ('TargetMachine' , map = {'1' : 'X86' , '17' : 'X64' , '3' : 'ARM' }, prefix = '/MACHINE:' )
482+     # TODO: These 'map' values come from machineTypeOption enum, 
483+     # and does not have an official value for ARM64 in VS2017 (yet). 
484+     # It needs to verify the ARM64 value when machineTypeOption is updated. 
485+     lib ('TargetMachine' , map = {'1' : 'X86' , '17' : 'X64' , '3' : 'ARM' , '18' : 'ARM64' }, prefix = '/MACHINE:' )
479486    lib ('AdditionalOptions' )
480487    return  libflags 
481488
@@ -514,7 +521,10 @@ def GetLdflags(self, config, gyp_to_build_path, expand_special, manifest_base_na
514521    ld  =  self ._GetWrapper (self , self .msvs_settings [config ], 'VCLinkerTool' , append = ldflags )
515522    self ._GetDefFileAsLdflags (ldflags , gyp_to_build_path )
516523    ld ('GenerateDebugInformation' , map = {'true' : '/DEBUG' })
517-     ld ('TargetMachine' , map = {'1' : 'X86' , '17' : 'X64' , '3' : 'ARM' }, prefix = '/MACHINE:' )
524+     # TODO: These 'map' values come from machineTypeOption enum, 
525+     # and does not have an official value for ARM64 in VS2017 (yet). 
526+     # It needs to verify the ARM64 value when machineTypeOption is updated. 
527+     ld ('TargetMachine' , map = {'1' : 'X86' , '17' : 'X64' , '3' : 'ARM' , '18' : 'ARM64' }, prefix = '/MACHINE:' )
518528    ldflags .extend (self ._GetAdditionalLibraryDirectories ('VCLinkerTool' , config , gyp_to_build_path ))
519529    ld ('DelayLoadDLLs' , prefix = '/DELAYLOAD:' )
520530    ld ('TreatLinkerWarningAsErrors' , prefix = '/WX' , map = {'true' : '' , 'false' : ':NO' })
@@ -764,7 +774,9 @@ def midl(name, default=None):
764774    output  =  [header , dlldata , iid , proxy ]
765775    variables  =  [('tlb' , tlb ), ('h' , header ), ('dlldata' , dlldata ), ('iid' , iid ), ('proxy' , proxy )]
766776    # TODO(scottmg): Are there configuration settings to set these flags? 
767-     target_platform  =  'win32'  if  self .GetArch (config ) ==  'x86'  else  'x64' 
777+     target_platform  =  self .GetArch (config )
778+     if  target_platform  ==  'x86' :
779+       target_platform  =  'win32' 
768780    flags  =  ['/char' , 'signed' , '/env' , target_platform , '/Oicf' ]
769781    return  outdir , output , variables , flags 
770782
@@ -921,7 +933,7 @@ def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags):
921933  if  generator_flags .get ('ninja_use_custom_environment_files' , False ) or  not  vs .path :
922934    return 
923935
924-   archs  =  ('x86' , 'x64' )
936+   archs  =  ('x86' , 'x64' ,  'arm64' )
925937  for  arch  in  archs :
926938    env  =  _GetEnvironment (arch , vs )
927939    env_block  =  NUL .join (encode (k ) +  '='  +  encode (v ) for  k , v  in  env .items ()) +  NUL  +  NUL 
0 commit comments