import sbms # get env object and clone it Import('*') top_env = env env = env.Clone() # On Ubuntu 13.10, it was confirmed that turning on optimization # when building hddm-cpp led to some things being omitted from the # generated hddm_r.hpp file resulting in compile time errors. Turn # off optimization here to prevent this. opts = ['-O', '-O1', '-O2', '-O3', '-O4'] cflags = env['CFLAGS'] cxxflags = env['CXXFLAGS'] for opt in opts: if opt in cflags : cflags.remove(opt) if opt in cxxflags: cxxflags.remove(opt) env.Replace(CFLAGS=cflags, CXXFLAGS=cxxflags) sbms.AddXERCES(env) sbms.Add_xstream(env) progs = [] commonsrc = ['XString.cpp', 'XParsers.cpp', 'md5.c'] # The hddm-c and hddm-cpp utilities are needed to generate code # for the HDDM library. See src/libraries/HDDM/SConscript for details. hddmc = env.Program(target='hddm-c', source=['hddm-c.cpp' , commonsrc]) hddmcpp = env.Program(target='hddm-cpp', source=['hddm-cpp.cpp', commonsrc]) progs.append( hddmc ) progs.append( hddmcpp ) progs.append( env.Program(target='xml-hddm', source=['xml-hddm.cpp', commonsrc]) ) progs.append( env.Program(target='hddm-xml', source=['hddm-xml.cpp', commonsrc]) ) progs.append( env.Program(target='hddmcat', source=['hddmcat.cpp']) ) # (See src/libraries/HDDM/SConscript) top_env.Requires(env['HDDMC_SRC'] , hddmc ) top_env.Requires(env['HDDMCPP_SRC'], hddmcpp) # Cleaning and installation are restricted to the directory # scons was launched from or its descendents CurrentDir = env.Dir('.').srcnode().abspath if not CurrentDir.startswith(env.GetLaunchDir()): # Not in launch directory. Tell scons no to clean these targets env.NoClean(progs) else: # We're in launch directory (or descendent) schedule installation # Installation directories for executable and headers includedir = env.subst('$INCDIR') bindir = env.subst('$BINDIR') # Install targets env.Install(bindir, ['hddm-schema', 'schema-hddm', 'xml-xml']) env.Install(bindir, progs)