
    擖gu                        S r SSKrSSKrSSKrSSKrSSKrSSKJr  SSKr	SSK
r	\R                  " S5      rSS jrS rS rS rS	 rS
 rS rS rS r " S S5      rS r " S S5      rSqS rS rS rS rS rS rS r S r!S r"g)zg
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
    N)
OrderedSetz(\\*)"c                    U R                  S5      S:  d  U R                  S5      S:  a  [        R                  R	                  U 5      n U(       a  [
        R                  S U 5      n U R                  SS5      n U(       a  SU  S3$ U $ )zQuote a command line argument so that it appears as one argument when
processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for
Windows programs)./r      c                 0    SU R                  S5      -  S-   $ )N   r   \")group)mos    4/usr/lib/python3/dist-packages/gyp/msvs_emulation.py<lambda>!QuoteForRspFile.<locals>.<lambda>)   s    !bhhqk/E2I    %z%%")findcountospathnormpathwindows_quoter_regexsubreplace)arg	quote_cmds     r   QuoteForRspFiler      s{     xx}qCIIcNQ.ggs#
 "&&'I3O ++c4
 C  3%qzJr   c                 L  ^ U (       d  gU S   R                  S5      (       a=  U S   R                  SS5      u  p#US-   [        R                  R	                  U5      -   nO"[        R                  R	                  U S   5      nUS-   SR                  U4S jU SS  5       5      -   $ )z6Process a list of arguments using QuoteCmdExeArgument. r   zcall  r   c              3   <   >#    U  H  n[        UT5      v   M     g 7fN)r   ).0r   r   s     r   	<genexpr>$EncodeRspFileList.<locals>.<genexpr>N   s     K(3sI66(s   N)
startswithsplitr   r   r   join)argsr   callprograms    `  r   EncodeRspFileListr+   ?   s     Aw'""Qc1-*rww//88''""47+cMhhK$qr(KKL Mr   c                 h    U (       d  U$ U(       d  U $ [        U R                  US   5      XSS 5      $ )zGiven a list of dictionary keys |path| and a tree of dicts |root|, find
value at path, or return |default| if any of the path doesn't exist.r   r   N)_GenericRetrieveget)rootdefaultr   s      r   r-   r-   Q   s4     DHHT!W-wQRAAr   c                 ~    U c  U $ [        U [        [        45      (       a  U  Vs/ s H  o!U-   PM	     sn$ X-   $ s  snf )zDAdd |prefix| to |element| or each subelement if element is iterable.)
isinstancelisttuple)elementprefixes      r   
_AddPrefixr8   [   sB    'D%=))$+,Gq
G,, -s   :c           	          Ubf  U bc  [        U5      (       d  UR                  n[        U [        [        45      (       a$  [        SU  Vs/ s H
  o!" U5      PM     sn5      n U $ U" U 5      n U $ s  snf )zIf |element| then remap it through |map|. If |element| is iterable then
each item will be remapped. Any elements not found will be removed.N)callabler.   r2   r3   r4   filter)r5   mapelems      r   _DoRemappingr>   f   sm     7.}}''Cge}--T'#B'$CI'#BCG N 'lGN $Cs   A,
c                     U bB  Ub?  [        U[        [        45      (       a  U R                  U5        gU R	                  U5        gU$ )zIf |append| is None, simply return |element|. If |append| is not None,
then add |element| to it, adding each item in |element| if it's a list or
tuple.N)r2   r3   r4   extendappend)rA   r5   s     r   _AppendOrReturnrB   s   s=     g1ge}--MM'"MM'"r   c                     [        [        S5      (       a  [        R                  $ [        R                  R                  S5      n U (       d  / SQn[        R                  " U[        R                  [        R                  S9nUR                  5       S   R                  S5      nUR                  5        H"  nSU;   d  M  UR                  S5      S	   S
-   n M$     U [        l        U $ )zTry to find an installation location for the DirectX SDK. Check for the
standard environment variable, and if that doesn't exist, try to find
via the registry. May return None if not found in either location.	dxsdk_dir	DXSDK_DIR)zreg.exequeryzHKLM\Software\Microsoft\DirectXz/s)stdoutstderrr   utf-8InstallPathz       \)hasattr_FindDirectXInstallationrD   r   environr.   
subprocessPopenPIPEcommunicatedecode
splitlinesr&   )rD   cmdprG   lines        r   rN   rN      s    
 '55'111

{+ILSQ#**73%%'D$ JJv.q1D8	 (
 *3&r   c                 8   0 nU R                  5       (       aG  U R                  5       US'   [        R                  R                  U R                  5       S5      S-   US'   [	        5       nU(       a  UOSUS'   [        R
                  R                  SS5      US'   U$ )	zGet a dict of variables mapping internal VS macro names to their gyp
equivalents. Returns all variables that are independent of the target.z$(VSInstallDir)VCrL   z$(VCInstallDir)r   z$(DXSDK_DIR)WDK_DIRz
$(WDK_DIR))Pathr   r   r'   rN   rO   r.   )
vs_versionenvrD   s      r   GetGlobalVSMacroEnvr_      s     C !+!2!#joo.?!F!M
 )*I'0)bC 

y"5CJr   c           	         [        U S   R                  S/ 5      5      nU SS  H#  nUR                  S/ 5      nU[        U5      -  nM%     U(       d  g[        [        U5      5      n[        U Vs/ s H  n[	        Xe5      PM     sn5      n[        S U 5       5      (       a  gU  H;  nUR                  S/ 5      nU(       d  M  U V	s/ s H  oU;  d  M
  U	PM     n
n	XS'   M=     U$ s  snf s  sn	f )zFinds msvs_system_include_dirs that are common to all targets, removes
them from all targets, and returns an OrderedSet containing them.r   msvs_system_include_dirsr   Nc              3   ,   #    U  H
  nS U;   v   M     g7f)$N )r"   includes     r   r#   2ExtractSharedMSVSSystemIncludes.<locals>.<genexpr>   s     
B)Ag3'>)A   )r   r.   r_   GetVSVersionExpandMacrosany)configsgenerator_flagsall_system_includesconfigsystem_includesr^   re   expanded_system_includesincludesinew_includess              r   ExtractSharedMSVSSystemIncludesrt      s     %WQZ^^4NPR%ST!"+ **%?D1J4OO  
l?;
<C)3FG3Fg	#3FG  
B)A
BBB ::8"=8'/Px!<O3OAxLP1=-.  $# 	H Qs   0C'	C,C,c                   d   \ rS rSrSrS rS rS4S jrS4S jrS r	S	 r
 " S
 S5      rS rS rS5S jr S5S jrS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS  r S! r!S" r"S# r#S$ r$S% r%S& r&S' r'S( r(S) r)\*RV                  " S*S+S,/5      r,S- r-S. r.S/ r/S0 r0S1 r1S2 r2S3r3g)6MsvsSettings   zA class that understands the gyp 'msvs_...' values (especially the
msvs_settings field). They largely correpond to the VS2008 IDE DOM. This
class helps map those settings to command line options.c           	      N   Xl         [        U5      U l        S[        4S[        4S[        4S[        4S[
        4S[
        4S[
        4S[
        4/nUS	   nU HL  u  pV[        X0 5        UR                  5        H'  u  pxUR                  XV" 5       5      [        X5      U'   M)     MN     UR                  S
S/5      U l
        SS/n	/ n
U	 H9  nUR                  5        H"  nXX;   d  M
  U
SR                  XQS   5      /-  n
M$     M;     U
(       a  [        SR                  U
5      5      eg )Nmsvs_configuration_attributesmsvs_settingsra   msvs_disabled_warningsmsvs_precompiled_headermsvs_precompiled_sourcemsvs_configuration_platformmsvs_target_platformconfigurationsmsvs_cygwin_dirs.msvs_prebuildmsvs_postbuildz{} not supported (target {}).target_name
)specrh   r]   dictr3   strsetattritemsr.   getattrr   valuesformat	Exceptionr'   )selfr   rl   supported_fieldsrk   fieldr0   
confignamern   unsupported_fieldsunsupporteds              r   __init__MsvsSettings.__init__   sA   	&7 -d3d#'.%t,&,&,*C0#S)	
 '(.NED$&-mmo"
39::eWY3O$Z0 '6 /
 !%);cU C 
 'E!..*?7>>!#6$ K + ( DIIk233 r   c                     U R                   R                  SS5      nU(       a  U$ [        R                  R                  R                  U R                   S   S5      $ )zReturns the extension for the target, with no leading dot.

Uses 'product_extension' if specified, otherwise uses MSVS defaults based on
the target type.
product_extensionNtyper   )r   r.   gypMSVSUtilTARGET_TYPE_EXT)r   exts     r   GetExtensionMsvsSettings.GetExtension   sG     iimm/6J||++//		&0A2FFr   Nc                    U R                  U5      nUS:X  a  SOUnU R                  R                  SS5      U R                  R                  SU R                  S   5      -   nU(       a  US-   OSnSU R                  5       -   nXW-   nS	S
SUUSU R                  S   UUUU[        R
                  R                  Xh5      S.n	U	R                  [        U R                  5      5        U	$ )zQGet a dict of variables mapping internal VS macro names to their gyp
equivalents.x86Win32product_prefixr   product_namer   rL   r   z${root}z	${source}z$!INTERMEDIATE_DIR)z$(InputName)z$(InputPath)z	$(IntDir)z
$(OutDir)\z$(PlatformName)z$(ProjectDir)\z$(ProjectName)z$(TargetDir)\z$(TargetExt)z$(TargetFileName)z$(TargetName)z$(TargetPath))
GetArchr   r.   r   r   r   r'   updater_   r]   )
r   base_to_buildrn   target_archtarget_platformr   
target_dir
target_exttarget_file_namereplacementss
             r   GetVSMacroEnvMsvsSettings.GetVSMacroEnv   s     ll6*%0E%9'{iimm$4b9DIIMMDIIm4=
 
 .;]T)
4,,..
&3 &'-%.!"ii6(&!1(WW\\*G
 	/@Ar   c                 6    U R                  X#S9n[        X5      $ )z4Convert from VS macro names to something equivalent.rn   )r   ri   )r   sr   rn   r^   s        r   ConvertVSMacrosMsvsSettings.ConvertVSMacros  s        >A##r   c                 .   U Vs/ s H  o"R                  S5      (       a  USS OUPM!     nnU Vs/ s HR  nUR                  5       R                  S5      (       d)  UR                  5       R                  S5      (       d  US-   OUPMT     sn$ s  snf s  snf )z2Strip -l from library if it's specified with that.z-lr   Nz.libz.obj)r%   lowerendswith)r   	librariesliblibss       r   AdjustLibrariesMsvsSettings.AdjustLibraries   s    DMNIS>>$//ABS8IN
 	
  99;''//		8L8LV8T8T &L 	
 	
 O
s   &BABc                 \    [        XU5      n[        Xv5      n[        Xt5      n[        XW5      $ )a  Retrieve a value from |field| at |path| or return |default|. If
|append| is specified, and the item is found, it will be appended to that
object instead of returned. If |map| is specified, results will be
remapped through |map| before being returned or appended.)r-   r>   r8   rB   )r   r   r   r0   r6   rA   r<   results           r   _GetAndMungeMsvsSettings._GetAndMunge*  s/    
 "%$7f*F+v..r   c                   (    \ rS rSrSS jrSS jrSrg)MsvsSettings._GetWrapperi4  Nc                 8    Xl         X l        U/U l        X@l        g r!   )parentr   	base_pathrA   )r   r   r   r   rA   s        r   r   !MsvsSettings._GetWrapper.__init__5  s     KJ'[DN Kr   c           	          U R                   R                  U R                  U R                  U/-   UUU R                  US9$ )N)r0   r6   rA   r<   )r   r   r   r   rA   )r   namer<   r6   r0   s        r   __call__!MsvsSettings._GetWrapper.__call__;  sC    ;;++

$'{{ ,  r   )rA   r   r   r   r!   )Nr   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__rd   r   r   _GetWrapperr   4  s    	!	r   r   c                     U R                   R                  US5      nU R                  R                  US5      nU(       d  UnSSSS.R                  US5      $ )znGet architecture based on msvs_configuration_platform and
msvs_target_platform. Returns either 'x86' or 'x64'.r   r   x64arm64)r   r   ARM64)r~   r.   r   )r   rn   configuration_platformplatforms       r   r   MsvsSettings.GetArchE  sW     "&!A!A!E!Efb!Q,,00<-Huw?CCHeTTr   c                    [        U R                  R                  5      S:  a  U$ U R                  U5      nUS:X  a  UR	                  S5      (       d  US-  nUS:X  a+  UR	                  S5      (       a  UR                  SS5      S   nU$ )z*Returns the target-specific configuration.i  r   _x64r   _r   r   )intr]   
short_namer   r   rsplit)r   rn   archs      r   _TargetConfigMsvsSettings._TargetConfigO  s~     t))*d2M ||F#5=!8!8fF5=V__V44]]3*1-Fr   c                 D    U R                  U R                  U   XXEU5      $ )z_GetAndMunge for msvs_settings.)r   rz   r   r   rn   r0   r6   rA   r<   s          r   _SettingMsvsSettings._Settinga  s)      v&vs
 	
r   c                 H    U R                  U R                  U   UUUUU5      $ )z/_GetAndMunge for msvs_configuration_attributes.)r   ry   r   s          r   _ConfigAttribMsvsSettings._ConfigAttribg  s4       ..v6
 	
r   c                     U R                  U5      nXR                  U   -   nUR                  U R                  SU/ S95        U Vs/ s H  o@R	                  XBS9PM     sn$ s  snf )zuUpdates include_dirs to expand VS specific paths, and adds the system
include dirs used for platform SDK and similar.)VCCLCompilerToolAdditionalIncludeDirectoriesr0   r   r   ra   r@   r   r   )r   include_dirsrn   rq   rW   s        r   AdjustIncludeDirsMsvsSettings.AdjustIncludeDirst  st     ##F+"?"?"GGMMDfVX  	

 AII1$$Q$6III   A"c                     U R                  U5      nXR                  U   -   nUR                  U R                  SU/ S95        U Vs/ s H  o@R	                  XBS9PM     sn$ s  snf )zzUpdates midl_include_dirs to expand VS specific paths, and adds the
system include dirs used for platform SDK and similar.)
VCMIDLToolr   r   r   r   )r   midl_include_dirsrn   rq   rW   s        r   AdjustMidlIncludeDirs"MsvsSettings.AdjustMidlIncludeDirs  st     ##F+$'D'DV'LLMM>PR  	

 AII1$$Q$6IIIr   c                    U R                  U5      n/ nU R                  S/U5      S:X  a  UR                  S5        U R                  S/U5      S:X  a  UR                  S5        UR                  U R	                  SU/ S95        U$ )z\Returns the set of defines that are injected to the defines list based
on other VS settings.CharacterSet1)_UNICODEUNICODE2_MBCS)r   PreprocessorDefinitionsr   )r   r   r@   rA   r   )r   rn   definess      r   GetComputedDefinesMsvsSettings.GetComputedDefines  s     ##F+~.73>NN23~.73>NN7#MM?QS  	

 r   c                     U R                  U5      nU R                  SU5      nU(       a  U" U R                  U5      5      nU$ )zrGet the pdb file name that should be used for compiler invocations, or
None if there's no explicit name specified.)r   ProgramDataBaseFileNamer   r   r   )r   rn   expand_specialpdbnames       r   GetCompilerPdbNameMsvsSettings.GetCompilerPdbName  sC     ##F+-- OQWX$T%9%9'%BCGr   c                     U R                  U5      nU R                  SU5      nU(       a  U" U R                  X1S95      nU$ )zZGets the explicitly overridden map file name for a target or returns None
if it's not set.)VCLinkerToolMapFileNamer   r  )r   rn   r  map_files       r   GetMapFileNameMsvsSettings.GetMapFileName  sE     ##F+==!@&I%d&:&:8&:&STHr   c                     U R                  U5      nU R                  S   nUS:X  a  SOSnU R                  US4U5      nU(       a  U" U R                  XQS95      nU$ )z_Gets the explicitly overridden output name for a target or returns None
if it's not overridden.r   static_libraryVCLibrarianToolr
  
OutputFiler   )r   r   r   r   )r   rn   r  r   r/   output_files         r   GetOutputNameMsvsSettings.GetOutputName  sm     ##F+yy $(,<$< .mmT<$8&A($$[$@K r   c                     U R                  U5      nU R                  SU5      nU R                  SU5      nUS:X  a  U(       a  U" U R                  XAS95      $ U$ g)zGets the explicitly overridden pdb name for a target or returns
default if it's not overridden, or if no pdb will be generated.)r
  ProgramDatabaseFile)r
  GenerateDebugInformationtruer   Nr  )r   rn   r  r0   r  generate_debug_infos         r   
GetPDBNameMsvsSettings.GetPDBName  sg     ##F+mm$KVT"mm8&
 &(%d&:&:;&:&VWWr   c                 R    U R                  U5      nU R                  SU5      nUS:H  $ )zXIf NoImportLibrary: true, ninja will not expect the output to include
an import library.)NoImportLibraryr  r   r   )r   rn   noimplibs      r   GetNoImportLibraryMsvsSettings.GetNoImportLibrary  s0     ##F+==!5v>6!!r   c                 ~    U R                  U5      n/ nU R                  SU5      nUS:X  a  UR                  S5        U$ )z:Returns the flags that need to be added to ml invocations.)MASMUseSafeExceptionHandlersr  z/safeseh)r   r   rA   )r   rn   asmflagssafesehs       r   GetAsmflagsMsvsSettings.GetAsmflags  sA    ##F+-- DfMfOOJ'r   c           	      6   U R                  U5      n/ nUR                  U R                  U    Vs/ s H  nSU-   PM
     sn5        U R                  X R                  U   SUS9nU" SSSSSS	.S
SS9  U" SSS9  U" SSS9  U" SSS0S9  U" SSS0S9  U" SSSS.SS9  U" SSSS.SS9  U" SSS S!.S
S9  U" S"S#S$S%S&.S'S(S9  U" S)SS*S.S9  U" S+SS,0S9  U" S-S.S9  U" S/SS00S9  U" S1SS2S3S4S	.S5S9  U" S6S7S8S9S:.S;S9  U" S<S=S>S?.S9  U" S@SASBS?.S9  U" SCSSD0S9  U" SESFSGS?.S9  U" SHS SISSJ.SKS9  U" SLSMSNSOSPS	.SQS9  U" SRSSSTS!.SUS9  U" SVSSW0S9  U" SXSSS.SYS9  U" SZSS[0S9  U" S\SS9  U" S]S^S_S`SaSbSc.SdS9  UR                  U R                  SeU/ Sf9 Vs/ s H  nSgU-   PM
     sn5        [        U R                  R                  5      Sh:  a  UR                  Si5        U Vs/ s H  ofR                  Sj5      (       a  M  UPM     nnU$ s  snf s  snf s  snf )kzCReturns the flags that need to be added to .c and .cc compilations.z/wdr   rA   Optimizationdr   r   x)0r   r   3z/Or<   r6   r0   InlineFunctionExpansionz/Obr6   DisableSpecificWarningsStringPoolingr  z/GFr<   EnableFiberSafeOptimizationsz/GTOmitFramePointers-r   falser  z/Oyr<   r6   EnableIntrinsicFunctionsz/OiFavorSizeOrSpeedtr   r   r   FloatingPointModelprecisestrictfastr/  r   r   z/fp:r/  CompileAsManagedz/clrWholeProgramOptimizationz/GLWarningLevelz/WWarnAsError/WXCallingConventionrzvz/GDebugInformationFormat7rr   I)r   r0  4z/ZRuntimeTypeInfoz/GRz/GR-r  r;  EnableFunctionLevelLinkingz/Gyz/Gy-MinimalRebuildz/GmBufferSecurityCheckz/GSz/GS-BasicRuntimeChecksu)r   r   r0  z/RTCRuntimeLibraryTTdDDdz/MExceptionHandlingscaz/EHDefaultCharIsUnsignedz/JTreatWChar_tAsBuiltInTypez/Zc:wchar_tEnablePREfastz/analyzeAdditionalOptionsEnableEnhancedInstructionSetSSESSE2AVXIA32AVX2)r   r   r0  rR  5z/arch:)r   ForcedIncludeFilesr   /FIg      (@z/FSz/MP)r   r@   r{   r   rz   r   floatr]   project_versionrA   r%   )r   rn   cflagswclfr.  s          r   	GetCflagsMsvsSettings.GetCflags  s   ##F+$*E*Ef*MN*MQuqy*MNO$$V,.@  
 	#C8		
 	$U3
