ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/build_utils/find_libs.py
Revision: 1.7
Committed: Thu Mar 10 01:49:56 2016 UTC (8 years, 2 months ago) by schorsch
Content type: text/x-python
Branch: MAIN
Changes since 1.6: +7 -2 lines
Log Message:
SCons build system learns about platform architecture

File Contents

# User Rev Content
1 schorsch 1.1 import os
2    
3     from SCons.SConf import SConf # aka Configure
4    
5 schorsch 1.5 def find_radlib(env):
6 greg 1.6 v = env.FindFile('helvet.fnt', './lib')
7 schorsch 1.5 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 schorsch 1.1 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 schorsch 1.4 env.Prepend(CPPPATH=[incdir]) # add temporarily
21     env.Prepend(LIBPATH=[libdir])
22 schorsch 1.1 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 schorsch 1.3
38 schorsch 1.1 def find_gl(env):
39     # Check for libGL, set flag
40 schorsch 1.3 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 schorsch 1.4 if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily
45     if libdir: env.Prepend(LIBPATH=[libdir])
46 schorsch 1.3 conf = SConf(env)
47 schorsch 1.2 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 schorsch 1.3 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 schorsch 1.1
58 schorsch 1.4
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 schorsch 1.7 #print('TIFFLIB:', cfgl)
65 schorsch 1.4 if cfgi or cfgl:
66     dl.insert(0,(cfgi, cfgl))
67     for incdir, libdir in dl:
68     if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily
69     if libdir: env.Prepend(LIBPATH=[libdir])
70     conf = SConf(env)
71 schorsch 1.7 libname = 'tiff'
72     header = 'void TIFFInitSGILog(void);'
73     if os.name == 'nt':
74     libname = 'libtiff'
75     if conf.CheckLib(libname, 'TIFFInitSGILog',
76     header=header, autoadd=0):
77 schorsch 1.4 env['TIFFLIB_INSTALLED'] = 1
78     if incdir: env['CPPPATH'].remove(incdir) # not needed for now
79     if libdir: env['LIBPATH'].remove(libdir)
80     if env.has_key('TIFFLIB_INSTALLED'):
81     if incdir: env.Replace(RAD_TIFFINCLUDE=[incdir])
82     if libdir: env.Replace(RAD_TIFFLIB=[libdir])
83     conf.Finish()
84     break
85     conf.Finish()
86