
    -Ph                     ^   U d dl mZ d dlZd dlZd dlZd dlZddlm	Z	 ddlm
Z
 ddlmZmZmZmZmZ ddlmZmZ ej        r*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 ddlmZ ddlm Z  g dgdgdgddgdgdgdZ!de"d<   g dgdZ#de"d<    G d dej$                  Z% G d d e          Z&dS )!    )annotationsN   )options)mlog)EnvironmentException
Popen_safe
is_windowsLibTypeversion_compare   )CompilerCompileCheckMode)BuildTarget)MutableKeyedOptionDictType)
Dependency)Environment)MachineInfo)DynamicLinker)MachineChoice-G-O0z-O1z-O2	-lineinfo-O3)plain0g123szT.Dict[str, T.List[str]]cuda_optimization_args-g)FTzT.Dict[bool, T.List[str]]cuda_debug_argsc                      e Zd ZdZdZdS )PhasecompilerlinkerN)__name__
__module____qualname__COMPILERLINKER     Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mesonbuild/compilers/cuda.pyr%   r%   .   s        HFFFr.   r%   c                      e Zd ZdZdZh dZi dddddd	d
dddddddddddddddddddddd d!d"d#d$d%i d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGi dHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdlZdm e                                D             ZdnZ		 	 dd fdZ
eddd            Zedd            Zeej        dofdd            Zej        fddZddZddZddZdododddZdZdZdZd fdZd ddZd ddZd ddZddZddZddZddZ ddZ!ddZ"ddZ#ddZ$ddZ%d	dZ&d
ddƄZ'ddȄZ(ddɄZ)ddʄZ*dd҄Z+ddԄZ,ddՄZ-ddׄZ.dd؄Z/ddۄZ0dd܄Z1e2j3        dfddZ4ddZ5ddZ6d fdZ7d fdZ8d fdZ9	 d ddZ:ddZ;ddZ<ddZ=ddZ>ddZ? xZ@S (  CudaCompilerz	-Xlinker=cuda>w   -E-M-V-h-v-MM-MP-dc-dw-pg-MMD-ewp-lib-m32-m64-ptx--lib--m32--m64--ptx-cuda-dlto-keep-noeh--cuda--help--keep--link-clean-cubin-dlink--cubin--debug-dryrun-err-no-fatbin-noprof-shared--dryrun--fatbin--shared-arch-ls-code-ls-nodlink-objtemp	--compile	--profile	--verbose	--version	-Wreorder	-restrict
--Wreorder
--device-c
--device-w
--restrict
-res-usage-save-temps-src-in-ptx--preprocess--save-temps--device-link-astoolspatch-nohdinitlist--device-debug--clean-targets--list-gpu-arch--list-gpu-code--no-exceptions--source-in-ptx--use_fast_math--dlink-time-opt--no-device-link--resource-usage-extended-lambda--extended-lambda--no-align-double--disable-warnings--dont-use-profile--objdir-as-tempdir--generate-line-info-expt-extended-lambda--display-error-number--expt-extended-lambda-keep-device-functions--generate-dependencies--keep-device-functions-Wdefault-stream-launch-expt-relaxed-constexpr--Wdefault-stream-launch--compile-as-tools-patch--expt-relaxed-constexpr--extensible-whole-program-Wext-lambda-captures-this--Wext-lambda-captures-this-Wno-deprecated-gpu-targets-allow-unsupported-compiler-extra-device-vectorization--Wno-deprecated-gpu-targets--allow-unsupported-compiler--extra-device-vectorization-Wno-deprecated-declarations--Wno-deprecated-declarations--generate-dependency-targets-forward-unknown-to-host-linker --forward-unknown-to-host-linker!--generate-nonsystem-dependencies!--no-host-device-initializer-list!-forward-unknown-to-host-compiler"--forward-unknown-to-host-compiler$--generate-dependencies-with-compile.--generate-nonsystem-dependencies-with-compiler   -cr"   -w-MD--runr   -use_fast_mathz--output-file-oz--pre-include-includez	--library-lz--define-macro-Dz--undefine-macro-Uz--include-path-Iz--system-include-isystemz--library-path-Lz--output-directoryz-odirz--dependency-output-MFz--compiler-bindirz-ccbinz--archiver-binaryz-arbinz--cudart-cudartz--cudadevrtz
-cudadevrtz--libdevice-directoryz-ldirz--target-directoryz-target-dirz--optimization-infoz	-opt-infoz
--optimize-Oz--ftemplate-backtrace-limitz-ftemplate-backtrace-limitz--ftemplate-depthz-ftemplate-depthz--xz-xz--std-stdz	--machine-mz--compiler-options
-Xcompilerz--linker-optionsz-Xlinkerz--archive-optionsz	-Xarchivez--ptxas-optionsz-Xptxasz--nvlink-optionsz-Xnvlinkz	--threads-tz
--keep-dirz	-keep-dirz
--run-argsz	-run-argsz--input-drive-prefixz-idpz--dependency-drive-prefixz-ddpz--drive-prefixz-dpz--dependency-target-name-MTz--default-streamz-default-streamz--gpu-architecturez-archz
--gpu-codez-codez--generate-codez-gencodez--relocatable-device-codez-rdcz	--entriesz-ez--maxrregcountz-maxrregcountz--ftzz-ftzz
--prec-divz	-prec-divz--prec-sqrtz
-prec-sqrtz--fmadz-fmadz--Werrorz-Werrorz--diag-errorz-diag-errorz--diag-suppressz-diag-suppressz--diag-warnz
-diag-warnz--options-filez-optfz-timez-qpp-config)z--timez--qpp-configc                    i | ]\  }}||	S r-   r-   ).0kvs      r/   
<dictcomp>zCudaCompiler.<dictcomp>   s     T T T$!QA T T Tr.   nvccNccacheT.List[str]exelistversionstrfor_machiner   is_crossboolhost_compilerr   info'MachineInfo'r'   T.Optional['DynamicLinker']full_versionT.Optional[str]c
           
     &    t                                          |||||||	|           | _        |j         _         fd|j                                        D              _        d  j                                        D              _        d S )N)r'   r   r   c           	     p    i | ]2\  }}|                     t          d  |D                                 3S )c              3  &   K   | ]}|d k    |V  dS )z