$U3
?0
)?
c2$>uM
%S"+EeT
3#7E
 hV<		
 	R#@A
%FE?;
>$'
=vuo.
#C8	

 	#s3)GPTU
56"BC
'ef-MN
&%1
 uv&FG
3Ss%CFS
3T:	

 	$S$9%H
"7
'r* 	

 	? 45
r*
*&u6O	

 	 >PR ' A 		
 001T9 MM% #?V<<+>!V?Q Ot @s   HH%HHc                 R   U R                  U5      nU R                  U   (       a  [        R                  R	                  U R
                  U   5      S   n[        X25      (       aB  U R                  U   n[        R                  R                  U5      S   nSU-   SU-   SU-   S-   /$ / $ )zGGet the flags to be added to the cflags for precompiled header support.r   z/Yurn  z/Fp${pchprefix}.z.pch)r   r|   r   r   splitextr}   _LanguageMatchesForPchr&   )r   rn   	extension
source_extpchpchbases         r   _GetPchFlagsMsvsSettings._GetPchFlags*  s    ##F+ ''/))$*F*Fv*NOPQRJ%j<<226:''--,Q/US[2Dw2NQW2WXX	r   c                 H    U R                  U5      nU R                  US5      $ )z;Returns the flags that need to be added to .c compilations..cr   r~  r   rn   s     r   
GetCflagsCMsvsSettings.GetCflagsC8  s%    ##F+  ..r   c                 P    U R                  U5      nS/U R                  US5      -   $ )z<Returns the flags that need to be added to .cc compilations.z/TP.ccr  r  s     r   GetCflagsCCMsvsSettings.GetCflagsCC=  s,    ##F+w**65999r   c                    U R                  U5      nU R                  US4U/ S9nU Vs/ s H5  n[        R                  R	                  U" U R                  XRS95      5      PM7     nnU Vs/ s H  nSU-   S-   PM     sn$ s  snf s  snf )zLGet and normalize the list of paths in AdditionalLibraryDirectories
setting.AdditionalLibraryDirectoriesr   r   z
/LIBPATH:"r   )r   r   r   r   r   r   )r   r/   rn   gyp_to_build_pathlibpathsrW   s         r    _GetAdditionalLibraryDirectories-MsvsSettings._GetAdditionalLibraryDirectoriesB  s     ##F+==12FB ! 

 
 GG.t/C/CA/C/UVW 	 
 1991q 3&99	
 :s   <B +Bc                     U R                  U5      n/ nU R                  X R                  U   SUS9nUR                  U R	                  SX5      5        U" SSS0S9  U" SSS	S
