o
    uJAf|                     @  s&  U 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ded< g dgdgdgg ddgdgdZded< g g g g g g dZded< g g dgdgdgdgdgdZded< 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debugdebugoptimizedreleaseminsizecustomzT.Dict[str, T.List[str]]arm_buildtype_argsz-O0z-gz-O1z-O3z-Otime)r   0g123sarm_optimization_argsarmclang_buildtype_argsz-O2z-Ozarmclang_optimization_argsc                   @  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   
everythingr   sx)is_crossr   EnvironmentException	warn_argscan_compile_suffixesadd)selfdefault_warn_args r-   D/usr/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 r2   )r   r+   r5   r-   r-   r.   get_buildtype_argsc      zArmCompiler.get_buildtype_argsc                 C  r1   r2   r-   r3   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+   r=   r>   r-   r-   r.   get_dependency_gen_argsj      z#ArmCompiler.get_dependency_gen_argspch_dirheaderc                 C  r1   r2   r-   r+   rB   rC   r-   r-   r.   get_pch_use_argsm   s   zArmCompiler.get_pch_use_argsc                 C     dS )Npchr-   r3   r-   r-   r.   get_pch_suffixu   s   zArmCompiler.get_pch_suffixenv'Environment'c                 C  r1   r2   r-   )r+   rI   r-   r-   r.   thread_flags|   r<   zArmCompiler.thread_flagsc                 C  r1   r2   r-   r3   r-   r-   r.   get_coverage_args   r<   zArmCompiler.get_coverage_argsoptimization_levelc                 C  r7   r2   )r   r+   rM   r-   r-   r.   get_optimization_args   r:   z!ArmCompiler.get_optimization_argsis_debugboolc                 C  r7   r2   r	   r+   rP   r-   r-   r.   get_debug_args   r:   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+   rT   rU   idxir-   r-   r.   &compute_parameters_with_absolute_paths   
    .z2ArmCompiler.compute_parameters_with_absolute_pathsNr"   r#   r"   r0   r5   r6   r"   r0   r=   r6   r>   r6   r"   r0   rB   r6   rC   r6   r"   r0   r"   r6   )rI   rJ   r"   r0   rM   r6   r"   r0   rP   rQ   r"   r0   rT   r0   rU   r6   r"   r0   )__name__
__module____qualname____doc__idr/   r4   r9   r;   r@   rE   rH   rK   rL   rO   rS   ra   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.
    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>)b_pchb_ltob_pgo
b_sanitize
b_coverageb_ndebugb_staticpic
b_coloroutr   r%   )r&   r   r'   
isinstancelinkerr   exelistversion_compareversionbase_optionsr)   r*   r3   r-   r-   r.   r/      s   

zArmclangCompiler.__init__r0   c                 C  r1   r2   r-   r3   r-   r-   r.   r4      s   zArmclangCompiler.get_pic_args	colortyper6   c                 C  s   t | d d  S r2   r   )r+   r   r-   r-   r.   get_colorout_args   s   z"ArmclangCompiler.get_colorout_argsr5   c                 C  r7   r2   )r   r8   r-   r-   r.   r9      r:   z#ArmclangCompiler.get_buildtype_argsc                 C  rF   )NZgchr-   r3   r-   r-   r.   rH      r<   zArmclangCompiler.get_pch_suffixrB   rC   c                 C  s   dt j|| |gS )Nz-include-pch)rZ   r[   r]   get_pch_namerD   r-   r-   r.   rE      s   z!ArmclangCompiler.get_pch_use_argsr=   r>   c                 C  s   dd|d|gS )Nz-MDz-MTz-MFr-   r?   r-   r-   r.   r@      rA   z(ArmclangCompiler.get_dependency_gen_argsrM   c                 C  r7   r2   )r   rN   r-   r-   r.   rO      r:   z&ArmclangCompiler.get_optimization_argsrP   rQ   c                 C  r7   r2   r	   rR   r-   r-   r.   rS      r:   zArmclangCompiler.get_debug_argsrT   rU   c              
   C  rV   rW   rX   r^   r-   r-   r.   ra      rb   z7ArmclangCompiler.compute_parameters_with_absolute_pathsNrc   rd   )r   r6   r"   r0   re   rh   rg   rf   ri   rj   rk   )rl   rm   rn   ro   rp   r/   r4   r   r9   rH   rE   r@   rO   rS   ra   r-   r-   r-   r.   rq      s    








rq   )
__future__r   rZ   typingT r   linkers.linkersr   r   	compilersr
   clangr   TYPE_CHECKINGenvironmentr   Zcompilers.compilersr   objectr   __annotations__r   r   r   r    rq   r-   r-   r-   r.   <module>   sZ   

D