-WpedanticNr-   )r   fs     r/   	<genexpr>z3CudaCompiler.__init__.<locals>.<dictcomp>.<genexpr>   s,      +R+R!\@Q@QA@Q@Q@Q@Q+R+Rr.   )_to_host_flagslist)r   levelflagsselfs      r/   r   z)CudaCompiler.__init__.<locals>.<dictcomp>   sT     
 
 
u 4&&t+R+Ru+R+R+R'R'RSS
 
 
r.   c                    g | ]}d |z   S -Xcompiler=r-   r   xs     r/   
<listcomp>z)CudaCompiler.__init__.<locals>.<listcomp>   s     a a aq!2 a a ar.   )super__init__r   base_options	warn_argsitemsget_werror_argshost_werror_args)r   r   r   r   r   r   r   r   r'   r   	__class__s   `         r/   r   zCudaCompiler.__init__   s    
 	';Vbn  zB  	C  	C  	C*)6
 
 
 
 - 7 = = ? ?
 
 
 !b aD<N<^<^<`<` a a ar.   Targlistmodereturnc                    d}d}d}d}||z   |z   t          t          j        dz             }||vs|s||vr,t          |                              |          r||z   |z   S |S  fd|                    |          D             }t          fd|D             dd	         g           }d
                    |          S d
g}d}	t          |          }
|
D ]}||k    r|	s|                    d
            ||k    r|d	xx         |z  cc<   |	 }	:||k    r0	 |d	xx         t          |
          z  cc<   _# t          $ r Y  nw xY w|d	xx         |z  cc<    fd|D             }d                    |          S )a  
        Shield an argument against both splitting by NVCC's list-argument
        parse logic, and interpretation by any shell.

        NVCC seems to consider every comma , that is neither escaped by \ nor inside
        a double-quoted string a split-point. Single-quotes do not provide protection
        against splitting; In fact, after splitting they are \-escaped. Unfortunately,
        double-quotes don't protect against shell expansion. What follows is a
        complex dance to accommodate everybody.
        '",\z"$`\c                :    g | ]}                     |          S r-   _shield_nvcc_list_argr   r    clss     r/   r   z6CudaCompiler._shield_nvcc_list_arg.<locals>.<listcomp>   s'    IIIaS..q11IIIr.   c                    g | ]}|gS r-   r-   )r   r    DQSQs     r/   r   z6CudaCompiler._shield_nvcc_list_arg.<locals>.<listcomp>   s    ...q!T...r.   N Fc                >    g | ]}                     |d           S )F)r   r   r   s     r/   r   z6CudaCompiler._shield_nvcc_list_arg.<locals>.<listcomp>  s,    III!**1u*==IIIr.   z\,)setstring