S.SS9  U" S5        U$ )z8Returns the flags that need to be added to lib commands.r  r+  LinkTimeCodeGenerationr  /LTCGr6  TargetMachineX86X64ARM)r   17r0  	/MACHINE:r<  re  )r   r   rz   r@   r  )r   rn   r  libflagsr   s        r   GetLibFlagsMsvsSettings.GetLibFlagsO  s    ##F+$$V,.?  
 	11!6	

 	$67*;<5u5	

 	 r   c                 .   U R                   nUS   S;   a{  UR                  S/ 5       Vs/ s H*  o3R                  5       R                  S5      (       d  M(  UPM,     nn[	        U5      S:X  a  U" US   5      $ [	        U5      S:  a  [        S5      egs  snf )	zDReturns the .def file from sources, if any.  Otherwise returns None.r   )shared_libraryloadable_module
executablesourcesz.defr   r   zMultiple .def filesN)r   r.   r   r   lenr   )r   r  r   r   	def_filess        r   
GetDefFileMsvsSettings.GetDefFiled  s    yy<NN88Ir22aggi6H6H6P2   9~"(166Y!# 566s   'BBc                 ^    U R                  U5      nU(       a  UR                  SU-  5        gg)z~.def files get implicitly converted to a ModuleDefinitionFile for the
linker in the VS generator. Emulate that behaviour here.z	/DEF:"%s"N)r  rA   )r   ldflagsr  def_files       r   _GetDefFileAsLdflags!MsvsSettings._GetDefFileAsLdflagsq  s,     ??#45NN;12 r   c                     U R                  U5      nU R                  SU5      nU(       a  U" U R                  X1S95      nU$ )z\Gets the explicitly overridden pgd name for a target or returns None
if it's not overridden.)r
  ProfileGuidedDatabaser   r  )r   rn   r  r  s       r   
