1 |
import os |
2 |
|
3 |
Import('env') |
4 |
|
5 |
# math libs |
6 |
mlib = env['RAD_MLIB'] |
7 |
|
8 |
# common objects |
9 |
viewbeams = env.Object(source='viewbeams.c') |
10 |
holo = env.Object(source='holo.c') |
11 |
holofile = env.Object(source='holofile.c') |
12 |
Version = env.Object(source='../rt/Version.c') # XXX ../rt/not_nice |
13 |
|
14 |
|
15 |
# standard targets |
16 |
PROGS = ( |
17 |
('rholo', Split('''rholo.c rholo2.c rholo2l.c rholo3.c rholo4.c''') |
18 |
+ [Version, holofile, holo, viewbeams], |
19 |
['rtpic','rtio','rtproc','rtpath','rtargs','rtmath','rtmem','rterror']), |
20 |
('rhpict', Split('rhpict.c rhpict2.c')+[Version, holofile, holo, viewbeams], |
21 |
['rtpic','rtio','rtproc','rtargs','rtmath','rtmem','rterror']), |
22 |
('rhcopy', Split('rhcopy.c clumpbeams.c') + [holofile, holo], |
23 |
['rtpic','rtio','rtproc','rtargs','rtmath','rtmem','rterror']), |
24 |
('rhinfo', Split('rhinfo.c') + [holofile, holo], |
25 |
['rtio','rtproc', 'rtmath','rterror']), |
26 |
#('genrhenv', Split('genrhenv.c') + [holofile, holo], |
27 |
# []), # XXX broken |
28 |
('genrhgrid', Split('genrhgrid.c') + [holofile, holo], |
29 |
['rtio','rtmath','rtproc','rterror']), |
30 |
) |
31 |
if os.name != 'nt': # pending some major work... |
32 |
for p in PROGS: |
33 |
prog = env.Program(target=os.path.join(env['RAD_BUILDBIN'], p[0]), |
34 |
source=p[1], LIBS=p[2] + mlib) |
35 |
Default(prog) |
36 |
env.Append(RAD_BININSTALL=[env.Install(env['RAD_BINDIR'], prog)]) |
37 |
|
38 |
# display drivers |
39 |
if env.has_key('X11INCLUDE'): |
40 |
xenv = env.Copy(CPPPATH=[env['X11INCLUDE']] + env['CPPPATH'], |
41 |
LIBPATH=[env['X11LIB']] + env['LIBPATH'],) |
42 |
# common objects |
43 |
rhdisp = xenv.Object(source='rhdisp.c') |
44 |
rhdisp2 = xenv.Object(source='rhdisp2.c') |
45 |
rhd_qtree = env.Object(source='rhd_qtree.c') |
46 |
xcommon = [rhdisp, rhdisp2, holo, viewbeams] |
47 |
# other stuff |
48 |
devdir = os.path.join(xenv['RAD_BUILDBIN'],'dev') |
49 |
idevdir = os.path.join(xenv['RAD_BINDIR'],'dev') |
50 |
ocppflags = xenv.get('CPPFLAGS', []) |
51 |
|
52 |
# XXX the .hdi extension will cause problems on Windows |
53 |
xenv['PROGSUFFIX'] = '.hdi' |
54 |
|
55 |
dlibs = ['rtpic','rtio','rtmath','rtcont','rtmem','rtargs','rterror'] |
56 |
def make_hdi(p): # build them |
57 |
obj = xenv.Object(target=p[3], source=p[4], CPPFLAGS=ocppflags + p[5]) |
58 |
prog = xenv.Program(target=os.path.join(devdir, p[0]), |
59 |
source=[obj] + p[1] + xcommon, LIBS=p[2]) |
60 |
Default(prog) |
61 |
inst = xenv.Install(idevdir, prog) |
62 |
# XXX what are the alternative "<driver>h" names good for? |
63 |
insth = xenv.InstallAs(target=os.path.join(idevdir, |
64 |
p[0] + 'h' + xenv['PROGSUFFIX']), source=prog) |
65 |
env.Append(RAD_BININSTALL=[inst, insth]) |
66 |
|
67 |
# (name, sources, libs, obj, objsrc, objflags) |
68 |
XHDI = (('x11', Split('rhd_ctab.c rhd_qtree2r.c') + [rhd_qtree], |
69 |
dlibs + ['X11'] + mlib, |
70 |
'rhd_x11', 'rhd_x11.c', []), |
71 |
) |
72 |
for p in XHDI: |
73 |
make_hdi(p) |
74 |
|
75 |
if env.has_key('OGL'): |
76 |
rgllibs = ['rgl','rtscene','rtpath'] |
77 |
# XXX There's a BITS(x) macro missing in sm_geom.h |
78 |
#sm_common_s = Split('''sm_samp.c sm_qtree.c sm_stree.c sm_geom.c |
79 |
# sm_list.c sm_del.c sm_ogl.c sm_usets.c sm.c''') |
80 |
#sm_common = map(lambda s:xenv.Object(source=s), sm_common_s) |
81 |
ogl_common_s = Split('rhd_odraw.c rhd_geom.c') |
82 |
ogl_common = map(lambda s:xenv.Object(source=s), ogl_common_s) |
83 |
rhdobj = xenv.Object(source='rhdobj.c') |
84 |
|
85 |
GLHDI = ( |
86 |
('glx1', ['rhd_qtree2c.c', rhd_qtree], |
87 |
dlibs + ['GLU','GL','X11'] + mlib, |
88 |
'rhd_glx1', 'rhd_glx1.c', ['-DNOSTEREO']), |
89 |
|
90 |
#('glx', sm_common, |
91 |
# dlibs + ['GLU','GL','X11'] + mlib, |
92 |
# 'rhd_glx0', 'rhd_glx.c', ['-DNOSTEREO']), |
93 |
|
94 |
#('glxo', [rhdobj] + sm_common, |
95 |
# rgllibs+dlibs+['GLU','GL','X11'] + mlib, |
96 |
# 'rhd_glxo', 'rhd_glx.c', ['-DDOBJ', '-DNOSTEREO']), |
97 |
|
98 |
('ogl', ogl_common, |
99 |
rgllibs+dlibs+['GLU','GL','X11'] + mlib, |
100 |
'rhd_ogl0', 'rhd_ogl.c', ['-DNOSTEREO']), |
101 |
|
102 |
('oglo', [rhdobj] + ogl_common, |
103 |
rgllibs+['rtproc']+dlibs+['GLU','GL','X11'] + mlib, |
104 |
'rhd_oglo', 'rhd_ogl.c', ['-DDOBJ', '-DNOSTEREO']), |
105 |
) |
106 |
for p in GLHDI: |
107 |
make_hdi(p) |
108 |
if xenv['RAD_STEREO'] == '-DSTEREO': |
109 |
|
110 |
GLSHDI = ( |
111 |
#('glxs', sm_common, |
112 |
# dlibs + ['GLU','GL','X11','Xext'] + mlib, |
113 |
# 'rhd_glxs', 'rhd_glx.c' ['-DSTEREO']), |
114 |
|
115 |
#('glxso', [rhdobj] + sm_common, |
116 |
# rgllibs+dlibs+['GLU','GL','X11','Xext'] + mlib, |
117 |
# 'rhd_glxo', 'rhd_glx.c' ['-DDOBJ', '-DSTEREO']), |
118 |
|
119 |
('ogls', ogl_common, |
120 |
rgllibs+dlibs+['GLU','GL','X11','Xext'] + mlib, |
121 |
'rhd_ogls', 'rhd_ogl.c' ['-DSTEREO']), |
122 |
|
123 |
('oglso', [rhdobj] + ogl_common, |
124 |
rgllibs+dlibs+['GLU','GL','X11','Xext'] + mlib, |
125 |
'rhd_oglso', 'rhd_ogl.c' ['-DDOBJ', '-DSTEREO']), |
126 |
) |
127 |
for p in GLHDI: |
128 |
make_hdi(p) |
129 |
|
130 |
|
131 |
|