o
    U)i                     @   s,   d dl Z d dlZd dlZd dlZdd ZdS )    Nc                 C   s"  t d}tj|dj| |d}tjd}|d u r5t	d}	t	d}
|
d ur+|
n|	}|d u r5t
dtt dr?t  }nt  }|d	krId
}t j|dd }tdd dD }|||g| }||ddddd|g}|dd |D 7 }|dd |D 7 }|dd |D 7 }tj|tjd |S )N
EXT_SUFFIXz{name}{suffix})namesuffixCCclanggcczFFailed to find C compiler. Please specify via CC environment variable.get_default_schemeZposix_localposix_prefix)schemeincludec                 s   s    | ]}t |V  qd S )N)osgetenv).0var r   `/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/triton/runtime/build.py	<genexpr>   s    z_build.<locals>.<genexpr>)ZTRITON_CUDACRT_PATHZTRITON_CUDART_PATHz-O3z-sharedz-fPICz
-Wno-psabiz-oc                 S      g | ]}d | qS )z-lr   )r   libr   r   r   
<listcomp>!       z_build.<locals>.<listcomp>c                 S   r   )z-Lr   r   dirr   r   r   r   "   r   c                 S   s   g | ]}|d urd| qS )Nz-Ir   r   r   r   r   r   #   s    )stdout)	sysconfigget_config_varr   pathjoinformatenvirongetshutilwhichRuntimeErrorhasattrr   Z_get_default_scheme	get_pathsset
subprocess
check_callDEVNULL)r   srcsrcdirZlibrary_dirsZinclude_dirsZ	librariesr   soccr   r   r
   Zpy_include_dirZcustom_backend_dirsZcc_cmdr   r   r   _build   s.   




r.   )r   r   r!   r'   r.   r   r   r   r   <module>   s
    