GetPGDNameMsvsSettings.GetPGDNamex  sK     ##F+mm$MvV($$[$@K r   c                 B   U R                  U5      n/ nU R                  X R                  U   SUS9n	U R                  X5        U	" SSS0S9  U	" SSS	S
SS.SS9  UR	                  U R                  SX5      5        U	" SSS9  U	" SSSSS.S9  U R                  X5      n
U
(       a  UR                  SU
-   5        U R                  XUS-   5      nU(       a  UR                  SU-   5        U R                  X5      nU(       a  UR                  SU-   5        U R                  X5      nU	" SSU(       a  SU-   OS0S9  U	" SSS 0S9  U	" S!SS9  U R                  S"USS#9nU(       a  S$U-   nU	" S%S&U-  S'U-  S(.S)S9  U R                  S*USS#9nU(       a3  U R                  S+USS#9nU(       a  S$U-   nUR                  S,U U 35        U	" S-SSS(.S.S9  U	" S/SSS(.S0S9  U	" S1S2S9  U	" S3SSS(.S4S9  U	" S5SSS(.S6S9  U	" S7SSS(.S8S9  U	" S9S:S;S(.S<S9  U	" S=S>S9  U	" S?S@SAS(.S<S9  U	" SBSSCSDSESF.SGS9  U	" SHSIS9  U	" SJSSK0S9  U	" SLSMS9  U	" SNSSO0S9  U	" SPSSS(.SQS9  U	" SRSS9  U R                  U5      SS:X  a  SOSTnU	" SUSSSV.SWUSX9  [        SY U 5       5      (       d  UR                  S65        [        SZ U 5       5      (       d  UR                  S85        [        S[ U 5       5      nU R                  UUUU=(       a    U(       + U5      u  nnnUR	                  U5        UUU4$ )\zQReturns the flags that need to be added to link commands, and the
manifest files.r
  r+  r  r  z/DEBUGr6  r  r  r  r  r   )r   r  r0  18r  r<  DelayLoadDLLsz/DELAYLOAD:r3  TreatLinkerWarningAsErrorsrJ  r   z:NOrT  r6   r<   z/OUT:z.pdbz/PDB:z/PGD:GenerateMapFilez/MAP:z/MAP
MapExportsz/MAPINFO:EXPORTSre  )r
  MinimumRequiredVersionr   ,	SubSystemz	CONSOLE%sz	WINDOWS%sr@  z/SUBSYSTEM:)r
  StackReserveSize)r
  StackCommitSizez/STACK:TerminalServerAwarez/TSAWARELinkIncrementalz/INCREMENTALBaseAddressz/BASE:FixedBaseAddress/FIXEDRandomizedBaseAddressz/DYNAMICBASEDataExecutionPreventionz	/NXCOMPATOptimizeReferencesNOREFREFz/OPT:ForceSymbolReferencesz	/INCLUDE:EnableCOMDATFoldingNOICFICFr  z:PGINSTRUMENTz:PGOPTIMIZEz	:PGUPDATE)r   r   r0  rR  r  IgnoreDefaultLibraryNamesz/NODEFAULTLIB:ResourceOnlyDLLz/NOENTRYEntryPointSymbolz/ENTRY:Profilez/PROFILELargeAddressAwarez/LARGEADDRESSAWAREAdditionalDependenciesr   NImageHasSafeExceptionHandlersr:  z/SAFESEHr1  c              3   D   #    U  H  nS U;   =(       d    US:H  v   M     g7f)DYNAMICBASEr  Nrd   r"   flags     r   r#   *MsvsSettings.GetLdflags.<locals>.<genexpr>  s"     Q=D(<DH,<<    c              3   ,   #    U  H
  nS U;   v   M     g7f)NXCOMPATNrd   r  s     r   r#   r    s     :'$:%'rg   c              3   B   #    U  H  oR                  S 5      v   M     g7f)z/DEF:N)r%   r  s     r   r#   r    s     IOOG44s   )r   r   rz   r  r@   r  r  rA   r  r  r  r   r   rj   _GetLdManifestFlags)r   rn   r  r  manifest_base_nameoutput_nameis_executable	build_dirr  ldoutpdbpgdr  minimum_required_versionstack_reserve_sizestack_commit_sizesafeseh_defaulthave_def_filemanifest_flagsintermediate_manifestmanifest_filess                         r   
