1 |
import os |
2 |
|
3 |
from SCons.SConf import SConf # aka Configure |
4 |
|
5 |
def find_radlib(env): |
6 |
v = env.FindFile('Verdana.fnt', './lib') |
7 |
if not v: |
8 |
print ''' |
9 |
Radiance auxiliary support files not found. |
10 |
-> Download from radiance-online.org and extract. |
11 |
''' |
12 |
env.Exit() |
13 |
|
14 |
def find_x11(env): |
15 |
# Search for libX11, remember the X11 library and include dirs |
16 |
for d in ('/usr/X11R6', '/usr/X11', '/usr/openwin'): |
17 |
if os.path.isdir (d): |
18 |
incdir = os.path.join(d, 'include') |
19 |
libdir = os.path.join(d, 'lib') |
20 |
env.Prepend(CPPPATH=[incdir]) # add temporarily |
21 |
env.Prepend(LIBPATH=[libdir]) |
22 |
conf = SConf(env) |
23 |
if conf.CheckLibWithHeader('X11', 'X11/X.h', 'C', autoadd=0): |
24 |
env.Replace(X11INCLUDE=incdir) |
25 |
env.Replace(X11LIB=libdir) |
26 |
env['CPPPATH'].remove(incdir) # not needed for now |
27 |
env['LIBPATH'].remove(libdir) |
28 |
if env['X11INCLUDE']: |
29 |
# Check for SGI stereo extension |
30 |
if conf.CheckCHeader('X11/extensions/SGIStereo.h'): |
31 |
env['RAD_STEREO'] = '-DSTEREO' |
32 |
else: env['RAD_STEREO'] = '-DNOSTEREO' |
33 |
env = conf.Finish () |
34 |
break |
35 |
env = conf.Finish () |
36 |
|
37 |
|
38 |
def find_gl(env): |
39 |
# Check for libGL, set flag |
40 |
dl = [(None,None)] # standard search path |
41 |
if env.has_key('X11INCLUDE'): # sometimes found there (Darwin) |
42 |
dl.append((env['X11INCLUDE'], env['X11LIB'])) |
43 |
for incdir, libdir in dl: |
44 |
if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily |
45 |
if libdir: env.Prepend(LIBPATH=[libdir]) |
46 |
conf = SConf(env) |
47 |
if conf.CheckLibWithHeader('GL', 'GL/gl.h', 'C', autoadd=0): |
48 |
env['OGL'] = 1 |
49 |
if incdir: env['CPPPATH'].remove(incdir) # not needed for now |
50 |
if libdir: env['LIBPATH'].remove(libdir) |
51 |
if env.has_key('OGL'): |
52 |
if incdir: env.Replace(OGLINCLUDE=[incdir]) |
53 |
#if libdir: env.Replace(OGLLIB=[libdir]) |
54 |
conf.Finish() |
55 |
break |
56 |
conf.Finish() |
57 |
|
58 |
|
59 |
def find_libtiff(env): |
60 |
# Check for libtiff, set flag and include/lib directories |
61 |
dl = [ (None,None), ] # standard search path |
62 |
cfgi = env.get('TIFFINCLUDE') |
63 |
cfgl = env.get('TIFFLIB') |
64 |
if cfgi or cfgl: |
65 |
dl.insert(0,(cfgi, cfgl)) |
66 |
for incdir, libdir in dl: |
67 |
if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily |
68 |
if libdir: env.Prepend(LIBPATH=[libdir]) |
69 |
conf = SConf(env) |
70 |
if conf.CheckLib('tiff', 'TIFFInitSGILog', |
71 |
header='void TIFFInitSGILog(void);', autoadd=0): |
72 |
env['TIFFLIB_INSTALLED'] = 1 |
73 |
if incdir: env['CPPPATH'].remove(incdir) # not needed for now |
74 |
if libdir: env['LIBPATH'].remove(libdir) |
75 |
if env.has_key('TIFFLIB_INSTALLED'): |
76 |
if incdir: env.Replace(RAD_TIFFINCLUDE=[incdir]) |
77 |
if libdir: env.Replace(RAD_TIFFLIB=[libdir]) |
78 |
conf.Finish() |
79 |
break |
80 |
conf.Finish() |
81 |
|