def generate(env): """ Detect the freetype library """ from SCons.Options import Options cachefile = env['CACHEDIR'] + '/freetype.cache.py' opts = Options(cachefile) opts.AddOptions(('FREETYPE_CPPPATH', 'flags for the SDL_LIBRARY'), ('FREETYPE_LIBPATH', 'flags for the SDL_LIBRARY'), ('FREETYPE_FLAGS', 'flags for the SDL_LIBRARY'), ('FREETYPE_LIBS', 'flags for the SDL_LIBRARY')) opts.Update(env) if 'configure' in env['TARGS'] or not env.has_key('FREETYPE_FLAGS'): from SCons.Environment import Base freetype_env = Base() freetype_env.ParseConfig( 'pkg-config --cflags --libs freetype2 || freetype-config --cflags --libs' ) freetype_cflags = freetype_env.Dictionary()['CCFLAGS'] freetype_include = freetype_env.Dictionary()['CPPPATH'] freetype_libpath = freetype_env.Dictionary()['LIBPATH'] freetype_lib = freetype_env.Dictionary()['LIBS'] env['FREETYPE_FLAGS'] = freetype_cflags env['FREETYPE_LIBS'] = freetype_lib env['FREETYPE_LIBPATH'] = freetype_libpath env['FREETYPE_CPPPATH'] = freetype_include opts.Save(cachefile, env) env.AppendUnique(LIBS=env['FREETYPE_LIBS'], CXXFLAGS=env['FREETYPE_FLAGS'], CCFLAGS=env['FREETYPE_FLAGS'], LIBPATH=env['FREETYPE_LIBPATH'], CPPPATH=env['FREETYPE_CPPPATH'])
def generate(env): """ Detect the SDL library """ from SCons.Options import Options cachefile = env['CACHEDIR']+'/sdl.cache.py' opts = Options(cachefile) opts.AddOptions( ( 'SDL_CPPPATH', 'flags for the SDL_LIBRARY' ), ( 'SDL_LIBPATH', 'flags for the SDL_LIBRARY' ), ( 'SDL_FLAGS', 'flags for the SDL_LIBRARY' ), ( 'SDL_LIBS', 'flags for the SDL_LIBRARY' ) ) opts.Update(env) if 'configure' in env['TARGS'] or not env.has_key('SDL_FLAGS'): from SCons.Environment import Base sdl_env = Base() sdl_env.ParseConfig('sdl-config --cflags --libs') sdl_cflags = sdl_env.Dictionary()['CCFLAGS'] sdl_include = sdl_env.Dictionary()['CPPPATH'] sdl_libpath = sdl_env.Dictionary()['LIBPATH'] sdl_lib = sdl_env.Dictionary()['LIBS'] # conf = SCons.SConf.SConf( env ) # if not conf.CheckCHeader('Cg/cg.h'): # print 'We really need the cg library !' # print 'Get ftp://download.nvidia.com/developer/cg/Cg_1.3/Linux/Cg-1.3.0501-0700.i386.tar.gz and unpack it in your root directory' # import sys # sys.exit(1) env['SDL_FLAGS']=sdl_cflags env['SDL_LIBS']=sdl_lib env['SDL_LIBPATH']=sdl_libpath env['SDL_CPPPATH']=sdl_include opts.Save(cachefile, env) env.AppendUnique(LIBS=env['SDL_LIBS'], CXXFLAGS=env['SDL_FLAGS'], CCFLAGS=env['SDL_FLAGS'], LIBPATH=env['SDL_LIBPATH'], CPPPATH=env['SDL_CPPPATH'] )