ó
(•^c           @   s²   d  Z  d d l j Z d d l m Z d d l m Z d d l Z	 d d l
 m Z m Z m Z m Z e j e j e ƒ ƒ Z d „  Z d „  Z d „  Z e d	 d	 d	 d
 „ ƒ Z d S(   s”  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.

iÿÿÿÿN(   t   to_list(   t   conf(   t   debugt   infot   errort   warnc         C   s   |  j  d ƒ |  j  d ƒ d  S(   Nt   compiler_cxxt   waf_unit_test(   t   load(   t   opt(    (    s   waftools/smplpkgs.pyt   options   s    c         C   sf   |  j  d ƒ |  j  d ƒ |  j j d d g ƒ |  j d d d d t ƒ|  j d	 d d
 d t ƒd  S(   NR   R   t   CXXFLAGSs
   -std=c++17t   pythont   vart   PYTHONt	   mandatoryt   basht   BASH(   R   t   envt   append_uniquet   find_programt   True(   t   cfg(    (    s   waftools/smplpkgs.pyt	   configure   s    c         C   s$   d d l  m } |  j | j ƒ d  S(   Niÿÿÿÿ(   R   (   t   waflib.ToolsR   t   add_post_funt   summary(   t   bldR   (    (    s   waftools/smplpkgs.pyt   build(   s    t    c            s4  t  t t | ƒ ƒ ƒ } t  t | t | ƒ ƒ ƒ } t  t | t | ƒ ƒ ƒ } ˆ  j g } g  } g  } ˆ  j j d ƒ } ˆ  j j d ƒ }	 ˆ  j j d ƒ }
 ˆ  j j d ƒ } ˆ  j j d ƒ ˆ  j j d ƒ } ˆ  j j d ƒ } ˆ  j j d ƒ } | r=| | j | d	 ƒ 7} | d g 7} | j ƒ  g ˆ  j d
 | <n  | rZˆ  j	 d | | ƒ n  |	 r‰| |	 j d ƒ 7} | |	 j d ƒ 7} n  |
 r| s¦t
 d | ƒ n  d | k r|
 j d ƒ } ˆ  j | | d | d | d | ƒ| j ˆ  j j | d ƒ ƒ qt d | ƒ n  t ‡  f d † } | rr|	 rrˆ  d d d | d | d | d | | ƒ d | d d d | ƒ n  | réxn | j d ƒ D]Z } ˆ  j d | g d | j j d d ƒ d | d | | | g d  t ƒd | | g ƒ qˆWn  | sõ| rçˆ  j j rçx€ | D]x } | | | g ƒ } ˆ  j d d! d | g d" ˆ  j d | j j d d ƒ d# d  d | d d d! d$ g d | | g ƒ q	Wx_ | D]T } d% } | j ƒ  j d& ƒ r¶d' } n  ˆ  d d( d" ˆ  j d) | d* d+ | d, ƒ qŒWn  | r0ˆ  j j r0x3 | D]( } ˆ  d d( d" ˆ  j d) | d* d- ƒ qWn  d  S(.   Nt   inct   srct   dicts   test/test_*.cxxs   test/test_*.shs   test/test_*.pys   test/test*.jsonnett   appss   /*.ht	   INCLUDES_s   ${PREFIX}/include/%ss   *.cxxs   *.cus(   No header files for ROOT dictionary "%s"t   ROOTSYSs	   LinkDef.ht   headerst   includest   uses   Dict.cxxsM   No ROOT dictionary will be generated for "%s" unless "ROOTSYS" added to "use"c   	         sÌ   t  ˆ  j d d g ƒ } xŸ |  D]— } ˆ  j d | } x | D] } | j | ƒ q? W| r! | j d ƒ r¸ | d j ƒ  } ˆ  j j ˆ  j ƒ } | j | ƒ j ƒ  } | j | ƒ q¸ q! q! Wt	 | ƒ } | S(   Nt   PREFIXs   /libt   LIBPATH_t   WireCelli   (
   t   setR   t   addt
   startswitht   lowert   patht   find_or_declaret   out_dirt   abspatht   list(	   t   uselstt   localt   rett   onet   libpatht   lt   sdt   blddirt   pkgdir(   R   (    s   waftools/smplpkgs.pyt	   get_rpath]   s    t   featuress   cxx cxxshlibt   namet   sourcet   targett   rpatht   export_includess   .cxxR   R4   t   testt   ut_cwdt   install_patht   testss   ${BASH}s   .pys	   ${PYTHON}t   test_scriptst   test_scripts_sourcet   test_scripts_templates   pwd && s
    ${SCRIPT}s   pwd && wcsonnet ${SCRIPT}(   R2   R*   R    R0   R.   t   find_dirt   ant_globR1   R   t   install_filesR   t   find_resourcet   gen_rootcling_dictt   appendR/   R   R   t   programR>   t   replacet   FalseR
   t   no_testst   Nonet   endswith(   R   R>   R&   t   app_uset   test_useR%   R$   R?   t   incdirt   srcdirt   dictdirt   testsrcRG   t   test_jsonnetst   appsdirt   linkdefR<   t   appt	   test_mainRA   t   test_scriptt   interpt   test_jsonnet(    (   R   s   waftools/smplpkgs.pyt   smplpkg-   s–    " 
					(   t   __doc__t   os.pathR.   t   ospt   waflib.UtilsR    t   waflib.ConfigureR   t   waflib.Contextt   waflibt   waflib.LogsR   R   R   R   t   dirnameR1   t   __file__t   _tooldirR
   R   R   Rd   (    (    (    s   waftools/smplpkgs.pyt   <module>   s   "		
	