#NEWLINE# @ conf #NEWLINE# def find_root( ctx , **kwargs ) : #NEWLINE# #INDENT# ctx . load ( 'hwaf-base' , tooldir = _heptooldir ) #NEWLINE# ctx . load ( 'find_python' , tooldir = _heptooldir ) #NEWLINE# ctx . load ( 'find_libxml2' , tooldir = _heptooldir ) #NEWLINE# ctx . load ( 'find_gccxml' , tooldir = _heptooldir ) #NEWLINE# if ( not ctx . env . HWAF_FOUND_C_COMPILER ) : #NEWLINE# #INDENT# ctx . fatal ( 'load a C compiler first' ) #NEWLINE# pass #NEWLINE# #UNINDENT# if ( not ctx . env . HWAF_FOUND_CXX_COMPILER ) : #NEWLINE# #INDENT# ctx . fatal ( 'load a C++ compiler first' ) #NEWLINE# pass #NEWLINE# #UNINDENT# if ( not ctx . env . HWAF_FOUND_PYTHON ) : #NEWLINE# #INDENT# ctx . find_python ( version = kwargs . get ( 'python_version' , ( 2 , 6 ) ) ) #NEWLINE# #UNINDENT# if ( not ctx . env . HWAF_FOUND_LIBXML2 ) : #NEWLINE# #INDENT# ctx . find_libxml2 ( mandatory = False ) #NEWLINE# #UNINDENT# if ( not ctx . env . PYTHON ) : #NEWLINE# #INDENT# ctx . fatal ( 'load a python interpreter first' ) #NEWLINE# pass #NEWLINE# #UNINDENT# root_cfg = 'root-config' #NEWLINE# path_list = waflib . Utils . to_list ( kwargs . get ( 'path_list' , [ ] ) ) #NEWLINE# for topdir in [ getattr ( ctx . options , 'with_root' , None ) , os . getenv ( 'ROOTSYS' , None ) ] : #NEWLINE# #INDENT# if topdir : #NEWLINE# #INDENT# topdir = ctx . hwaf_subst_vars ( topdir ) #NEWLINE# path_list . append ( osp . join ( topdir , 'bin' ) ) #NEWLINE# pass #NEWLINE# #UNINDENT# pass #NEWLINE# #UNINDENT# kwargs [ 'path_list' ] = path_list #NEWLINE# ctx . find_program ( root_cfg , var = 'ROOT-CONFIG' , ** kwargs ) #NEWLINE# root_cfg = ctx . env [ 'ROOT-CONFIG' ] #NEWLINE# ctx . check_with ( ctx . check_cfg , 'root' , path = root_cfg , package = '' , uselib_store = 'ROOT' , args = '--libs --cflags --ldflags' , ** kwargs ) #NEWLINE# version = ctx . check_cxx ( msg = 'Checking ROOT version' , okmsg = 'ok' , fragment = '        #include "RVersion.h"\n        #include <iostream>\n\n        int main(int argc, char* argv[]) {\n          std::cout << ROOT_RELEASE;\n          return 0;\n        }\n        ' , use = 'ROOT' , define_name = 'HWAF_ROOT_VERSION' , define_ret = True , execute = True , mandatory = True ) #NEWLINE# ctx . msg ( 'ROOT version' , version ) #NEWLINE# use_root6 = version . startswith ( '6.' ) #NEWLINE# use_root5 = ( ( not version . startswith ( '5.99' ) ) and ( not use_root6 ) ) #NEWLINE# if use_root5 : #NEWLINE# #INDENT# ctx . find_program ( 'genmap' , var = 'GENMAP' , ** kwargs ) #NEWLINE# #UNINDENT# ctx . find_program ( 'genreflex' , var = 'GENREFLEX' , ** kwargs ) #NEWLINE# ctx . find_program ( 'root' , var = 'ROOT-EXE' , ** kwargs ) #NEWLINE# ctx . find_program ( 'rootcint' , var = 'ROOTCINT' , ** kwargs ) #NEWLINE# ctx . find_program ( 'rlibmap' , var = 'RLIBMAP' , ** kwargs ) #NEWLINE# if use_root6 : #NEWLINE# #INDENT# ctx . find_program ( 'rootcling' , var = 'ROOTCLING' , ** kwargs ) #NEWLINE# pass #NEWLINE# #UNINDENT# if use_root5 : #NEWLINE# #INDENT# ctx . copy_uselib_defs ( dst = 'Reflex' , src = 'ROOT' ) #NEWLINE# ctx . env [ 'LIB_Reflex' ] = [ 'Reflex' ] #NEWLINE# ctx . copy_uselib_defs ( dst = 'Cintex' , src = 'ROOT' ) #NEWLINE# ctx . env [ 'LIB_Cintex' ] = [ 'Reflex' , 'Cintex' ] #NEWLINE# pass #NEWLINE# #UNINDENT# ctx . copy_uselib_defs ( dst = 'PyROOT' , src = 'ROOT' ) #NEWLINE# ctx . env [ 'LIB_PyROOT' ] = ( [ 'PyROOT' ] + fname . env [ 'LIB_python' ] ) #NEWLINE# ctx . copy_uselib_defs ( dst = 'ROOT-XMLIO' , src = 'ROOT' ) #NEWLINE# ctx . env [ 'LIB_ROOT-XMLIO' ] = [ 'XMLIO' ] #NEWLINE# ctx . copy_uselib_defs ( dst = 'ROOT-XMLParser' , src = 'ROOT' ) #NEWLINE# ctx . env [ 'LIB_ROOT-XMLParser' ] = [ 'XMLParser' ] #NEWLINE# ctx . copy_uselib_defs ( dst = 'ROOT-TreePlayer' , src = 'ROOT' ) #NEWLINE# ctx . env [ 'LIB_ROOT-TreePlayer' ] = [ 'TreePlayer' ] #NEWLINE# ctx . copy_uselib_defs ( dst = 'ROOT-GenVector' , src = 'ROOT' ) #NEWLINE# ctx . env [ 'LIB_ROOT-GenVector' ] = [ 'GenVector' ] #NEWLINE# if ( not ctx . env . HWAF_FOUND_GCCXML ) : #NEWLINE# #INDENT# ctx . find_gccxml ( ) #NEWLINE# pass #NEWLINE# #UNINDENT# ctx . check_cxx ( msg = 'Checking for ROOT::TH1' , fragment = '        #include "TH1F.h"\n        void test_th1f() { new TH1F("th1f", "th1f", 100, 0., 100.); }\n        int main(int argc, char* argv[]) {\n          test_th1f();\n          return 0;\n        }\n        ' , use = 'ROOT' , execute = True , mandatory = True ) #NEWLINE# ctx . check_cxx ( msg = 'Checking for ROOT::TTree' , fragment = '        #include "TTree.h"\n        void test_ttree() { new TTree("tree", "tree"); }\n        int main(int argc, char* argv[]) {\n          test_ttree();\n          return 0;\n        }\n        ' , use = 'ROOT' , execute = True , mandatory = True ) #NEWLINE# ctx . check_cxx ( msg = 'Checking for pyroot-cxx' , features = 'cxx cxxshlib' , fragment = '        #include "Python.h"\n        #include "TPython.h"\n        #include "TPyException.h"\n        \n        void throw_py_exception ()\n        {\n          throw PyROOT::TPyException();\n        }\n        ' , use = 'ROOT PyROOT python' , mandatory = True ) #NEWLINE# if use_root5 : #NEWLINE# #INDENT# ctx . check_cxx ( msg = 'Checking for reflex' , features = 'cxx cxxshlib' , fragment = '            #include "Reflex/Type.h"\n            #include <iostream>\n        \n            void check_reflex ()\n            {\n               std::cout << "typeof(int): ["\n                         << Reflex::Type::ByName("int").Name()\n                         << std::endl;\n            }\n            ' , use = 'ROOT Reflex' , mandatory = True ) #NEWLINE# ctx . check_cxx ( msg = 'Checking for cintex' , fragment = '            #include "Cintex/Cintex.h"\n        \n            int main()\n            {\n              ROOT::Cintex::Cintex::Enable();\n              return 0;\n            }\n            ' , use = 'ROOT Cintex' , execute = True , mandatory = True ) #NEWLINE# pass #NEWLINE# #UNINDENT# ctx . start_msg ( 'Checking for $ROOTSYS' ) #NEWLINE# rootsys = ctx . hwaf_subst_vars ( '${ROOTSYS}' ) #NEWLINE# if ( not rootsys ) : #NEWLINE# #INDENT# rootsys = os . getenv ( 'ROOTSYS' , None ) #NEWLINE# pass #NEWLINE# #UNINDENT# if ( not rootsys ) : #NEWLINE# #INDENT# rootsys = ctx . env . ROOT_HOME #NEWLINE# pass #NEWLINE# #UNINDENT# if ( not rootsys ) : #NEWLINE# #INDENT# rootsys = getattr ( ctx . options , 'with_root' , None ) #NEWLINE# pass #NEWLINE# #UNINDENT# ctx . end_msg ( rootsys ) #NEWLINE# if ( not rootsys ) : #NEWLINE# #INDENT# ctx . fatal ( 'No $ROOTSYS environment variable' ) #NEWLINE# pass #NEWLINE# #UNINDENT# ctx . env . ROOTSYS = ctx . hwaf_subst_vars ( rootsys ) #NEWLINE# ctx . hwaf_declare_runtime_env ( 'ROOTSYS' ) #NEWLINE# ctx . env . prepend_value ( 'PATH' , osp . join ( ctx . env . ROOTSYS , 'bin' ) ) #NEWLINE# ctx . env . prepend_value ( 'LD_LIBRARY_PATH' , osp . join ( ctx . env . ROOTSYS , 'lib' ) ) #NEWLINE# pyroot_path = osp . join ( ctx . env . ROOTSYS , 'lib' ) #NEWLINE# ctx . env . prepend_value ( 'PYTHONPATH' , pyroot_path ) #NEWLINE# ctx . env . prepend_value ( 'LD_LIBRARY_PATH' , pyroot_path ) #NEWLINE# ctx . find_python_module ( 'ROOT' ) #NEWLINE# if use_root5 : #NEWLINE# #INDENT# ctx . find_python_module ( 'PyCintex' ) #NEWLINE# pass #NEWLINE# #UNINDENT# ctx . env . ROOT_VERSION = version #NEWLINE# import sys #NEWLINE# fname = __file__ #NEWLINE# if fname . endswith ( '.pyc' ) : #NEWLINE# #INDENT# fname = fname [ : ( - 1 ) ] #NEWLINE# #UNINDENT# ctx . hwaf_export_module ( ctx . root . find_node ( fname ) . abspath ( ) ) #NEWLINE# ctx . env . HWAF_FOUND_ROOT = 1 #NEWLINE# return