
ŝY"                 @   s   d  d l  Z d d l m Z d d l m Z d d l m Z m Z d d l	 m
 Z
 m Z m Z m Z m Z m Z Gd d	   d	 e  Z Gd
 d   d e e  Z Gd d   d e e  Z Gd d   d e e  Z Gd d   d e e  Z d S)    N   )coredata)version_compare   )	CCompilerVisualStudioCCompiler)	GCC_MINGWgnu_winlibsmsvc_winlibsClangCompilerGnuCompilerIntelCompilerc                   sj   e  Z d  Z d d   Z d d   Z d d   Z d d   Z   f d	 d
   Z d d   f d d  Z   S)CPPCompilerc             C   s8   t  |  d  s d |  _ n  t j |  | | | |  d  S)Nlanguagecpp)hasattrr   r   __init__)selfexelistversionis_crossexe_wrap r   T/mnt/raid6/a/bak/reczko/tools/protein/utils/meson-0.42.1/mesonbuild/compilers/cpp.pyr      s    zCPPCompiler.__init__c             C   s   d S)NzC++r   )r   r   r   r   get_display_language%   s    z CPPCompiler.get_display_languagec             C   s   d g S)Nz-nostdinc++r   )r   r   r   r   get_no_stdinc_args(   s    zCPPCompiler.get_no_stdinc_argsc             C   s   d } |  j  | | d |  S)NzCclass breakCCompiler;int main(int argc, char **argv) { return 0; }
zsanitycheckcpp.cc)sanity_check_impl)r   work_direnvironmentcoder   r   r   sanity_check+   s    zCPPCompiler.sanity_checkc                s   t    j   d g S)Nz-fpermissive)superget_compiler_check_args)r   )	__class__r   r   r"   /   s    z#CPPCompiler.get_compiler_check_argsNc       	         sz   t    j | | | | | |  r% d S| d  k r: g  } n  i | d 6| d 6| d 6} d } |  j | j |   | | |  S)NTprefixheadersymbolz`{prefix}
        #include <{header}>
        using {symbol};
        int main () {{ return 0; }})r!   has_header_symbolcompilesformat)	r   hnamer&   r$   env
extra_argsdependenciesfargst)r#   r   r   r'   5   s    !	zCPPCompiler.has_header_symbol)	__name__
__module____qualname__r   r   r   r    r"   r'   r   r   )r#   r   r      s   r   c               @   sC   e  Z d  Z d d d  Z d d   Z d d   Z d d	   Z d S)
ClangCPPCompilerNc             C   sk   t  j |  | | | |  t j |  |  d d d g } i | d 6| d g d 6| d d g d 6|  _ d  S)	Nz-Wallz-Winvalid-pchz-Wnon-virtual-dtor1z-Wextra2z
-Wpedantic3)r   r   r   	warn_args)r   r   r   cltyper   exe_wrapperdefault_warn_argsr   r   r   r   E   s    
zClangCPPCompiler.__init__c             C   s5   i t  j d d d d d d d d d	 d
 g d  d 6S)Ncpp_stdzC++ language standard to usenonezc++03zc++11zc++14zc++1zzgnu++11zgnu++14zgnu++1z)r   UserComboOption)r   r   r   r   get_optionsM   s    zClangCPPCompiler.get_optionsc             C   s:   g  } | d } | j  d k r6 | j d | j   n  | S)Nr;   r<   z-std=)valueappend)r   optionsargsstdr   r   r   get_option_compile_argsS   s
    
z(ClangCPPCompiler.get_option_compile_argsc             C   s   g  S)Nr   )r   rA   r   r   r   get_option_link_argsZ   s    z%ClangCPPCompiler.get_option_link_args)r0   r1   r2   r   r>   rD   rE   r   r   r   r   r3   D   s   r3   c               @   sL   e  Z d  Z d d   Z d d   Z d d   Z d d   Z d	 d
   Z d S)GnuCPPCompilerc             C   sn   t  j |  | | | |  t j |  | |  d d d g } i | d 6| d g d 6| d d g d 6|  _ d  S)	Nz-Wallz-Winvalid-pchz-Wnon-virtual-dtorr4   z-Wextrar5   z
-Wpedanticr6   )r   r   r   r7   )r   r   r   gcc_typer   r   definesr:   r   r   r   r   _   s    
zGnuCPPCompiler.__init__c             C   s   i t  j d d d d d d d d d	 d
 d g	 d  d 6t  j d d d  d 6} |  j t k r | j i t  j d d t  d 6 n  | S)Nr;   zC++ language standard to user<   zc++03zc++11zc++14zc++1zzgnu++03zgnu++11zgnu++14zgnu++1zcpp_debugstlzSTL debug modeFcpp_winlibsz&Standard Win libraries to link against)r   r=   UserBooleanOptionrG   r   updateUserStringArrayOptionr	   )r   optsr   r   r   r>   g   s    
		zGnuCPPCompiler.get_optionsc             C   sW   g  } | d } | j  d k r6 | j d | j   n  | d j  rS | j d  n  | S)Nr;   r<   z-std=rI   z-D_GLIBCXX_DEBUG=1)r?   r@   )r   rA   rB   rC   r   r   r   rD   u   s    