GetLdflagsMsvsSettings.GetLdflags  s    ##F+$$V,nW  
 	!!'=
%FH+=> 	5uGD	

 	11	

 	?=1
'BQV;WX  8NN7S=)oofkF6JKNN7S=)oof5NN7S=)&&v>
67X+=v"VW
<f&89:
r*#'==6 $1 $
  $'*-E'E$
 #;; #;; !	
 "]]0&" + 
  $3VR !. ! !$'*;$;!NNW%7$89J8KLM
 E&;JO
B"7O
=*
R#8J
"e"(=nU
$B*?T
7%?P
";7
 G%&@Q
$]U	

 	&/?@
6:"67
i0
96:./
%b$9BVW
#B/$(LL$8E$A&t
+,#		
 QQQQNN>* :':::NN;'III
 $$/-/
		
! 	~&-~==r   c                    U R                  SUSS9nUS:w  a  S// / 4$ US-   nSSU-   /nUR                  S5        U R                  U5      nU R                  S	USS9n	/ n
S
nU	S:X  a=  U R                  SUSS9nSSSS.nU R                  SUSS9nSR                  X   U5      nOSnX-  nUS-   n[        R
                  R                  UU5      n[        R                  R                  U5        [        R                  R                  U5      nUR                  U5        UR                  5         U/n
U(       a  UR                  S5        XR                  X5      -  n
XU
4$ )aR  Returns a 3-tuple:
- the set of flags that need to be added to the link to generate
  a default manifest
- the intermediate manifest that the linker will generate that should be
  used to assert it doesn't add anything to the merged one.
- the list of all the manifest files to be merged by the manifest tool and
  included into the link.)r
  GenerateManifestr  r   z/MANIFEST:NOz.intermediate.manifestz	/MANIFESTz/ManifestFile:z/MANIFESTUAC:NO)r
  	EnableUACz<?xml version='1.0' encoding='UTF-8' standalone='yes'?><assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>%s</assembly>)r
  UACExecutionLevelr/  	asInvokerhighestAvailablerequireAdministratorrE  )r
  UACUIAccessr;  z
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  <security>
    <requestedPrivileges>
      <requestedExecutionLevel level='{}' uiAccess='{}' />
    </requestedPrivileges>
  </security>
