5 from waflib.Configure
import conf
7 _tooldir = osp.dirname(osp.abspath(__file__))
11 opt = opt.add_option_group(
'ROOT Options')
12 opt.add_option(
'--with-root', default=
None,
13 help=
"give ROOT installation location")
18 instdir = cfg.options.with_root
20 if instdir
and instdir.lower()
in [
'no',
'off',
'false']:
22 raise RuntimeError(
"ROOT is mandatory but disabled via command line")
23 print (
"optional ROOT dependency disabled by command line")
26 cfg.env.CXXFLAGS += [
'-fPIC']
29 for topdir
in [getattr(cfg.options,
'with_root',
None), os.getenv(
'ROOTSYS',
None)]:
31 path_list.append(osp.join(topdir,
"bin"))
33 kwargs = dict(path_list=path_list)
35 cfg.find_program(
'root-config', var=
'ROOT-CONFIG', mandatory=mandatory, **kwargs)
36 if not 'ROOT-CONFIG' in cfg.env:
38 raise RuntimeError(
"root-config not found but ROOT required")
39 print (
"skipping non mandatory ROOT, use --with-root to force")
42 cfg.check_cfg(path=cfg.env[
'ROOT-CONFIG'], uselib_store=
'ROOTSYS',
43 args =
'--cflags --libs --ldflags', package=
'', mandatory=mandatory)
44 cfg.env.LIB_ROOTSYS += [
'Minuit2',
'TreePlayer',
'EG']
46 cfg.find_program(
'rootcling', var=
'ROOTCLING', path_list=path_list, mandatory=mandatory)
50 cfg.check_cxx(header_name=
"Rtypes.h", use=
'ROOTSYS',
62 rootcling -f NAMEDict.cxx -rml libNAME.so -rmf libNAME.rootmap myHeader1.h myHeader2.h ... LinkDef.h 64 use = waflib.Utils.to_list(use) + [
'ROOTSYS']
65 includes = waflib.Utils.to_list(includes)
67 more = bld.env[
'INCLUDES_'+u]
74 if inc.startswith(
'/'):
77 newinc =
'-I%s' % bld.path.find_dir(inc).abspath()
78 if not newinc
in incs:
83 dict_src = name +
'Dict.cxx' 87 dict_lib =
'lib' + name +
'.so' 88 dict_map =
'lib' + name +
'.rootmap' 89 dict_pcm = name +
'Dict_rdict.pcm' 92 linkdef = bld.path.find_resource(linkdef)
93 source_nodes = headers + [linkdef]
94 sources =
' '.
join([x.abspath()
for x
in source_nodes])
95 rule =
'${ROOTCLING} -f ${TGT[0].abspath()} -rml %s -rmf ${TGT[1].abspath()} %s %s' % (dict_lib, incs, sources)
97 bld(source = source_nodes,
98 target = [dict_src, dict_map, dict_pcm],
106 bld.install_files(
'${PREFIX}/lib/', dict_map)
107 bld.install_files(
'${PREFIX}/lib/', dict_pcm)
112 '''Generate a rootcint dictionary, compile it to a shared lib, 113 produce its rootmap file and install it all. 115 headers = waflib.Utils.to_list(headers)
116 incs = [
'-I%s' % bld.path.find_dir(x).abspath()
for x
in waflib.Utils.to_list(includes)]
117 incs =
' '.
join(incs)
119 dict_src = name +
'Dict.cxx' 121 bld(source = headers + [linkdef],
123 rule=
'${ROOTCINT} -f ${TGT} -c %s ${SRC}' % incs)
125 bld.shlib(source = dict_src,
126 target = name+
'Dict',
130 rootmap =
'lib%sDict.rootmap'%name
131 bld(source = [linkdef], target=rootmap,
132 rule=
'${RLIBMAP} -o ${TGT} -l lib%sDict.so -d lib%s.so -c ${SRC}' % (name, name))
134 bld.install_files(
'${PREFIX}/lib/', rootmap)
def check_root(cfg, mandatory=False)
def gen_rootcint_dict(bld, name, linkdef, headers='', includes='')
Proc * join(Pipeline &pipeline, Proc *src, Proc *dst)
def gen_rootcling_dict(bld, name, linkdef, headers='', includes='', use='')