whitespaceintersectionsplitsumjoiniterappendnextStopIteration)r   r   r   SQDQCMBSquotablelinstringargitcr   s   `           @r/   r   z"CudaCompiler._shield_nvcc_list_arg   s    "uRxv(011S===}} s88((22 c6"9$J JIII399R==III....A...ss3R88wwqzz! AHIIE  7787HHRLLLL"WWbEEEQJEEE#+|HH"WW"e,(    bEEEQJEEEE JIIIqIIIA::a== s   D44
EEr   c                  	 t          |          dk    r|S t          |          }g }dd	ddd	fd}dfd}d}|D ]} ||          sd}|                    |           %|r+|dxx         dz  cc<   |dxx          |||          z  cc<   R 	|          r7d}|                    |           |                     |||                      |          rd}|                    |           t          d          |S )z
        The flags to NVCC gets exceedingly verbose and unreadable when too many of them
        are shielded with -Xcompiler. Merge consecutive -Xcompiler-wrapped arguments
        into one.
        r   flagr   r   r   c                    | dk    S )Nr   r-   r
  s    r/   is_xcompiler_flag_isolatedz=CudaCompiler._merge_flags.<locals>.is_xcompiler_flag_isolated  s    <''r.   c                ,    |                      d          S )Nr   )
startswithr  s    r/   is_xcompiler_flag_gluedz:CudaCompiler._merge_flags.<locals>.is_xcompiler_flag_glued  s    ??=111r.   c                0     |           p
 |           S Nr-   )r
  r  r  s    r/   is_xcompiler_flagz4CudaCompiler._merge_flags.<locals>.is_xcompiler_flag  s%    --d33T7N7Nt7T7TTr.   flagitT.Iterator[str]c                     |           r| t          d          d          S 	 t          |          S # t          $ r Y dS w xY w)Nr   r   )lenr   r   )r
  r  r  s     r/   get_xcompiler_valz4CudaCompiler._merge_flags.<locals>.get_xcompiler_val  sb    &&t,, C..//00<<'$   22s   4 
AAFr   r   Tz6-Xcompiler flag merging failed, unknown argument form!)r
  r   r   r   )r
  r   r  r  r   r   )r  r   r   
ValueError)
r   r   r  xflagsr  r  ingroupr
  r  r  s
           @@r/   _merge_flagszCudaCompiler._merge_flags  s    u::??Le	( 	( 	( 	(	2 	2 	2 	2	U 	U 	U 	U 	U 	U 	U	 	 	 	 	 	  	[ 	[D$$T** [d#### [r


c!


r


//f===



++D11 [d###//f==>>>>((.. [d#### !YZZZr.   phaser%   default_include_dirsT.Optional[T.List[str]]c                "
   g }t          |          }|D ]}|| j        v r|                    |           "|dd         dvr|                    |           D|dd         dk    rH|                    d          rdn
d|j         d}d	|v rd
nd}|                    | | | |            t          |          dk    rt|d         dk    rh|d         dv r^|dd         dk    r!	 t          |          }	n3# t          $ r Y n'w xY w|dd         dk    r|dd         }	n
|dd         }	|dd         }n|| j        v s	|| j	        v r#	 t          |          }	n# t          $ r Y nw xY w|
                    dd          d         | j        v s#|
                    dd          d         | j	        v r|
                    dd          \  }}	nd|                    d          r(|dd                                         }	|dd         }n'|dk    r.|                    d           |                    d|z              n|dk    rX|                    d           |                    d           |                    d           |                    d|z              n|dk    r.|                    d           |                    d|z              n_|dk    r.|                    d           |                    d|z              n+|                    d|                     |          z              |	J | j                            ||          }|dv rt          |          dk    r-|                    ||                     |	          z              ~|dk    r||	|v r|                    |           |                    |                     |	                     |dk    r|	dk    rY|                    d           |                    d           |                    d            |                    ||	z              0|	d!v r/|                    d            |                    ||	z              c|                    ||	z              }|d"v r|                    ||	z              |d#v r|                    |dz   |	z              |                    |           |                    |	           |                     |          S )$z
        Translate generic "GCC-speak" plus particular "NVCC-speak" flags to NVCC flags.

        NVCC's "short" flags have broad similarities to the GCC standard, but have
        gratuitous, irritating differences.
        Nr   z-//z.ar   z-X=r   r   r   r   -IDULlmOxmte   r      z-ffast-mathr   r   z-fno-fast-mathz
-ftz=falsez-prec-div=truez-prec-sqrt=truez-freciprocal-mathz-prec-div=falsez-fno-reciprocal-math>   r   r   r   r   r   r   fastr   r   >   r   r    z>   r   r   r   r   >   r   )r   _FLAG_PASSTHRU_NOARGSr   endswithvaluer  r   r   _FLAG_LONG2SHORT_WITHARGS_FLAG_SHORT2LONG_WITHARGSr   r  stripr   getr  )
r   r   r  r  r  r  r
  prefixwrapvals
             r/   to_host_flags_basezCudaCompiler.to_host_flags_base6  s    e g	# g	#Df s000d### BQBxt##d###bqbS  $}}T22K8KU[8K8K8K!Tkkssr;;t;T;;<<<TaDGsNNtAw-7O7O !9??"6ll(   !A#Y#%%qrr(CCqrr(CBQBx666C999v,,CC$   DC##A&#*GGGJJsA&&q)S-JJJ !JJsA..	cc,, 122hnn&&BQBx =((MM"2333MM-"45555---MM,///MM"2333MM"3444MM-"45555000MM"3444MM-"45555333MM"2333MM-"45555MM-0I0I$0O0O"OPPP??? 044T4@@DAAA t99>>MM$s'@'@'E'E"EFFFFZ'',@,LQTXlQlQl MM$'''MM#";";C"@"@AAAA&==MM%(((MM"2333MM,///MM$s(++++O++MM,///MM$s(++++MM$s(++++111d3h''''!!d3hsl++++d###c""""'''s$   &C66
DDE
E'&E'c                ^    |                      ||| j                                                  S r  )r3  r   get_default_include_dirs)r   r   r  s      r/   r   zCudaCompiler._to_host_flags  s)    &&ueT5G5`5`5b5bcccr.   c                    dS )NFr-   r   s    r/   needs_static_linkerz CudaCompiler.needs_static_linker  s    ur.   environment'Environment'c                r    |                      | j                            |          t          j                  S r  )r   r   thread_link_flagsr%   r,   )r   r9  s     r/   r<  zCudaCompiler.thread_link_flags  s-    ""4#5#G#G#T#TV[Vbcccr.   work_direnvNonec                   t          j        d|                                 z   dz   d                    | j                             t          j        dt          | j                  z             d}d}|                    dd          d	         }|| j        rd
ndz  }t          j	                            ||          }t          j	                            ||dz             }t          |dd          5 }|                    |           d d d            n# 1 swxY w Y   d| _        g }	|	ddd|gz  }	|	|                     d |d          z  }	| j        r+|                                s|	|                                 z  }	|	|                     |          z  }	| j        |	z   }
t          j        dd                    |
                     t#          |
|          \  }}}t          j        d           t          j        |           t          j        d           t          j        |           t          j        d           |j        d	k    r%t'          d|                                  d          | j        r4|                                sd S |j                                        |gz   }
n| j        dd|z   dz   gz   }
t          j        dd                    |
                     t#          |
|          \  }}}t          j        d           t          j        |           t          j        d           t          j        |           t          j        d           |                                 |j        d	k    r-t'          d| j         d |                                  d!          |dk    r	|| _        d S t          j        d"|z              d S )#NzSanity testing z
 compiler: zIs cross compiler: %s.zsanitycheckcuda.cua  
        #include <cuda_runtime.h>
        #include <stdio.h>

        __global__ void kernel (void) {}

        int main(void){
            struct cudaDeviceProp prop;
            int count, i;
            cudaError_t ret = cudaGetDeviceCount(&count);
            if(ret != cudaSuccess){
                fprintf(stderr, "%d\n", (int)ret);
            }else{
                for(i=0;i<count;i++){
                    if(cudaGetDeviceProperties(&prop, i) == cudaSuccess){
                        fprintf(stdout, "%d.%d\n", prop.major, prop.minor);
                    }
                }
            }
            fflush(stderr);
            fflush(stdout);
            return 0;
        }
        .r   r   _crossr   z.exewzutf-8)encodingr   r   staticz$Sanity check compiler command line: )cwdzSanity check compile stdout: z"-----
Sanity check compile stderr:z-----z	Compiler z cannot compile programs.r   r   zSanity check run command line: zSanity check run stdout: z-----
Sanity check run stderr:zExecutables created by z
 compiler z are not runnable.zcudaGetDeviceCount() returned )r   debugget_display_languager   r   r   r   rsplitospathopenwritedetected_ccget_ccbin_argshas_exe_wrapperget_compile_only_argsget_output_argsr   
returncoder   name_stringexe_wrapperget_commandwaitlanguage)r   r=  r>  snamecodebinnamesource_namebinary_nameofiler   cmdlistpcstdostdepes                  r/   sanity_checkzCudaCompiler.sanity_check  s   
$t'@'@'B'BB\QSVS[S[\`\hSiSijjj
+c$-.@.@@AAA$0 ,,sA&&q)t}488"4gll8U33gll8Wv-=>>+sW555 	KK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  	$	8[99
 	$$T3333 = 	2!4!4!6!6 	2 T//111E%%k222 ,&
9388G;L;LMMM#G:::D$
2333
4
8999
4
7=A&'`43C3C3E3E'`'`'`aaa = 	H&&(( H/5577;-Glgs[/@3/F%GGG
4chhw6G6GHHH#G:::D$
.///
4
4555
4
7
			=A&  (A  (A  (AZ^ZjZjZlZl  (A  (A  (A  B  B  B
 2::#DJ7$>?????s   2DDD
extra_argsdependencieshnamesymbolr0  rg  GT.Union[None, T.List[str], T.Callable[[CompileCheckMode], T.List[str]]]rh   T.Optional[T.List['Dependency']]T.Tuple[bool, bool]c                   |g }|||d}d}|                      |                    |          |||          \  }	}
|	rd|
fS d}|                      |                    |          |||          S )N)r0  headerrj  z{prefix}
        #include <{header}>
        int main(void) {{
            /* If it's not defined as a macro, try to use as a symbol */
            #ifndef {symbol}
                {symbol};
            #endif
            return 0;
        }}rf  Tzw{prefix}
        #include <{header}>
        using {symbol};
        int main(void) {{
            return 0;
        }})compiles