</trustInfo>r   z.generated.manifestz/ALLOWISOLATION)r   rA   r   r   r   r   r'   r   commonEnsureDirExistsWriteOnDiffwriteclose_GetAdditionalManifestFiles)r   rn   r   r  allow_isolationr  generate_manifestr  flags
enable_uacr  generated_manifest_outerexecution_levelexecution_level_map	ui_accessinnergenerated_manifest_contentsgenerated_namebuild_dir_generated_namert  s                       r   r   MsvsSettings._GetLdManifestFlags  s    !MM0&& * 
 & ##R++55{*
 	&'##F+]])66 # 

  	!
 "mm5vs , O !'+# / & I #4  E&>&F# 55 $&77<<	>#J 

""#;<JJ""#;<	+,		()LL*+::6UU>11r   c                     U R                  SU/ S9n[        U[        5      (       a  UR                  S5      nU Vs/ s H5  n[        R
                  R                  U" U R                  XAS95      5      PM7     sn$ s  snf )zYGets additional manifest files that are added to the default one
generated by the linker.)VCManifestToolAdditionalManifestFilesr   ;r   )r   r2   r   r&   r   r   r   r   )r   rn   r  filesrt  s        r   r  (MsvsSettings._GetAdditionalManifestFilesc  s     962  
 eS!!KK$E 
 GG.t/C/CA/C/UVW
 	
 
s   <A;c                 R    U R                  U5      nU R                  SU5      nUS:H  $ )zvReturns whether the target should be linked via Use Library Dependency
Inputs (using component .objs of a given .lib).)r
  UseLibraryDependencyInputsr  r  )r   rn   uldis      r   IsUseLibraryDependencyInputs)MsvsSettings.IsUseLibraryDependencyInputsp  s/     ##F+}}KVTv~r   c                 P    U R                  U5      nU R                  SUSS9nUS:H  $ )z6Returns whether manifest should be linked into binary.)r  EmbedManifestr  r   r  )r   rn   embeds      r   IsEmbedManifestMsvsSettings.IsEmbedManifestw  s8    ##F+/  
 r   c                 R    U R                  U5      nU R                  SU5      nUS:g  $ )z:Returns whether the target should be linked incrementally.)r
  r  r   r  )r   rn   link_incs      r   IsLinkIncrementalMsvsSettings.IsLinkIncremental  s-    ##F+==!DfM3r   c                     U R                  U5      n/ nU R                  X R                  U   SUS9nU" SUSS9  UR                  SU" S5      -   5        U" SSS	9  U" S
SS S9  U$ )zPReturns the flags that need to be added to invocations of the resource
compiler.VCResourceCompilerToolr+  r   z/Ir<  r   r   z/dr3  Culturez/lc                 0    [        [        U 5      5      SS  $ )Nr   )hexr   r.  s    r   r   )MsvsSettings.GetRcflags.<locals>.<lambda>  s    SVQRr   r  )r   r   rz   rA   )r   rn   gyp_to_ninja_pathrcflagsrcs        r   
GetRcflagsMsvsSettings.GetRcflags  s     ##F+$$V,.Fw  
 	)/@Nt/445
$T2
9T'@Ar   c                    [         R                  R                  [         R                  R                  X R                  S   5      5      nSU-  R                  SS5      nU Vs/ s H$  oUR                  SS5      R                  SS5      PM&     nnU Vs/ s H  nSUR                  SS	5      -  PM     nnS
R                  U5      nSU-  SU SU S3-   nU$ s  snf s  snf )a3  Build a command line that runs args via cygwin bash. We assume that all
incoming paths are in Windows normpath'd form, so they need to be
converted to posix style for the part of the command line that's passed to
bash. We also have to do some Visual Studio macro emulation here because
various rules use magic VS names for things. Also note that rules that
contain ninja variables cannot be fixed here (for example ${source}), so
the outer generator needs to make sure that the paths that are written out
are in posix style, if the command line will be used here.r   zcd %srL   r   r   r	   z'%s''z'\''r   z1call "%s\setup_env.bat" && set CYGWIN=nontsec && z	bash -c "z ; )r   r   r   r'   r   r   )r   r(   path_to_base
cygwin_dircdra  bash_cmdrV   s           r   BuildCygwinBashCommandLine'MsvsSettings.BuildCygwinBashCommandLine  s     WW%%GGLL'<'<Q'?@

 $--dC8BFG$Q		$$,,S%8$G:>?$Q300$?88D>@:M"S
!,- 	 
 H?s   #+CCRuleShellFlagscygwinquotec           	          [        UR                  SU R                  R                  SS5      5      5      S:g  n[        UR                  SS5      5      nUS:w  d  US:w  d   S5       e[        R	                  X#5      $ )zReturn RuleShellFlags about how the given rule should be run. This
includes whether it should run under cygwin (msvs_cygwin_shell), and
whether the commands should be quoted (msvs_quote_cmd).msvs_cygwin_shellr   r   msvs_quote_cmdz8msvs_quote_cmd=0 only applicable for msvs_cygwin_shell=0)r   r.   r   rv   r.  )r   ruler/  r   s       r   GetRuleShellFlagsMsvsSettings.GetRuleShellFlags  s    
 TXX1"iimm,?CE FIJK
 !1156	A~1 	JI	J,**6==r   c                 N   ^ [        U4S jUR                  S/ 5       5       5      $ )zADetermine if there's an explicit rule for a particular extension.c              3   2   >#    U  H  oS    T:H  v   M     g7f)rz  Nrd   )r"   r4  rz  s     r   r#   <MsvsSettings._HasExplicitRuleForExtension.<locals>.<genexpr>  s     T>Sd$	1>Ss   rulesrj   r.   )r   r   rz  s     `r   _HasExplicitRuleForExtension)MsvsSettings._HasExplicitRuleForExtension  s     TdhhwPR>STTTr   c                 F    [        S UR                  S/ 5       5       5      $ )z:Determine if an action should not run midl for .idl files.c              3   D   #    U  H  oR                  S S5      v   M     g7f)explicit_idl_actionr   N)r.   )r"   actions     r   r#   6MsvsSettings._HasExplicitIdlActions.<locals>.<genexpr>  s!      
