a
    WÄ±b  ã                   @   s~   d Z ddlmZ ddlmZ ddlmZ ddlZ	ddl
mZmZmZ e e e¡¡Zdd„ Zdd	„ Zd
d„ Zeddd„ƒZdS )a”  This tool implements a source package following a few contentions.

Your source package may build any combination of the following:

 - shared libraries 
 - headers exposing an API to libraries
 - a ROOT dictionary for this API
 - main programs
 - test programs

This tool will produce various methods on the build context.  You can
avoid passing <name> to them if you set APPNAME in your wscript file.

é    N)Úto_list)Úconf)ÚdebugÚinfoÚerrorc                 C   sl   |   d¡ |   d¡ | j dtd� | j dtd� | j dtd� | j dtd� | j dtd� | j d	td� d S ©
NÚcompiler_cxxÚwaf_unit_testZ	find_root)ÚtooldirZ
find_fftw3Z	find_glpkZfind_eigen3ZboostZfind_python©ÚloadÚ_tooldir)Úopt© r   úwaf-tools/find_package.pyÚoptions   s    

r   c                 C   sl   |   d¡ |   d¡ | j dtd� | j dtd� | j dtd� | j dtd� | j dtd� | j d	td� d S r   r   )Úcfgr   r   r   Ú	configure$   s    

r   c                 C   s   ddl m} |  |j¡ d S )Nr   )r	   )Zwaflib.Toolsr	   Úadd_post_funZsummary)Úbldr	   r   r   r   Úbuild/   s    r   Ú c              	   C   sœ  t |ƒ}g }g }g }| j d¡}| j d¡}| j d¡}| j d¡| j d¡ }	| j d¡}
|r�|| |d ¡7 }|dg7 }| ¡ g| jd| < |r¤|  d	| |¡ |r¶|| d
¡7 }|rö|sÊtd| ƒ | d¡}| j	|||||d� | 
|d ¡ |�r|�r| d|||dd|d� |	�r\| jj�s\|	D ].}| jd|g|j dd¡d d||g d� �q,|
�r˜|
 d
¡D ]*}| j|g|j dd¡d||g d� �qld S )NZincÚsrcÚdictztest/test_*.cxxztests/test_*.cxxZappsz/*.hZ	INCLUDES_z${PREFIX}/include/%sz*.cxxz(No header files for ROOT dictionary "%s"z	LinkDef.h)ÚheadersÚincludesÚusezDict.cxxzcxx cxxshlib)ÚfeaturesÚnameÚsourceÚtargetr   Zexport_includesr   Útestz.cxxr   )r   r   r    Úinstall_pathr   r   )r   r    r   r   )r   ÚpathÚfind_dirÚant_globÚabspathÚenvÚinstall_filesr   Úfind_resourceZgen_rootcling_dictÚappendr   Úno_testsÚprogramr   Úreplace)r   r   r   r   r   r   ZincdirZsrcdirZdictdirZtestsrcZappsdirZlinkdefZ	test_mainÚappr   r   r   Úmake_package4   sh    

ýúû
ýr/   )r   )Ú__doc__Zos.pathr#   ZospZwaflib.Utilsr   Zwaflib.Configurer   Zwaflib.ContextÚwaflibZwaflib.Logsr   r   r   Údirnamer&   Ú__file__r   r   r   r   r/   r   r   r   r   Ú<module>   s   