format_map)r   ri  rj  r0  r>  rg  rh  fargstfoundcacheds              r/   has_header_symbolzCudaCompiler.has_header_symbol]  s     J!UfEE all5&9&93:dpqqv 	 < }}Q\\%00#*[g}hhhr.   z>=9.0z>=11.0z>=12.0'MutableKeyedOptionDictType'c                   g d}t          | j        | j                  r|dgz  }t          | j        | j                  r|dgz  }t          | j        | j                  r|dgz  }t                                                      }|                     d          }t          j	        | 
                    |          dd|          ||<   |                     d	          }t          j        | 
                    |          d
d          ||<   |S )N)nonezc++03zc++11zc++14zc++17zc++20stdz&C++ language standard to use with CUDAry  )choicesccbindirz4CUDA non-default toolchain directory to use (-ccbin)r   )r   r   _CPP14_VERSION_CPP17_VERSION_CPP20_VERSIONr   get_optionsform_compileropt_keyr   UserComboOptionmake_option_nameUserStringOption)r   cpp_stdsoptskeyr   s       r/   r  zCudaCompiler.get_options~  s   ---4<)<== 	"	!H4<)<== 	"	!H4<)<== 	"	!Hww""$$''..+!!#&&4	  S	 ''
33,!!#&&B S	
 r.   target'BuildTarget'
