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