ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/SConscript
Revision: 1.9
Committed: Thu Mar 10 01:49:56 2016 UTC (8 years, 2 months ago) by schorsch
Branch: MAIN
Changes since 1.8: +9 -7 lines
Log Message:
SCons build system learns about platform architecture

File Contents

# Content
1 import os
2
3 Import('env')
4
5 # math libs
6 mlib = env['RAD_MLIB']
7
8 # compose paths
9 def radbin(name): return os.path.join('$RAD_BUILDBIN', name)
10 def radlib(name): return os.path.join('$RAD_BUILDLIB', name)
11
12 # common objects
13 viewbeams = env.Object(source='viewbeams.c')
14 holo = env.Object(source='holo.c')
15 holofile = env.Object(source='holofile.c')
16 clumpbeams = env.Object(source='clumpbeams.c')
17
18 # standard targets
19 PROGS = (
20 ('rholo', Split('''rholo.c rholo2.c rholo2l.c rholo3.c rholo4.c''')
21 + [env.version, holofile, holo, viewbeams],
22 ['rtpic','rtproc','rtpath','rtio','rtargs','rtmath','rtmem','rterror'],0),
23 ('rhpict', Split('rhpict.c rhpict2.c')+[env.version, holofile, holo, viewbeams],
24 ['rtpic','rtproc','rtargs','rtio','rtmath','rtmem','rterror'],1),
25 ('rhcopy', Split('rhcopy.c') + [clumpbeams, holofile, holo],
26 ['rtpic','rtproc','rtargs','rtio','rtmath','rtmem','rterror'],1),
27 ('rhinfo', Split('rhinfo.c') + [holofile, holo],
28 ['rtio','rtproc', 'rtmath','rterror'],1),
29 ('rhoptimize', Split('rhoptimize.c') + [clumpbeams, holofile, holo],
30 ['rtio','rtproc', 'rtmath','rterror'],1),
31 ('genrhgrid', Split('genrhgrid.c') + [holofile, holo],
32 ['rtio','rtmath','rtproc','rterror'],1),
33 )
34 if 1:
35 for p in PROGS:
36 print(p[0])
37 if not p[3] and os.name == 'nt': continue
38 prog = env.Program(target=radbin(p[0]),
39 source=p[1], LIBS=p[2] + mlib)
40 Default(prog)
41 env.Append(RAD_BININSTALL=[env.Install(env['RAD_BINDIR'], prog)])
42
43 # display drivers
44 if env.has_key('X11INCLUDE'):
45 xenv = env.Clone(CPPPATH=[env['X11INCLUDE']] + env['CPPPATH'],
46 LIBPATH=[env['X11LIB']] + env['LIBPATH'],)
47 # common objects
48 rhdisp = xenv.Object(source='rhdisp.c')
49 rhdisp2 = xenv.Object(source='rhdisp2.c')
50 rhd_qtree = env.Object(source='rhd_qtree.c')
51 xcommon = [rhdisp, rhdisp2, holo, viewbeams]
52 # other stuff
53 devdir = os.path.join(xenv['RAD_BUILDBIN'],'dev')
54 idevdir = os.path.join(xenv['RAD_BINDIR'],'dev')
55 ocppflags = xenv.get('CPPFLAGS', [])
56
57 # XXX the .hdi extension will cause problems on Windows
58 xenv['PROGSUFFIX'] = '.hdi'
59
60 dlibs = ['rtpic','rtmath','rtcont','rtmem','rtargs','rtio','rterror','rtdummy']
61 def make_hdi(p): # build them
62 obj = xenv.Object(target=p[3], source=p[4], CPPFLAGS=ocppflags + p[5])
63 prog = xenv.Program(target=radbin(p[0]),
64 source=[obj] + p[1] + xcommon, LIBS=p[2])
65 Default(prog)
66 inst = xenv.Install(idevdir, prog)
67 # XXX what are the alternative "<driver>h" names good for?
68 insth = xenv.InstallAs(target=radbin(
69 p[0] + 'h' + xenv['PROGSUFFIX']), source=prog)
70 env.Append(RAD_BININSTALL=[inst, insth])
71
72 # (name, sources, libs, obj, objsrc, objflags)
73 XHDI = (('x11', Split('rhd_ctab.c rhd_qtree2r.c') + [rhd_qtree],
74 dlibs + ['X11'] + mlib,
75 'rhd_x11', 'rhd_x11.c', []),
76 )
77 for p in XHDI:
78 make_hdi(p)
79
80 if env.has_key('OGL'):
81 rgllibs = ['rgl','rtscene','rtpath']
82 ogl_common_s = Split('rhd_odraw.c rhd_geom.c')
83 ogl_common = map(lambda s:xenv.Object(source=s), ogl_common_s)
84 rhdobj = xenv.Object(source='rhdobj.c')
85
86 GLHDI = (
87 # glx1h
88 ('glx1', ['rhd_qtree2c.c', rhd_qtree],
89 dlibs + ['GLU','GL','X11'] + mlib,
90 'rhd_glx1', 'rhd_glx1.c', ['-DNOSTEREO']),
91
92 # oglh
93 ('ogl', ogl_common,
94 rgllibs+dlibs+['GLU','GL','X11'] + mlib,
95 'rhd_ogl0', 'rhd_ogl.c', ['-DNOSTEREO']),
96
97 # ogloh
98 ('oglo', [rhdobj] + ogl_common,
99 rgllibs+['rtproc']+dlibs+['GLU','GL','X11'] + mlib,
100 'rhd_oglo', 'rhd_ogl.c', ['-DDOBJ', '-DNOSTEREO']),
101 )
102 for p in GLHDI:
103 make_hdi(p)
104 if xenv['RAD_STEREO'] == '-DSTEREO':
105
106 GLSHDI = (
107 # oglsh
108 ('ogls', ogl_common,
109 rgllibs+dlibs+['GLU','GL','X11','Xext'] + mlib,
110 'rhd_ogls', 'rhd_ogl.c' ['-DSTEREO']),
111
112 # oglsoh
113 ('oglso', [rhdobj] + ogl_common,
114 rgllibs+dlibs+['GLU','GL','X11','Xext'] + mlib,
115 'rhd_oglso', 'rhd_ogl.c' ['-DDOBJ', '-DSTEREO']),
116 )
117 for p in GLHDI:
118 make_hdi(p)
119
120
121
122 # vim: set syntax=python: