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