?VVJJ,a00?Vr  actionsr;  r   r   s     r   _HasExplicitIdlActions#MsvsSettings._HasExplicitIdlActions  s(     
?Cxx	SU?V
 
 	
r   c                 V    U R                  US5      =(       d    U R                  U5      $ )zDetermine if there's an explicit rule or action for idl files. When
there isn't we need to generate implicit rules to build MIDL .idl files.idl)r<  rE  rD  s     r   HasExplicitIdlRulesOrActions)MsvsSettings.HasExplicitIdlRulesOrActions  s/     00%
 /((.	/r   c                 &    U R                  US5      $ )zDetermine if there's an explicit rule for asm files. When there isn't we
need to generate implicit rules to assemble .asm files.asm)r<  rD  s     r   HasExplicitAsmRules MsvsSettings.HasExplicitAsmRules  s     00u==r   c                 D  ^ ^^ T R                  T5      mT R                  T T R                  T   S5      mSUUU 4S jjnU" SSS9nU" SSS9nU" SS	S9nU" S
SS9nU" SSS9nU" SSS9n	XVXx/n
SU4SU4SU4SU4SU4/nT R                  T5      nUS:X  a  SnSSSUS/nXX4$ )z}Determine the implicit outputs for an idl file. Returns output
directory, outputs, and variables and flags that are required.r   c                 ,   > TR                  T" XS9TS9$ )Nr   r   )r   )r   r0   rn   midl_getr   s     r   midl*MsvsSettings.GetIdlBuildData.<locals>.midl  s    ''(GPV'WWr   TypeLibraryNamez${root}.tlbr   HeaderFileNamez	${root}.hDLLDataFileNamez	dlldata.cInterfaceIdentifierFileNamez${root}_i.cProxyFileNamez${root}_p.cOutputDirectoryr   tlbhdlldataiidproxyr   win32z/charsignedz/envz/Oicfr!   )r   r   rz   r   )r   sourcern   rR  rZ  headerr\  r]  r^  outdiroutput	variablesr   r  rQ  s   ` `           @r   GetIdlBuildDataMsvsSettings.GetIdlBuildData  s     ##F+##D$*<*<V*DlS	X 	X $m<&<(+>0-H_m< '43.CL&M CLe
	 ,,v.e#%O(FOWEy//r   )r   r   r]   )NN)Nr   NN)4r   r   r   r   __doc__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r!  r(  ru  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r$  r,  collections
namedtupler.  r5  r<  rE  rI  rM  rf  r   rd   r   r   rv   rv      s   ?$4L	G:$

/ "U$
 GK

