ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/build_utils/find_libs.py
(Generate patch)

Comparing ray/build_utils/find_libs.py (file contents):
Revision 1.3 by schorsch, Thu Oct 21 15:47:12 2004 UTC vs.
Revision 1.10 by schorsch, Tue Apr 19 21:21:23 2016 UTC

# Line 1 | Line 1
1 + from __future__ import print_function
2 +
3   import os
4  
5   from SCons.SConf import SConf # aka Configure
6  
7 + def find_radlib(env):
8 +        v = env.FindFile('helvet.fnt', './lib')
9 +        if not v:
10 +                print('''
11 +        Radiance auxiliary support files not found.
12 +        -> Download from radiance-online.org and extract.
13 +        ''')
14 +                env.Exit()
15 +
16 + def find_pyinstaller(env):
17 +        if os.name != 'nt':
18 +                return
19 +        conf = SConf(env)
20 +        oldpath = (env['ENV'].get('PATH'))
21 +        try:
22 +                env['ENV']['PATH'] = os.environ['PATH']
23 +                pyinst = conf.CheckProg('pyinstaller.exe')
24 +                if pyinst:
25 +                        env['PYINSTALLER'] = pyinst
26 +                        env['PYSCRIPTS'] = []
27 +                env = conf.Finish()
28 +        finally:
29 +                env['ENV']['PATH'] = oldpath
30 +
31   def find_x11(env):
32          # Search for libX11, remember the X11 library and include dirs
33          for d in ('/usr/X11R6', '/usr/X11', '/usr/openwin'):
34                  if os.path.isdir (d):
35                          incdir = os.path.join(d, 'include')
36                          libdir = os.path.join(d, 'lib')
37 <                        env.Append(CPPPATH=[incdir]) # add temporarily
38 <                        env.Append(LIBPATH=[libdir])
37 >                        env.Prepend(CPPPATH=[incdir]) # add temporarily
38 >                        env.Prepend(LIBPATH=[libdir])
39                          conf = SConf(env)
40                          if conf.CheckLibWithHeader('X11', 'X11/X.h', 'C', autoadd=0):
41                                  env.Replace(X11INCLUDE=incdir)
# Line 31 | Line 57 | def find_gl(env):
57          dl = [(None,None)] # standard search path
58          if env.has_key('X11INCLUDE'): # sometimes found there (Darwin)
59                  dl.append((env['X11INCLUDE'], env['X11LIB']))
34        #if os.name == 'nt':
35        #       dl.append((some win specific dirs))
36        #if some other weirdness:
37        #       ...
60          for incdir, libdir in dl:
61 <                if incdir: env.Append(CPPPATH=[incdir]) # add temporarily
62 <                if libdir: env.Append(LIBPATH=[libdir])
61 >                if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily
62 >                if libdir: env.Prepend(LIBPATH=[libdir])
63                  conf = SConf(env)
64 <                if conf.CheckLibWithHeader('GL', 'GL/gl.h', 'C', autoadd=0):
64 >                if (conf.CheckLib('GL')
65 >                                or conf.CheckLib('opengl32')
66 >                                or conf.CheckCHeader('OpenGL/gl.h')
67 >                                or conf.CheckCHeader('GL/gl.h')):
68                          env['OGL'] = 1
69 +                if os.name == 'nt':
70 +                        if (conf.CheckLib('GLU') # for winrview
71 +                                        or conf.CheckLib('glu32')
72 +                                        or conf.CheckCHeader('OpenGL/glu.h')):
73 +                                env['GLU'] = 1
74                  if incdir: env['CPPPATH'].remove(incdir) # not needed for now
75                  if libdir: env['LIBPATH'].remove(libdir)
76                  if env.has_key('OGL'):
77                          if incdir: env.Replace(OGLINCLUDE=[incdir])
78 +                        if env.has_key('GLU'):
79 +                                if incdir: env.Replace(GLUINCLUDE=[incdir])
80                          #if libdir: env.Replace(OGLLIB=[libdir])
81 +                        conf.Finish()
82 +                        break
83 +                conf.Finish()
84 +
85 +
86 + def find_libtiff(env):
87 +        # Check for libtiff, set flag and include/lib directories
88 +        dl = [ (None,None), ] # standard search path
89 +        cfgi = env.get('TIFFINCLUDE')
90 +        cfgl = env.get('TIFFLIB')
91 +        if cfgi or cfgl:
92 +                dl.insert(0,(cfgi, cfgl))
93 +        for incdir, libdir in dl:
94 +                xenv = env.Clone()
95 +                if incdir: xenv.Prepend(CPPPATH=[incdir]) # add temporarily
96 +                if libdir:
97 +                        xenv.Prepend(LIBPATH=[libdir])
98 +                        xenv.Prepend(PATH=[libdir])
99 +                conf = SConf(xenv)
100 +                libname = 'tiff'
101 +                if os.name == 'nt':
102 +                        xenv['INCPREFIX'] = '/I ' # Bug in SCons (uses '/I')
103 +                        libname = 'libtiff'
104 +                if conf.CheckLib(libname, 'TIFFInitSGILog',
105 +                                header='''#include "tiff.h"''', autoadd=0):
106 +                        env['TIFFLIB_INSTALLED'] = 1
107 +                if env.has_key('TIFFLIB_INSTALLED'):
108 +                        env.Replace(RAD_LIBTIFF=libname)
109 +                        if incdir: env.Replace(RAD_TIFFINCLUDE=[incdir])
110 +                        if libdir: env.Replace(RAD_TIFFLIB=[libdir])
111                          conf.Finish()
112                          break
113                  conf.Finish()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines