o
    ld                     @  s  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 d	d
lmZ ejr=ddlmZ ddlmZ neZg g g g g g dZg dgdgdgg ddgdgdZg g g g g g dZg g dgdgdgdgdgdZG dd deZG dd deZdS )    )annotationsN   )mesonlib)ArmClangDynamicLinker	OptionKey   clike_debug_args   clang_color_args)Environment)Compiler)plaindebugZdebugoptimizedreleaseZminsizeZcustomz-O0z-gz-O1z-O3z-Otime)r   0g123sz-O2z-Ozc                   @  s   e Zd ZdZdZd,ddZd-dd	Zd.ddZd-ddZd/ddZ	d0ddZ
d1ddZd2ddZd-ddZd3d!d"Zd4d%d&Zd5d)d*Zd+S )6ArmCompilerz9Functionality that is common to all ARM family compilers.armreturnNonec                 C  sN   | j stdg }g ||g  |g  |g  d| _| jd | jd d S )Nz&armcc supports only cross-compilation.)r   r   r   r   Z
everythingr   sx)is_crossr   EnvironmentExceptionZ	warn_argscan_compile_suffixesadd)selfZdefault_warn_args r#   ~home/ych/rk3568/buildroot/output/rockchip_rk3568_recovery/host/lib/python3.10/site-packages/mesonbuild/compilers/mixins/arm.py__init__R   s   
zArmCompiler.__init__T.List[str]c                 C     g S Nr#   r"   r#   r#   r$   get_pic_args_   s   zArmCompiler.get_pic_args	buildtypestrc                 C     t | S r(   )arm_buildtype_argsr"   r+   r#   r#   r$   get_buildtype_argsc      zArmCompiler.get_buildtype_argsc                 C  r'   r(   r#   r)   r#   r#   r$   get_always_argsg      zArmCompiler.get_always_args	outtargetoutfilec                 C  s   d|d|dgS )Nz--depend_targetz--dependz--depend_single_liner#   r"   r4   r5   r#   r#   r$   get_dependency_gen_argsj      z#ArmCompiler.get_dependency_gen_argspch_dirheaderc                 C  r'   r(   r#   r"   r9   r:   r#   r#   r$   get_pch_use_argsm   s   zArmCompiler.get_pch_use_argsc                 C     dS )NZpchr#   r)   r#   r#   r$   get_pch_suffixu   s   zArmCompiler.get_pch_suffixenv'Environment'c                 C  r'   r(   r#   )r"   r?   r#   r#   r$   thread_flags|   r3   zArmCompiler.thread_flagsc                 C  r'   r(   r#   r)   r#   r#   r$   get_coverage_args   r3   zArmCompiler.get_coverage_argsoptimization_levelc                 C  r-   r(   )arm_optimization_argsr"   rC   r#   r#   r$   get_optimization_args   r1   z!ArmCompiler.get_optimization_argsis_debugboolc                 C  r-   r(   r	   r"   rG   r#   r#   r$   get_debug_args   r1   zArmCompiler.get_debug_argsparameter_list	build_dirc              
   C  d   t |D ]+\}}|d d dks|d d dkr/|d d tjtj||dd   ||< q|S Nr   z-Iz-L	enumerateospathnormpathjoinr"   rK   rL   idxir#   r#   r$   &compute_parameters_with_absolute_paths   
    .z2ArmCompiler.compute_parameters_with_absolute_pathsNr   r   r   r&   r+   r,   r   r&   r4   r,   r5   r,   r   r&   r9   r,   r:   r,   r   r&   r   r,   )r?   r@   r   r&   rC   r,   r   r&   rG   rH   r   r&   rK   r&   rL   r,   r   r&   )__name__
__module____qualname____doc__idr%   r*   r0   r2   r7   r<   r>   rA   rB   rF   rJ   rX   r#   r#   r#   r$   r   L   s    










r   c                   @  sx   e Zd ZdZdZd'ddZd(dd	Zd)ddZd*ddZd+ddZ	d,ddZ
d-ddZd.ddZd/d d!Zd0d$d%Zd&S )1ArmclangCompilerz$
    This is the Keil armclang.
    Zarmclangr   r   c                 C  s~   | j stdt| jtstd| jj dt| jd| jj s)tddd dD | _	| j
d	 | j
d
 d S )Nz)armclang supports only cross-compilation.zUnsupported Linker z, must be armlinkz==z4armlink version does not match with compiler versionc                 S  s   h | ]}t |qS r#   r   ).0or#   r#   r$   	<setcomp>   s    z,ArmclangCompiler.__init__.<locals>.<setcomp>)Zb_pchZb_ltoZb_pgoZ
b_sanitizeZ
b_coverageZb_ndebugZb_staticpicZ
b_coloroutr   r   )r   r   r   
isinstanceZlinkerr   ZexelistZversion_compareversionZbase_optionsr    r!   r)   r#   r#   r$   r%      s   

zArmclangCompiler.__init__r&   c                 C  r'   r(   r#   r)   r#   r#   r$   r*      s   zArmclangCompiler.get_pic_args	colortyper,   c                 C  s   t | d d  S r(   r   )r"   rn   r#   r#   r$   get_colorout_args   s   z"ArmclangCompiler.get_colorout_argsr+   c                 C  r-   r(   )armclang_buildtype_argsr/   r#   r#   r$   r0      r1   z#ArmclangCompiler.get_buildtype_argsc                 C  r=   )NZgchr#   r)   r#   r#   r$   r>      r3   zArmclangCompiler.get_pch_suffixr9   r:   c                 C  s   dt j|| |gS )Nz-include-pch)rQ   rR   rT   Zget_pch_namer;   r#   r#   r$   r<      s   z!ArmclangCompiler.get_pch_use_argsr4   r5   c                 C  s   dd|d|gS )Nz-MDz-MTz-MFr#   r6   r#   r#   r$   r7      r8   z(ArmclangCompiler.get_dependency_gen_argsrC   c                 C  r-   r(   )armclang_optimization_argsrE   r#   r#   r$   rF      r1   z&ArmclangCompiler.get_optimization_argsrG   rH   c                 C  r-   r(   r	   rI   r#   r#   r$   rJ      r1   zArmclangCompiler.get_debug_argsrK   rL   c              
   C  rM   rN   rO   rU   r#   r#   r$   rX      rY   z7ArmclangCompiler.compute_parameters_with_absolute_pathsNrZ   r[   )rn   r,   r   r&   r\   r_   r^   r]   r`   ra   rb   )rc   rd   re   rf   rg   r%   r*   ro   r0   r>   r<   r7   rF   rJ   rX   r#   r#   r#   r$   rh      s    








rh   )
__future__r   rQ   typingT r   Zlinkersr   r   	compilersr
   Zclangr   TYPE_CHECKINGenvironmentr   Zcompilers.compilersr   objectr.   rD   rp   rq   r   rh   r#   r#   r#   r$   <module>   sZ   

D