J
J  "L\/
:
:*3	@>D\2|
, !++,<x>QRN>U
/>
0r   rv   c                 T    SnSnX;   =(       a    X;   =(       d    X;   =(       a    X;   $ )N)r  )r  z.cxxz.cpprd   )r{  pch_source_extc_extscc_extss       r   ry  ry    s2    F%G =^%= ;.";r   c                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
PrecompiledHeaderi  zHelper to generate dependencies and build rules to handle generation of
precompiled headers. Interface matches the GCH handler in xcode_emulation.py.
c                     Xl         X l        U R                   R                  U R                     nU" U5      U l        [        R
                  R                  U5      u  pxU" Xu-   5      R                  5       U l        g r!   )	settingsrn   r}   
pch_sourcer   r   rx  r   
output_obj)	r   rr  rn   r  gyp_to_unique_outputobj_extrs  filenamer   s	            r   r   PrecompiledHeader.__init__  s`     !]]::4;;G
+J7gg&&z2.x/ABHHJr   c                 H    U R                   R                  U R                     $ )zIGet the header that will appear in an #include line for all source
files.)rr  r|   rn   )r   s    r   
_PchHeaderPrecompiledHeader._PchHeader	  s     }}44T[[AAr   c                 .   Ub   eU R                  5       (       d  / $ [        R                  R                  U R                  5      S   nU HF  n[        [        R                  R                  U5      S   U5      (       d  M6  SSU R                  4/s  $    / $ )zGiven a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatibility
with make.py on Mac, and xcode_emulation.py.Nr   )rz  r   r   rx  rs  ry  rt  )r   r  objsr   pch_extra  s         r   GetObjDependencies$PrecompiledHeader.GetObjDependencies  s    
 ||  I''""4??3A6F%bgg&6&6v&>q&A7KKtT__566  	r   c                     / $ )zNot used on Windows as there are no additional build steps required
(instead, existing steps are modified in GetFlagsModifications below).rd   )r   r   s     r   GetPchBuildCommands%PrecompiledHeader.GetPchBuildCommands  s	     	r   c                     XR                   :X  a\  SU R                  5       -   /nUS:X  a  S[        XvU-   5      4/U R                  / 4$ US:X  a  S[        XuU-   5      4/U R                  / 4$ / X#4$ )zcGet the modified cflags and implicit dependencies that should be used
for the pch compilation step.z/Yccxx	cflags_cccccflags_c)rs  rz  r<   rt  )	r   inputrd  implicitcommandr  r  r  
pch_outputs	            r   GetFlagsModifications'PrecompiledHeader.GetFlagsModifications!  s    
 OO#$//"334J%!3~:7M#NOPOO 
 D #n6K"LMNOO 
 6##r   )rn   rt  rs  rr  N)r   r   r   r   rh  r   rz  r  r  r  r   rd   r   r   rp  rp    s"    KB

$r   rp  c                     [         (       d.  [        R                  R                  U R	                  SS5      SS9q [         $ )Nmsvs_versionautoF)allow_fallback)r]   r   MSVSVersionSelectVisualStudioVersionr.   )rl   s    r   rh   rh   :  s:    :__>>7 ? 

 r   c                 8    [        U 5      nUR                  5       $ r!   )rh   SetupScript)rl   r   vss      r   _GetVsvarsSetupArgsr  C  s    	o	&B>>r   c                     SU ;   a7  UR                  5        H#  u  p#SU;  d   U5       eU R                  X#5      n M%     U $ )zyExpand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv
for the canonical way to retrieve a suitable dict.rc   z$()r   r   )string
expansionsoldnews       r   ri   ri   H  sF     f}"((*HCs?'C'?^^C-F + Mr   c                    Sn0 nU R                  S5      S:X  a  [        SU -  5      eU R                  5        H  nU H  n[        R                  " US-   UR                  5       5      (       d  M2  UR                  SS5      u  pVUS:X  aA  [        R                  R                  [        R                  5      [        R                  -   U-   nXbUR                  5       '     M     M     S H  nXr;  d  M
  [        SU-  5      e   U$ )	zyExtracts environment variables required for the toolchain to run from
a textual dump output by the cmd.exe 'set' command.)	zgoma_.*re   r   libpathr   pathext
systemroottemptmp=r   z#Invalid output_of_set. Value is:
%sr   r   )
SYSTEMROOTTEMPTMPz:Environment variable "%s" required to be set to valid path)r   r   rU   rematchr   r&   r   r   dirnamesysr  pathsepupper)output_of_setenvvars_to_saver^   rX   envvarvarsettingrequireds           r   _ExtractImportantEnvironmentr  R  s    
O C 31$>NOO((*%Fxxdjjl33#zz#q1V#
 !ggoocnn=

JWTG#*CIIK  & + 235=>  2 Jr   c                 b    SnSnU R                  5        H  u  p4XS-   U-   U-   -  nM     X-  nU$ )zFormat as an 'environment block' directly suitable for CreateProcess.
Briefly this is a list of key=value , terminated by an additional  . See
CreateProcess documentation for more details.r    r  )r   )envvar_dictblocknulkeyvalues        r   _FormatAsEnvironmentBlockr  z  sE     E
C!'')
sU"S(( *	LELr   c                     U R                  5       R                  5        H7  nUR                  S5      (       d  M  U[        S5      S R                  5       s  $    g)zGets the path to cl.exe based on the output of calling the environment
setup batch file, followed by the equivalent of `where`.zLOC:N)striprU   r%   r  )output_of_whererX   s     r   _ExtractCLPathr    sI      %%'224??6""F&,,.. 5r   c                    SnUR                  SS5      (       a  0 nU H  nSXV'   M	     U$ [        U5      n0 nU GH  nUR                  U5      nUR                  S5        [        R
                  " US[        R                  [        R                  S9n	U	R                  5       S   R                  S5      n
U	R                  S:w  a  [        S	XR                  4-  5      e[        U
5      nU(       aA  U[        UR                  S
S5      R                  S5      5      -  nSR                  U5      US
'   [!        U5      nU" ["        R$                  R                  U SU-   5      S5      nUR'                  U5        UR)                  5         UR                  U5      nUR                  S5        [        R
                  " US[        R                  S9n	U	R                  5       S   R                  S5      n[+        U5      XV'   GM     U$ )a  It's not sufficient to have the absolute path to the compiler, linker,
etc. on Windows, as those tools rely on .dlls being in the PATH. We also
need to support both x86 and x64 compilers within the same build (to support
msvs_target_platform hackery). Different architectures require a different
compiler binary, and different supporting environment variables (INCLUDE,
LIB, LIBPATH). So, we extract the environment here, wrap all invocations
of compiler tools (cl, link, lib, rc, midl, etc.) via win_tool.py which
sets up the environment, and then we do not prefix the compiler with
an absolute path, instead preferring something like "cl.exe" in the rule
which will then run whichever the environment setup has put in the path.
When the following procedure to generate environment files does not
meet your requirement (e.g. for custom toolchains), you can pass
"-G ninja_use_custom_environment_files" to the gyp to suppress file
generation and use custom environment files prepared by yourself.)r   r   "ninja_use_custom_environment_filesr   zcl.exe)&&setT)shellrG   rH   rI   z"%s" failed with error %dINCLUDEr   r	  zenvironment.rr  )r  forz%iinz(cl.exe)doz@echozLOC:%~$PATH:i)r  rG   )r.   rh   r  r@   rP   rQ   rR   STDOUTrS   rT   
returncoder   r  r   r&   r'   r  r   r   r  r  r  )toplevel_build_dirrl   ro   open_outarchscl_pathsr   r  r(   popenre  r^   	env_blockrt  rd  s                  r   GenerateEnvironmentFilesr    s   " E?CCD%HN 	o	&BH~~d#M"  Z__Z=N=N
 %%'*11':	q 74AQAQ:RRSS*95 -
	2&,,S11 O !XXo6C	N-c2	RWW\\"4nt6KLcR				 ~~d#Q	
   T*//J""$Q'..w7'/? @ Or   c           	         [        UR                  SS5      5      (       a  [        S U 5      nU Vs/ s H(  n[        R                  R                  X" U5      5      PM*     nnU Vs/ s H+  n[        R                  R                  U5      (       a  M)  UPM-     nnU(       aL  U Vs/ s H"  n[        R                  R                  U5      PM$     n	n[        SSR                  U	5      -  5      eggs  snf s  snf s  snf )a]  Emulate behavior of msvs_error_on_missing_sources present in the msvs
generator: Check that all regular source files, i.e. not created at run time,
exist on disk. Missing files cause needless recompilation when building via
VS, and we want this check to match for people/bots that build using ninja,
so they're not surprised when the VS build fails.msvs_error_on_missing_sourcesr   c                     SU ;  $ )Nrc   rd   r  s    r   r   &VerifyMissingSources.<locals>.<lambda>  s    s!|r   zMissing input files:
%sr   N)	r   r.   r;   r   r   r'   existsr   r   )
r  r  rl   gyp_to_ninjano_specialsr   relativer.  missing
cleaned_ups
             r   VerifyMissingSourcesr    s     ?>BCC3W=FQRkBGGLLLO<kR&@hbggnnQ.?1h@ 8??w!"''**1-wJ?6:9NNOO	 	 DR@ @s   /C0'(C5C5&)C:c                 2   UR                  S0 5      n[        R                  R                  U5      nUR	                  5       U S'   S[
        R                  R                  SS5      ;   d$  S[
        R                  R                  SS5      ;   a  SU S'   g S	U S'   g )
Nrl   MSVS_VERSION64PROCESSOR_ARCHITECTUREr   PROCESSOR_ARCHITEW6432@   MSVS_OS_BITS    )r.   r   msvs_emulationrh   	ShortNamer   rO   )default_variablesparamsrl   r  s       r   CalculateCommonVariablesr    s    jj!2B7O %%22?CL(4(>(>(@n% rzz~~6;;trzz~~ "H @ -/.),..)r   )T)#rh  ri  r   r  rP   r  
gyp.commonr   gyp.MSVSUtilr   gyp.MSVSVersioncompiler   r   r+   r-   r8   r>   rB   rN   r_   rt   rv   ry  rp  r]   rh   r  ri   r  r  r  r  r  r  rd   r   r   <module>r     s   

  	 	  
 !  zz), %PM$B 

.*$8g0 g0T:$ :$z 

%P	/9xP&/r   