o
    uJAfT                     @  s   U d dl mZ 	 d dlZd dlZddlmZ ejr,ddlm	Z	 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dgdgdgdZd	ed< g dgdZded< G dd deZdS )    )annotationsN   )EnvironmentException)MachineInfo)Environment)Compiler)plaindebugdebugoptimizedreleaseminsizecustomzT.Dict[str, T.List[str]]ti_buildtype_argsz-O0-Ooffz-O1z-O2z-O3z-O4)r   0g123sti_optimization_argsz-g)FTzT.Dict[bool, T.List[str]]ti_debug_argsc                   @  s   e Zd ZdZd?ddZd@ddZdAddZdBddZdCddZdDddZ	d@ddZ
d@ddZd@ddZdEddZdFd"d#Zd@d$d%Zd@d&d'ZdGd)d*Zd@d+d,ZdHd/d0ZedId4d5ZdJd8d9ZdKd<d=Zd>S )L
TICompilertireturnNonec                 C  sL   | j std| jd | jd g }g ||g  |g  |g  d| _d S )Nz,TI compilers only support cross-compilation.asmZcla)r   r   r   r   
everything)is_crossr   can_compile_suffixesadd	warn_args)selfdefault_warn_args r$   C/usr/lib/python3.10/site-packages/mesonbuild/compilers/mixins/ti.py__init__?   s   zTICompiler.__init__T.List[str]c                 C     g S Nr$   r"   r$   r$   r%   get_pic_argsN   s   zTICompiler.get_pic_args	buildtypestrc                 C     t | S r)   )r   )r"   r,   r$   r$   r%   get_buildtype_argsS      zTICompiler.get_buildtype_argsc                 C  s   dS )Npchr$   r*   r$   r$   r%   get_pch_suffixV      zTICompiler.get_pch_suffixpch_dirheaderc                 C  r(   r)   r$   )r"   r4   r5   r$   r$   r%   get_pch_use_argsY   r3   zTICompiler.get_pch_use_argsenv'Environment'c                 C  r(   r)   r$   )r"   r7   r$   r$   r%   thread_flags\   r3   zTICompiler.thread_flagsc                 C  r(   r)   r$   r*   r$   r$   r%   get_coverage_args_   r3   zTICompiler.get_coverage_argsc                 C  r(   r)   r$   r*   r$   r$   r%   get_no_stdinc_argsb   r3   zTICompiler.get_no_stdinc_argsc                 C  r(   r)   r$   r*   r$   r$   r%   get_no_stdlib_link_argse   r3   z"TICompiler.get_no_stdlib_link_argsoptimization_levelc                 C  r.   r)   )r   )r"   r=   r$   r$   r%   get_optimization_argsh   r0   z TICompiler.get_optimization_argsis_debugboolc                 C  r.   r)   )r   )r"   r?   r$   r$   r%   get_debug_argsk   r0   zTICompiler.get_debug_argsc                 C  r(   r)   r$   r*   r$   r$   r%   get_compile_only_argsn   r3   z TICompiler.get_compile_only_argsc                 C     dgS )Nr   r$   r*   r$   r$   r%   get_no_optimization_argsq      z#TICompiler.get_no_optimization_args
outputnamec                 C  s   d| gS )Nz--output_file=r$   )r"   rF   r$   r$   r%   get_output_argst   s   zTICompiler.get_output_argsc                 C  rC   )Nz--emit_warnings_as_errorsr$   r*   r$   r$   r%   get_werror_argsw   rE   zTICompiler.get_werror_argspath	is_systemc                 C  s   |dkrd}d| gS )N .z-I=r$   )r"   rI   rJ   r$   r$   r%   get_include_argsz   s   
zTICompiler.get_include_argsargsinfor   c                 C  sX   g }|D ]%}| drd|dd   }| drq|dkrq| dr$q|| q|S )Nz-Dz	--define=   z-Wl,-rpath=z--print-search-dirsz-L)
startswithappend)clsrN   rO   resultir$   r$   r%   _unix_args_to_native   s   


zTICompiler._unix_args_to_nativeparameter_list	build_dirc              
   C  s   t |D ]B\}}|d d dkr'|d d tjtj||dd   ||< |d d dkrF|d d tjtj||dd   ||< q|S )N   z--include_path=rP   z-I)	enumerateosrI   normpathjoin)r"   rW   rX   idxrU   r$   r$   r%   &compute_parameters_with_absolute_paths   s   ..z1TICompiler.compute_parameters_with_absolute_paths	outtargetoutfilec                 C  s   dd| gS )Nz--preproc_with_compilez--preproc_dependency=r$   )r"   r`   ra   r$   r$   r%   get_dependency_gen_args   s   z"TICompiler.get_dependency_gen_argsN)r   r   )r   r'   )r,   r-   r   r'   )r   r-   )r4   r-   r5   r-   r   r'   )r7   r8   r   r'   )r=   r-   r   r'   )r?   r@   r   r'   )rF   r-   r   r'   )rI   r-   rJ   r@   r   r'   )rN   r'   rO   r   r   r'   )rW   r'   rX   r-   r   r'   )r`   r-   ra   r-   r   r'   )__name__
__module____qualname__idr&   r+   r/   r2   r6   r9   r:   r;   r<   r>   rA   rB   rD   rG   rH   rM   classmethodrV   r_   rb   r$   r$   r$   r%   r   ;   s,    
















	r   )
__future__r   r[   typingTmesonlibr   TYPE_CHECKING	envconfigr   environmentr   Zcompilers.compilersr   objectr   __annotations__r   r   r   r$   r$   r$   r%   <module>   s:   
