def find_libtiff(env): # Check for libtiff, set flag and include/lib directories dl = [ (None, None), ] # standard search path cfgi = env.get('TIFFINCLUDE') cfgl = env.get('TIFFLIB') if cfgi or cfgl: dl.insert(0, (cfgi, cfgl)) for incdir, libdir in dl: if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily if libdir: env.Prepend(LIBPATH=[libdir]) conf = SConf(env) if conf.CheckLib('tiff', 'TIFFInitSGILog', header='void TIFFInitSGILog(void);', autoadd=0): env['TIFFLIB_INSTALLED'] = 1 if incdir: env['CPPPATH'].remove(incdir) # not needed for now if libdir: env['LIBPATH'].remove(libdir) if env.has_key('TIFFLIB_INSTALLED'): if incdir: env.Replace(RAD_TIFFINCLUDE=[incdir]) if libdir: env.Replace(RAD_TIFFLIB=[libdir]) conf.Finish() break conf.Finish()
def find_libtiff(env): # Check for libtiff, set flag and include/lib directories dl = [ (None,None), ] # standard search path cfgi = env.get('TIFFINCLUDE') cfgl = env.get('TIFFLIB') if cfgi or cfgl: dl.insert(0,(cfgi, cfgl)) for incdir, libdir in dl: xenv = env.Clone() if incdir: xenv.Prepend(CPPPATH=[incdir]) # add temporarily if libdir: xenv.Prepend(LIBPATH=[libdir]) xenv.Prepend(PATH=[libdir]) conf = SConf(xenv) libname = 'tiff' if os.name == 'nt': xenv['INCPREFIX'] = '/I ' # Bug in SCons (uses '/I') libname = 'libtiff' if conf.CheckLib(libname, 'TIFFInitSGILog', header='''#include "tiff.h"''', autoadd=0): env['TIFFLIB_INSTALLED'] = 1 if env.has_key('TIFFLIB_INSTALLED'): env.Replace(RAD_LIBTIFF=libname) if incdir: env.Replace(RAD_TIFFINCLUDE=[incdir]) if libdir: env.Replace(RAD_TIFFLIB=[libdir]) conf.Finish() break conf.Finish()
def find_pyinstaller(env): if os.name != 'nt': return conf = SConf(env) oldpath = (env['ENV'].get('PATH')) try: env['ENV']['PATH'] = os.environ['PATH'] pyinst = conf.CheckProg('pyinstaller.exe') if pyinst: env['PYINSTALLER'] = pyinst env['PYSCRIPTS'] = [] env = conf.Finish() finally: env['ENV']['PATH'] = oldpath
def Configure(self, env): """ Configure each tools """ # Create Configure self.conf = SConf(env, self.custom_tests) for tool in self.tools: try: tool.configure(self,env) except: tool.configure(self) env = self.conf.Finish() return env
def find_gl(env): # Check for libGL, set flag dl = [(None, None)] # standard search path if env.has_key('X11INCLUDE'): # sometimes found there (Darwin) dl.append((env['X11INCLUDE'], env['X11LIB'])) for incdir, libdir in dl: if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily if libdir: env.Prepend(LIBPATH=[libdir]) conf = SConf(env) if conf.CheckLibWithHeader('GL', 'GL/gl.h', 'C', autoadd=0): env['OGL'] = 1 if incdir: env['CPPPATH'].remove(incdir) # not needed for now if libdir: env['LIBPATH'].remove(libdir) if env.has_key('OGL'): if incdir: env.Replace(OGLINCLUDE=[incdir]) #if libdir: env.Replace(OGLLIB=[libdir]) conf.Finish() break conf.Finish()
def find_x11(env): # Search for libX11, remember the X11 library and include dirs for d in ('/usr/X11R6', '/usr/X11', '/usr/openwin'): if os.path.isdir (d): incdir = os.path.join(d, 'include') libdir = os.path.join(d, 'lib') env.Prepend(CPPPATH=[incdir]) # add temporarily env.Prepend(LIBPATH=[libdir]) conf = SConf(env) if conf.CheckLibWithHeader('X11', 'X11/X.h', 'C', autoadd=0): env.Replace(X11INCLUDE=incdir) env.Replace(X11LIB=libdir) env['CPPPATH'].remove(incdir) # not needed for now env['LIBPATH'].remove(libdir) if env['X11INCLUDE']: # Check for SGI stereo extension if conf.CheckCHeader('X11/extensions/SGIStereo.h'): env['RAD_STEREO'] = '-DSTEREO' else: env['RAD_STEREO'] = '-DNOSTEREO' env = conf.Finish () break env = conf.Finish ()
class Config(object): def __init__(self, tools=[], dir=[]): self.init_tools = default_tools + tools self.tools = [] self.tools_dict = {} self._walk = [] self.dir = [os.getcwd()] + dir self.custom_tests = { } for t in self.init_tools: self.add_tool(t) def add_tool(self, tool): """ Add a specific tool and its dependencies recursively in the tool set. Check the circular dependencies. """ if tool in self.tools: return if tool in self._walk: raise CircularDependencies(tool) self._walk.append(tool) # Try to import SConsX tool try: mod = import_tool(tool, self.dir) t = mod.create(self) except Exception as e: # Try to import EGG LIB print("trying egglib import", e) mod = import_tool("egglib", self.dir) t = mod.create(tool, self) self._walk.pop() self.tools.append(t) def find_tool(self, toolname): """ Search for a specific tool """ for tool in self.tools: if tool.name == toolname: return tool def __str__(self): return str([t.name for t in self.tools]) def Options(self, *args, **kwds): """ Add each tool options """ opts = Options(*args, **kwds) self.UpdateOptions(opts) return opts def UpdateOptions(self, opts): for tool in self.tools: tool.option(opts) def Configure(self, env): """ Configure each tools """ # Create Configure self.conf = SConf(env, self.custom_tests) for tool in self.tools: try: tool.configure(self,env) except: tool.configure(self) env = self.conf.Finish() return env def Update(self, env): """ Update the environment for each tools. """ # Create Configure import traceback, sys import warnings for tool in self.tools: try: tool.update(env) except: traceback.print_exception(*sys.exc_info()) warnings.warn("Cannot update correctly tool "+repr(tool.name))
def find_gl(env): # Check for libGL, set flag dl = [(None,None)] # standard search path if env.has_key('X11INCLUDE'): # sometimes found there (Darwin) dl.append((env['X11INCLUDE'], env['X11LIB'])) for incdir, libdir in dl: if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily if libdir: env.Prepend(LIBPATH=[libdir]) conf = SConf(env) if (conf.CheckLib('GL') or conf.CheckLib('opengl32') or conf.CheckCHeader('OpenGL/gl.h') or conf.CheckCHeader('GL/gl.h')): env['OGL'] = 1 if os.name == 'nt': if (conf.CheckLib('GLU') # for winrview or conf.CheckLib('glu32') or conf.CheckCHeader('OpenGL/glu.h')): env['GLU'] = 1 if incdir: env['CPPPATH'].remove(incdir) # not needed for now if libdir: env['LIBPATH'].remove(libdir) if env.has_key('OGL'): if incdir: env.Replace(OGLINCLUDE=[incdir]) if env.has_key('GLU'): if incdir: env.Replace(GLUINCLUDE=[incdir]) #if libdir: env.Replace(OGLLIB=[libdir]) conf.Finish() break conf.Finish()