1 |
from __future__ import division, print_function, unicode_literals |
2 |
|
3 |
import os |
4 |
|
5 |
Import('env') |
6 |
|
7 |
# math libs |
8 |
mlib = env['RAD_MLIB'] |
9 |
|
10 |
# compose paths |
11 |
def radbin(name): return os.path.join('$RAD_BUILDBIN', name) |
12 |
def radlib(name): return os.path.join('$RAD_BUILDLIB', name) |
13 |
|
14 |
# common objects |
15 |
viewbeams = env.Object(source='viewbeams.c') |
16 |
holo = env.Object(source='holo.c') |
17 |
holofile = env.Object(source='holofile.c') |
18 |
clumpbeams = env.Object(source='clumpbeams.c') |
19 |
|
20 |
# standard targets |
21 |
PROGS = ( |
22 |
('rholo', Split('''rholo.c rholo2.c rholo2l.c rholo3.c rholo4.c''') |
23 |
+ [env.version, holofile, holo, viewbeams], ['rtrad'],0), |
24 |
('rhpict', Split('rhpict.c rhpict2.c')+[env.version, holofile, holo, viewbeams], |
25 |
['rtrad'],1), |
26 |
('rhcopy', Split('rhcopy.c') + [clumpbeams, holofile, holo], ['rtrad'],1), |
27 |
('rhinfo', Split('rhinfo.c') + [holofile, holo], ['rtrad'],1), |
28 |
('rhoptimize', Split('rhoptimize.c') + [clumpbeams,holofile,holo], ['rtrad'],1), |
29 |
('genrhgrid', Split('genrhgrid.c') + [holofile, holo], ['rtrad'],1), |
30 |
) |
31 |
if 1: |
32 |
for p in PROGS: |
33 |
if not p[3] and os.name == 'nt': continue |
34 |
prog = env.Program(target=radbin(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.Clone(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 |
addobj = xenv.get('ADDOBJNOTIFY') |
53 |
|
54 |
# XXX the .hdi extension will cause problems on Windows |
55 |
xenv['PROGSUFFIX'] = '.hdi' |
56 |
|
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=radbin(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=radbin( |
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 |
['rtrad', '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','rtrad'] |
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 |
['rtrad', 'GLU','GL','X11'] + mlib, |
86 |
'rhd_glx1', 'rhd_glx1.c', ['-DNOSTEREO']), |
87 |
|
88 |
# oglh |
89 |
('ogl', ogl_common + [addobj], |
90 |
rgllibs+['rtrad', 'GLU','GL','X11'] + mlib, |
91 |
'rhd_ogl0', 'rhd_ogl.c', ['-DNOSTEREO']), |
92 |
|
93 |
# ogloh |
94 |
('oglo', [rhdobj] + ogl_common + [addobj], |
95 |
rgllibs+['rtrad']+['rtrad', '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+['rtrad', 'GLU','GL','X11','Xext'] + mlib, |
106 |
'rhd_ogls', 'rhd_ogl.c', ['-DSTEREO']), |
107 |
|
108 |
# oglsoh |
109 |
('oglso', [rhdobj] + ogl_common, |
110 |
rgllibs+['rtrad', '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 |
|
118 |
# vim: set syntax=python: |
119 |
# vi: set ts=4 sw=4 : |