subprojectc                    |                      |||          }	 | j                            |||          }n# t          $ r g }Y nw xY w||                     |          z   S r  )rP  r   get_option_compile_argsKeyErrorr   )r   r  r>  r  argshost_compiler_argss         r/   r  z$CudaCompiler.get_option_compile_args  s    ""63
;;	$!%!3!K!KFTWYc!d!d 	$ 	$ 	$!#	$d))*<====s   6 AAr   r   c                   t                      s;|                     d|||          }t          |t                    sJ |dk    rd|z   gS 	 | j                            |||          }n# t          $ r g }Y nw xY w|                     |          S )Nrz  ry  z--std=)r	   get_compileropt_value
isinstancer   r   get_option_std_argsr  r   )r   r  r>  r  rz  r  s         r/   r  z CudaCompiler.get_option_std_args  s     || 	(,,UCLLCc3'''''f}} 3''	$!%!3!G!GPSU_!`!` 	$ 	$ 	$!#	$""#5666s   A( (A76A7c                    |                      |||          }||                     | j                            |||          t          j                  z   S r  )rP  r   r   get_option_link_argsr%   r,   )r   r  r>  r  r  s        r/   r  z!CudaCompiler.get_option_link_args  sP    ""63
;;d))$*<*Q*QRXZ]_i*j*jlqlxyyyyr.   
shlib_namesuffix	soversiondarwin_versionsT.Tuple[str, str]c           
     |    |                      | j                            ||||||          t          j                  S r  )r   r   get_soname_argsr%   r,   )r   r>  r0  r  r  r  r  s          r/   r  zCudaCompiler.get_soname_args  sH     ""4#5#E#EVY$I $IJO,X X 	Xr.   c                    dgS )Nr   r-   r7  s    r/   rR  z"CudaCompiler.get_compile_only_args  s	    vr.   c                    dgS )Nr   r-   r7  s    r/   get_no_optimization_argsz%CudaCompiler.get_no_optimization_args  s	    wr.   optimization_levelc                    t           |         S r  )r!   r   r  s     r/   get_optimization_argsz"CudaCompiler.get_optimization_args  s     &&899r.   r+  c                \    |                      | j                            |                    S r  )r   r   sanitizer_compile_argsr   r+  s     r/   r  z#CudaCompiler.sanitizer_compile_args  s'    ""4#5#L#LU#S#STTTr.   c                \    |                      | j                            |                    S r  )r   r   sanitizer_link_argsr  s     r/   r  z CudaCompiler.sanitizer_link_args  s'    ""4#5#I#I%#P#PQQQr.   is_debugc                    t           |         S r  )r#   )r   r  s     r/   get_debug_argszCudaCompiler.get_debug_args  s    x((r.   c                    dg}|| j         z   S )NzB-Werror=cross-execution-space-call,deprecated-declarations,reorder)r   )r   device_werror_argss     r/   r   zCudaCompiler.get_werror_args  s    bc!D$999r.   r   c                    | j         |         S r  )r   )r   r   s     r/   get_warn_argszCudaCompiler.get_warn_args  s    ~e$$r.   rL  	is_systemc                .    |dk    rd}|rd|z   gnd|z   gS )Nr   rB  z	-isystem=r   r-   )r   rL  r  s      r/   get_include_argszCudaCompiler.get_include_args  s.    2::D'0Cd"##td{mCr.   Frel_objpchc                ^    |                      | j                            ||                    S r  )r   r   get_compile_debugfile_args)r   r  r  s      r/   r  z'CudaCompiler.get_compile_debugfile_args  s+    ""4#5#P#PQXZ]#^#^___r.   
targetfilec                r    |                      | j                            |          t          j                  S r  )r   r   get_link_debugfile_argsr%   r,   )r   r  s     r/   r  z$CudaCompiler.get_link_debugfile_args  s-    ""4#5#M#Mj#Y#Y[`[ghhhr.   c                    dS )Ndr-   r7  s    r/   get_depfile_suffixzCudaCompiler.get_depfile_suffix  s    sr.   c                r    |                      | j                            |          t          j                  S r  )r   r   get_optimization_link_argsr%   r,   r  s     r/   r  z'CudaCompiler.get_optimization_link_args  s.    ""4#5#P#PQc#d#dfkfrsssr.   	build_dirfrom_dirrpath_pathsT.Tuple[str, ...]build_rpathinstall_rpath"T.Tuple[T.List[str], T.Set[bytes]]c                    | j                             ||||||          \  }}|                     |t          j                  |fS r  )r   build_rpath_argsr   r%   r,   )	r   r>  r  r  r  r  r  
rpath_argsrpath_dirs_to_removes	            r/   r  zCudaCompiler.build_rpath_args  sO     .2-?-P-PHk;.O .O*)##J==?STTr.   r  c                    |S r  r-   )r   r  s     r/   linker_to_compiler_argsz$CudaCompiler.linker_to_compiler_args  s    r.   c                Z    |                      | j                                                  S r  )r   r   get_pic_argsr7  s    r/   r  zCudaCompiler.get_pic_args  s%    ""4#5#B#B#D#DEEEr.   parameter_listc                    g S r  r-   )r   r  r  s      r/   &compute_parameters_with_absolute_pathsz3CudaCompiler.compute_parameters_with_absolute_paths  s    	r.   c                
    d|gS )Nr   r-   )r   r  s     r/   rS  zCudaCompiler.get_output_args  s    f~r.   	outtargetoutfilec                >    t          | j        d          rdd|d|gS g S )Nz>= 10.2r   r   r   )r   r   )r   r  r  s      r/   get_dependency_gen_argsz$CudaCompiler.get_dependency_gen_args  s.    4<33 	 5)UG<<Ir.   c                p    |                      | j                                        t          j                  S r  )r   r   get_std_exe_link_argsr%   r,   r7  s    r/   r  z"CudaCompiler.get_std_exe_link_args  s)    ""4#5#K#K#M#Mu|\\\r.   libname
extra_dirslibtyper
   lib_prefix_warningc                >    | j                             |||||          S r  )r   find_library)r   r  r>  r  r  r  s         r/   r  zCudaCompiler.find_library  s"    !..wZRdeeer.   crt_val	buildtypec                ^    |                      | j                            ||                    S r  )r   r   get_crt_compile_args)r   r  r  s      r/   r  z!CudaCompiler.get_crt_compile_args  s*    ""4#5#J#J7T]#^#^___r.   c                    g }| j                             ||          }t          d |D                       r|dgz  }|                     || j                             ||          z   t
          j                  S )Nc              3     K   | ]}|d v V  	dS )>   /MD/MDd/MTdNr-   )r   r   s     r/   r   z1CudaCompiler.get_crt_link_args.<locals>.<genexpr>  s(      OO#s--OOOOOOr.   z/NODEFAULTLIB:LIBCMT.lib)r   r  anyr   get_crt_link_argsr%   r,   )r   r  r  host_link_arg_overrideshost_crt_compile_argss        r/   r  zCudaCompiler.get_crt_link_args  s     #% $ 2 G GQZ [ [OO9NOOOOO 	D#(B'CC#""#:T=O=a=abikt=u=u#uw|  xD  E  E  	Er.   c                    |                      t                                          |          t          j                  S r  )r   r   get_target_link_argsr%   r,   )r   r  r   s     r/   r  z!CudaCompiler.get_target_link_args  s-    ""577#?#?#G#GVVVr.   dep'Dependency'c                l    |                      t                                          |                    S r  )r   r   get_dependency_compile_argsr   r  r   s     r/   r  z(CudaCompiler.get_dependency_compile_args  s)    ""577#F#Fs#K#KLLLr.   c                    |                      t                                          |          t          j                  S r  )r   r   get_dependency_link_argsr%   r,   r  s     r/   r  z%CudaCompiler.get_dependency_link_args  s-    ""577#C#CC#H#H%,WWWr.   'T.Optional[BuildTarget]'c                <   |                      d                              |          }|r|j                            ||          }n|j        j                            |          }t          |t                    r |dk    r|                     d|z   d          gS g S )Nr|  )r  r   z-ccbin=F)	r  evolvecoredataget_option_for_targetoptstoreget_value_forr  r   r   )r   r  r>  r  r  r|  s         r/   rP  zCudaCompiler.get_ccbin_args!  s     ''
33::j:QQ 	@|99&#FFHH|,::3??Hh$$ 	R..y/A5IIJJIr.   c                H    d | j                                         D             S )Nc                    g | ]}d |z   S r   r-   r   s     r/   r   z:CudaCompiler.get_profile_generate_args.<locals>.<listcomp>0  s    ZZZa!ZZZr.   )r   get_profile_generate_argsr7  s    r/   r  z&CudaCompiler.get_profile_generate_args/  s%    ZZ4+=+W+W+Y+YZZZZr.   c                H    d | j                                         D             S )Nc                    g | ]}d |z   S r   r-   r   s     r/   r   z5CudaCompiler.get_profile_use_args.<locals>.<listcomp>3  s    UUUa!UUUr.   )r   get_profile_use_argsr7  s    r/   r   z!CudaCompiler.get_profile_use_args2  s%    UU4+=+R+R+T+TUUUUr.   disablec                8    | j                             ||          S r  )r   get_assert_args)r   r  r>  s      r/   r  zCudaCompiler.get_assert_args5  s    !11'3???r.   c                r    |                      |          }|                     d||t          j                  S )Nint main(void) { return 0; }rg  mode)r   rp  r   COMPILEr   r  r>  s      r/   has_multi_argumentsz CudaCompiler.has_multi_arguments8  s4    ""4((}};STXhXp}qqqr.   c                      fd j                                         D             }|                     |t          j                  z  }                     d||t          j                  S )Nc                @    g | ]}d                      |          z   S )z	-Xnvlink=r   )r   r    r   s     r/   r   z9CudaCompiler.has_multi_link_arguments.<locals>.<listcomp>=  s,    ```aD66q999```r.   )r  r  r  )r'   fatal_warningsr   r%   r,   rp  r   LINKr	  s   `  r/   has_multi_link_argumentsz%CudaCompiler.has_multi_link_arguments<  sh    ````4;C]C]C_C_```##D#===}};STXhXm}nnnr.   )NN)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r'   r   r   r   )T)r   r   r   r   r   r   )r   r   r   r   )r   r   r  r%   r  r  r   r   )r   r   r  r%   r   r   )r   r   )r9  r:  r   r   )r=  r   r>  r:  r   r?  )ri  r   rj  r   r0  r   r>  r:  rg  rk  rh  rl  r   rm  )r   rw  r  )r  r  r>  r:  r  r   r   r   )r  r   r>  r   r  r   r   r   )r>  r:  r0  r   r  r   r  r   r  r   r  r  r   r   )r   r   )r  r   r   r   )r+  r   r   r   )r  r   r   r   )r   r   r   r   )rL  r   r  r   r   r   )F)r  r   r  r   r   r   )r  r   r   r   )r   r   )r>  r:  r  r   r  r   r  r  r  r   r  r   r   r  )r  r   r   r   )r  r   r  r   r   r   )r  r   r   r   )r  r   r  r   r   r   )r  r   r>  r:  r  r   r  r
   r  r   r   r  )r  r   r  r   r   r   )r  r  r   r   )r  r  r   r   )r  r  r>  r:  r  r   r   r   )r  r   r>  r:  r   r   )r  r   r>  r   r   rm  )Ar(   r)   r*   LINKER_PREFIXrY  r)  r,  r   r-  idr   classmethodr   r  r%   r+   r3  r   r8  r<  re  rv  r}  r~  r  r  r  r  r  r  rR  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  rS  r  r  r
   PREFER_SHAREDr  r  r  r  r  r  rP  r  r   r  r
  r  __classcell__)r   s   @r/   r1   r1   4   s(       MH@ @ @F6!6!
6! 	6! 		6!
 	6! 	6! 	
6! 	6! 	6! 	6! 	6! 	6! 		6! 	6! 	 6!  	!6!" 	#6! 6!$ 	%6!& 	&0L'6!( 	0B)6!* 	+6!, 	-6!. 	/6!0 	16!2 	
36!4 	56!6 		76!8 	
96!: 	;6!< 	=6!> 	?6!@ 	A6!B 	$C6!D 	E6! 6! 6!F 	#G6!H 	0AI6!J 	K6!L 	M6!N 	
O6!P 	$Q6!R 	S6!T 	U6!V 	W6!X 	Y6!Z 	[6!\ 	]6!^ 		_6!` 	a6!b 	0@c6!d 	e6!f 	g6! 6!h 180=k6! 6! 6!p !U T2K2Q2Q2S2S T T T	B
 8<15	b b b b b b b" 8! 8! 8! 8! [8!t . . . [.` CH>  DH s( s( s( s( [s(j AF d d d d d   d d d df@ f@ f@ f@T quKOi i i i i i: NNN     4> > > > >7 7 7 7 7 z z z z zX X X X      : : : :U U U UR R R R) ) ) ): : : :% % % %D D D D
` ` ` ` `i i i i   t t t tU U U U   F F F F         ] ] ] ] )0(=Z^f f f f f` ` ` `E E E EW W W W W WM M M M M MX X X X X X 6:    [ [ [ [V V V V@ @ @ @r r r ro o o o o o o or.   r1   )'
__future__r   enumos.pathrK  r   typingTr   r   r   mesonlibr   r   r	   r
   r   	compilersr   r   TYPE_CHECKINGbuildr   r   rh  r   r9  r   	envconfigr   linkers.linkersr   r   r!   __annotations__r#   Enumr%   r1   r-   r.   r/   <module>r"     s4  
 # " " " " " "                                 2 1 1 1 1 1 1 1? )######444444))))))))))))''''''//////(((((( 



	

4 4      &. .        DI   Ko Ko Ko Ko Ko8 Ko Ko Ko Ko Kor.   