z&GnuCPPCompiler.get_option_compile_argsc             C   s(   |  j  t k r$ | d j d  d   Sg  S)NrJ   )rG   r   r?   )r   rA   r   r   r   rE   ~   s    z#GnuCPPCompiler.get_option_link_argsc             C   s   d d t  j j |  d g S)Nz-fpch-preprocessz-includer   )ospathsplit)r   pch_dirr%   r   r   r   get_pch_use_args   s    zGnuCPPCompiler.get_pch_use_argsN)r0   r1   r2   r   r>   rD   rE   rT   r   r   r   r   rF   ^   s
   	rF   c                   sR   e  Z d  Z d d   Z d d   Z d d   Z d d   Z   f d	 d
   Z   S)IntelCPPCompilerc             C   sz   t  j |  | | | |  t j |  |  d |  _ d d d d d g } i | d 6| d g d	 6| d d
 g d 6|  _ d  S)Nz
c++-headerz-Wallz-w3z-diag-disable:remarkz-Wpch-messagesz-Wnon-virtual-dtorr4   z-Wextrar5   z
-Wpedanticr6   )r   r   r   lang_headerr7   )r   r   r   icc_typer   r   r:   r   r   r   r      s    		
zIntelCPPCompiler.__init__c             C   s   g  } d g } t  |  j d  rA | d d g 7} | d g 7} n  t  |  j d  rc | d g 7} n  t  |  j d  r | d	 g 7} n  i t j d
 d d g | | d  d
 6t j d d d  d 6} | S)Nzgnu++98z>=15.0.0zc++11zc++14zgnu++11z>=16.0.0zc++17z>=17.0.0zgnu++14r;   zC++ language standard to user<   rI   zSTL debug modeF)r   r   r   r=   rK   )r   c_stdsg_stdsrN   r   r   r   r>      s     	
	zIntelCPPCompiler.get_optionsc             C   sW   g  } | d } | j  d k r6 | j d | j   n  | d j  rS | j d  n  | S)Nr;   r<   z-std=rI   z-D_GLIBCXX_DEBUG=1)r?   r@   )r   rA   rB   rC   r   r   r   rD      s    
z(IntelCPPCompiler.get_option_compile_argsc             C   s   g  S)Nr   )r   rA   r   r   r   rE      s    z%IntelCPPCompiler.get_option_link_argsc                s   t    j | d d g |  S)Nz-diag-error10006)r!   has_multi_arguments)r   rB   r+   )r#   r   r   r[      s    z$IntelCPPCompiler.has_multi_arguments)r0   r1   r2   r   r>   rD   rE   r[   r   r   )r#   r   rU      s
   
	rU   c                   sR   e  Z d  Z d d   Z d d   Z d d   Z d d   Z   f d	 d
   Z   S)VisualStudioCPPCompilerc             C   s5   d |  _  t j |  | | | | |  d g |  _ d  S)Nr   b_pch)r   r   r   base_options)r   r   r   r   r   is_64r   r   r   r      s    	z VisualStudioCPPCompiler.__init__c             C   s?   i t  j d d d d d d g d  d 6t  j d d t  d 6S)	Ncpp_ehzC++ exception handling type.r<   asZscrJ   zWindows libs to link against.)r   r=   rM   r
   )r   r   r   r   r>      s    
	z#VisualStudioCPPCompiler.get_optionsc             C   s:   g  } | d } | j  d k r6 | j d | j   n  | S)Nr`   r<   z/EH)r?   r@   )r   rA   rB   rC   r   r   r   rD      s
    
z/VisualStudioCPPCompiler.get_option_compile_argsc             C   s   | d j  d  d   S)NrJ   )r?   )r   rA   r   r   r   rE      s    z,VisualStudioCPPCompiler.get_option_link_argsc                s   t  t |   j   S)N)r!   r   r"   )r   )r#   r   r   r"      s    z/VisualStudioCPPCompiler.get_compiler_check_args)r0   r1   r2   r   r>   rD   rE   r"   r   r   )r#   r   r\      s
   
r\   )os.pathrP    r   mesonlibr   cr   r   	compilersr   r	   r
   r   r   r   r   r3   rF   rU   r\   r   r   r   r   <module>   s   .	&)-