o
    ƒnóc‡  ã                   @  sr   d dl mZ 	 d dlZd dlZddlmZ ddlmZ ddl	m
Z
 dd	lmZ G d
d„ de
ƒZG dd„ deƒZdS )é    )ÚannotationsNé   )Úmesonlibé   )ÚCompileCheckModeé   )ÚGnuLikeCompiler)ÚVisualStudioLikeCompilerc                      sÒ   e Zd ZU dZg ddgddgg g g dœZg dgdgdgdgdgd	gd
œZded< dZd0‡ fdd„Zd1dd„Z	d2dd„Z
d3dd„Zd4dd„Zd5‡ fd!d"„Zd4d#d$„Zd4d%d&„Zd6d(d)„Zd7d+d,„Zd8d.d/„Z‡  ZS )9ÚIntelGnuLikeCompilerzƒ
    Tested on linux for ICC 14.0.3, 15.0.6, 16.0.4, 17.0.1, 19.0
    debugoptimized: -g -O2
    release: -O3
    minsize: -O2
    z-gz
-traceback©ÚplainÚdebugZdebugoptimizedÚreleaseZminsizeZcustomz-O0z-O1z-O2z-O3z-Os©r   Ú0ÚgÚ1Ú2Ú3ÚsúT.Dict[str, T.List[str]]Ú
OPTIM_ARGSÚintelÚreturnÚNonec                   s$   t ƒ  ¡  dd„ dD ƒ| _d| _d S )Nc                 S  s   h | ]}t  |¡’qS © )r   Z	OptionKey)Ú.0Úor   r   ú€home/ych/rk3568/buildroot/output/rockchip_rk3568_recovery/host/lib/python3.10/site-packages/mesonbuild/compilers/mixins/intel.pyÚ	<setcomp>P   s    z0IntelGnuLikeCompiler.__init__.<locals>.<setcomp>)Zb_pchZb_lundefZ
b_asneededZb_pgoZ
b_coverageZb_ndebugZb_staticpicZb_pieÚnone)ÚsuperÚ__init__Zbase_optionsÚlang_header©Úself©Ú	__class__r   r   r"   I   s   

zIntelGnuLikeCompiler.__init__Ústrc                 C  s   dS )NZpchir   r$   r   r   r   Úget_pch_suffixU   s   z#IntelGnuLikeCompiler.get_pch_suffixÚpch_dirÚheaderúT.List[str]c              	   C  s    ddt j |¡d| jd|ddg	S )Nz-pchz-pch_dirz-xz-includer    )ÚosÚpathÚjoinr#   )r%   r*   r+   r   r   r   Úget_pch_use_argsX   s   ÿz%IntelGnuLikeCompiler.get_pch_use_argsÚheader_namec                 C  s   t j |¡d |  ¡  S )NÚ.)r-   r.   Úbasenamer)   )r%   r1   r   r   r   Úget_pch_name\   s   z!IntelGnuLikeCompiler.get_pch_namec                 C  s   t  | jd¡r
dgS dgS )Nz>=15.0.0z-qopenmpz-openmp)r   Zversion_compareÚversionr$   r   r   r   Úopenmp_flags_   s   z!IntelGnuLikeCompiler.openmp_flagsÚmoder   c                   s   g d¢}t ƒ  |¡| S )N)ú-diag-errorZ10006r8   Z10148r8   Z10155r8   Z10156r8   Z10157r8   Z10158)r!   Úget_compiler_check_args)r%   r7   Ú
extra_argsr&   r   r   r9   e   s   z,IntelGnuLikeCompiler.get_compiler_check_argsc                 C  ó   dgS )Nz-prof-gen=threadsafer   r$   r   r   r   Úget_profile_generate_argsp   ó   z.IntelGnuLikeCompiler.get_profile_generate_argsc                 C  r;   )Nz	-prof-user   r$   r   r   r   Úget_profile_use_argss   r=   z)IntelGnuLikeCompiler.get_profile_use_argsÚ	buildtypec                 C  ó
   | j | S ©N©Ú
BUILD_ARGS©r%   r?   r   r   r   Úget_buildtype_argsv   ó   
z'IntelGnuLikeCompiler.get_buildtype_argsÚoptimization_levelc                 C  r@   rA   ©r   ©r%   rG   r   r   r   Úget_optimization_argsy   rF   z*IntelGnuLikeCompiler.get_optimization_argsÚnamec                 C  s   ddgS )Nr8   Z1292r   )r%   rK   r   r   r   Ú!get_has_func_attribute_extra_args|   s   z6IntelGnuLikeCompiler.get_has_func_attribute_extra_args)r   r   )r   r(   )r*   r(   r+   r(   r   r,   )r1   r(   r   r(   ©r   r,   ©r7   r   r   r,   ©r?   r(   r   r,   ©rG   r(   r   r,   )rK   r(   r   r,   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rC   r   Ú__annotations__Úidr"   r)   r0   r4   r6   r9   r<   r>   rE   rJ   rL   Ú__classcell__r   r   r&   r   r
   -   s:   
 ú
ù	







r
   c                      sœ   e Zd ZU dZg ddgddgg g g dœZg dgdgdgdgdgd	gd
œZded< dZd#‡ fdd„Zd$dd„Z	d%dd„Z
d&dd„Zd'dd„Zd(d!d"„Z‡  ZS ))ÚIntelVisualStudioLikeCompilerz4Abstractions for ICL, the Intel compiler on Windows.z/Ziz
/tracebackr   z/Odz/O1z/O2z/O3z/Osr   r   r   zintel-clr7   r   r   r,   c                   s(   t ƒ  |¡}|tjur| g d¢¡ |S )N)z/Qdiag-error:10006z/Qdiag-error:10148z/Qdiag-error:10155z/Qdiag-error:10156z/Qdiag-error:10157z/Qdiag-error:10158)r!   r9   r   ZLINKÚextend)r%   r7   Úargsr&   r   r   r9   ™   s   
z5IntelVisualStudioLikeCompiler.get_compiler_check_argsúT.Optional[str]c                 C  s>   t  dg¡\}}}t  |¡ d¡^}}}t|| ƒ}|  |¡S )Nzcl.exer2   )r   Z
Popen_safeZsearch_versionÚsplitÚintZ_calculate_toolset_version)r%   Ú_ÚerrZv1Zv2r5   r   r   r   Úget_toolset_version¦   s   
z1IntelVisualStudioLikeCompiler.get_toolset_versionc                 C  r;   )Nz/Qopenmpr   r$   r   r   r   r6   ¯   r=   z*IntelVisualStudioLikeCompiler.openmp_flagsr?   r(   c                 C  r@   rA   rB   rD   r   r   r   rE   ²   rF   z0IntelVisualStudioLikeCompiler.get_buildtype_argsrG   c                 C  r@   rA   rH   rI   r   r   r   rJ   µ   rF   z3IntelVisualStudioLikeCompiler.get_optimization_argsr+   c                 C  s   t j |¡S rA   )r-   r.   r3   )r%   r+   r   r   r   Úget_pch_base_name¸   s   z/IntelVisualStudioLikeCompiler.get_pch_base_namerN   )r   r[   rM   rO   rP   )r+   r(   r   r(   )rQ   rR   rS   rT   rC   r   rU   rV   r9   r`   r6   rE   rJ   ra   rW   r   r   r&   r   rX   €   s0   
 ú
ù


	

rX   )Ú
__future__r   r-   ÚtypingÚTÚ r   Ú	compilersr   Zgnur   Úvisualstudior	   r
   rX   r   r   r   r   Ú<module>   s   S