1 |
+ |
from __future__ import division, print_function, unicode_literals |
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) |
51 |
|
break |
52 |
|
env = conf.Finish () |
53 |
|
|
54 |
+ |
|
55 |
|
def find_gl(env): |
56 |
|
# Check for libGL, set flag |
57 |
< |
conf = SConf(env) |
58 |
< |
if conf.CheckLibWithHeader('GL', 'GL/gl.h', 'C', autoadd=0): |
59 |
< |
env['OGL'] = 1 |
60 |
< |
elif env.has_key('X11INCLUDE'): # sometimes found there |
61 |
< |
incdir = env['X11INCLUDE'] |
62 |
< |
libdir = env['X11LIB'] |
63 |
< |
env.Append(CPPPATH=[incdir]) # add temporarily |
64 |
< |
#env.Append(LIBPATH=[libdir]) |
65 |
< |
if conf.CheckLibWithHeader('GL', 'GL/gl.h', 'C', autoadd=0): |
57 |
> |
dl = [(None,None)] # standard search path |
58 |
> |
if env.has_key('X11INCLUDE'): # sometimes found there (Darwin) |
59 |
> |
dl.append((env['X11INCLUDE'], env['X11LIB'])) |
60 |
> |
for incdir, libdir in dl: |
61 |
> |
if incdir: env.Prepend(CPPPATH=[incdir]) # add temporarily |
62 |
> |
if libdir: env.Prepend(LIBPATH=[libdir]) |
63 |
> |
conf = SConf(env) |
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 |
< |
env.Replace(OGLINCLUDE=incdir) |
70 |
< |
env.Replace(OGLLIB=libdir) |
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 |
< |
conf.Finish() |
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() |
114 |
+ |
|
115 |
+ |
# vi: set ts=4 sw=4 : |
116 |
|
|