| 1 | 
+ | 
from __future__ import division, print_function, unicode_literals | 
| 2 | 
+ | 
 | 
| 3 | 
  | 
import os | 
| 4 | 
  | 
 | 
| 5 | 
  | 
Import('env') # inherit from parent | 
| 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 | 
+ | 
def tclscr(name): return os.path.join('$RAD_BUILDRLIB', 'tcl', name) | 
| 14 | 
  | 
 | 
| 15 | 
< | 
Version = env.Object(source='#src/rt/Version.c') | 
| 15 | 
> | 
cmatrix = env.Object(source='cmatrix.c') | 
| 16 | 
> | 
cmbsdf = env.Object(source='cmbsdf.c') | 
| 17 | 
  | 
 | 
| 18 | 
  | 
# standard targets | 
| 19 | 
  | 
PROGS = [ | 
| 20 | 
< | 
('findglare', Split('findglare.c glareval.c glaresrc.c setscan.c'), | 
| 21 | 
< | 
        ['rtpic','rtargs','rtio','rtproc','rtmath','rtpath','rtmem','rterror']), | 
| 22 | 
< | 
('glarendx',  Split('glarendx.c'), ['rtpic','rtargs','rtio','rtmath']), | 
| 23 | 
< | 
('vwright',   Split('vwright.c'),  ['rtpic','rtargs','rtio','rtmath']), | 
| 24 | 
< | 
('vwrays',    Split('vwrays.c'),   ['rtpic','rtargs','rtio','rtmath']), | 
| 25 | 
< | 
('rad',       Split('rad.c'), | 
| 26 | 
< | 
        ['rtpic','rtproc','rtpath','rtmath','rtargs','rtio','rtcont','rtmem','rterror']), | 
| 27 | 
< | 
('rpiece',    Split('rpiece.c') + [Version], | 
| 28 | 
< | 
        ['rtpic','rtargs','rtio','rtproc','rtmath','rtpath','rtmem']), | 
| 29 | 
< | 
('ranimate',  ['ranimate.c', '$RAD_NETCOMPAT'], | 
| 30 | 
< | 
        ['rtpic','rtargs','rtio','rtproc','rtcont','rtmem','rtpath','rtmath', | 
| 31 | 
< | 
        'rtnet','rterror','$RAD_SOCKETLIB']), | 
| 32 | 
< | 
('dctimestep', Split('dctimestep.c cmbsdf.c cmatrix.c'), | 
| 33 | 
< | 
        ['rtall']) | 
| 20 | 
> | 
('findglare', Split('findglare.c glareval.c glaresrc.c setscan.c'), ['rtrad']), | 
| 21 | 
> | 
('glarendx',  Split('glarendx.c'), ['rtrad']), | 
| 22 | 
> | 
('vwright',   Split('vwright.c'),  ['rtrad']), | 
| 23 | 
> | 
('vwrays',    Split('vwrays.c'),   ['rtrad']), | 
| 24 | 
> | 
('rad',       Split('rad.c'),      ['rtrad']), | 
| 25 | 
> | 
('rpiece',    Split('rpiece.c') + [env.version], ['rtrad']), | 
| 26 | 
> | 
('ranimate',  ['ranimate.c', '$RAD_NETCOMPAT'], ['rtrad', '$RAD_SOCKETLIB']), | 
| 27 | 
> | 
('dctimestep', Split('dctimestep.c')+[cmatrix, cmbsdf], ['rtrad']), | 
| 28 | 
> | 
('rttree_reduce', Split('rttree_reduce.c'), ['rtrad']), | 
| 29 | 
> | 
('rcollate', Split('rcollate.c'), ['rtrad']), | 
| 30 | 
> | 
('eplus_adduvf', Split('eplus_adduvf.c eplus_idf.c'), ['rtrad']), | 
| 31 | 
> | 
('rfluxmtx', Split('rfluxmtx.c'), ['rtrad']), | 
| 32 | 
> | 
('rmtxop', Split('rmtxop.c rmatrix.c')+[cmatrix, cmbsdf], ['rtrad']), | 
| 33 | 
> | 
('wrapBSDF', Split('wrapBSDF.c'), ['rtrad']), | 
| 34 | 
> | 
('evalglare', Split('evalglare.c pictool.c'), ['rtrad', 'reetz']), | 
| 35 | 
  | 
] | 
| 36 | 
  | 
 | 
| 37 | 
  | 
for p in PROGS: | 
| 38 | 
  | 
        prog = env.Program(target=radbin(p[0]), source=p[1], LIBS=p[2]+mlib) | 
| 39 | 
  | 
        progs.append(prog) | 
| 40 | 
  | 
 | 
| 41 | 
< | 
#if os.name != 'nt': # XXX pending Windows version of raypcalls.c | 
| 42 | 
< | 
if True: # experimental raypwin.c | 
| 43 | 
< | 
        # targets with different includes/libs | 
| 44 | 
< | 
        rs = Split('ranimove.c ranimove1.c ranimove2.c') | 
| 45 | 
< | 
        ranimove = env.Program(target=radbin('ranimove'), source=rs, | 
| 46 | 
< | 
                        CPPPATH=env.get('CPPPATH', [])+ ['#src/rt'], | 
| 47 | 
< | 
                        LIBS=['raycalls','rttrace','rtscene','rtpic','rtfunc','rtmath', | 
| 48 | 
< | 
                        'rtnet','rtcont','rtmem','rtargs','rtio','rtproc','rtpath','rterror'] | 
| 49 | 
< | 
                        + mlib) | 
| 50 | 
< | 
        progs.append(ranimove) | 
| 46 | 
< | 
        rsensor = env.Program(target=radbin('rsensor'), source='rsensor.c', | 
| 47 | 
< | 
                        CPPPATH=env.get('CPPPATH', [])+ ['#src/rt'], | 
| 48 | 
< | 
                        LIBS=['raycalls','rttrace','rtscene','rtpic','rtfunc','rtmath', | 
| 49 | 
< | 
                        'rtcont','rtmem','rtargs','rtio','rtpath','rterror','rtproc', | 
| 50 | 
< | 
                        'rtnet','rtlamps'] + mlib) | 
| 51 | 
< | 
        progs.append(rsensor) | 
| 41 | 
> | 
# targets with different includes/libs | 
| 42 | 
> | 
rs = Split('ranimove.c ranimove1.c ranimove2.c') | 
| 43 | 
> | 
ranimove = env.Program(target=radbin('ranimove'), source=rs, | 
| 44 | 
> | 
                CPPPATH=env.get('CPPPATH', [])+ ['#src/rt'], | 
| 45 | 
> | 
                LIBS=['raycalls','rttrace','rtrad'] + mlib) | 
| 46 | 
> | 
progs.append(ranimove) | 
| 47 | 
> | 
rsensor = env.Program(target=radbin('rsensor'), source='rsensor.c', | 
| 48 | 
> | 
                CPPPATH=env.get('CPPPATH', [])+ ['#src/rt'], | 
| 49 | 
> | 
                LIBS=['raycalls','rttrace','rtrad'] + mlib) | 
| 50 | 
> | 
progs.append(rsensor) | 
| 51 | 
  | 
 | 
| 52 | 
  | 
getinfo = env.Program(target=radbin('getinfo'), source='getinfo.c', | 
| 53 | 
< | 
                LIBS=['rtio']) | 
| 53 | 
> | 
                LIBS=['rtrad']) | 
| 54 | 
  | 
progs.append(getinfo) | 
| 55 | 
  | 
 | 
| 56 | 
  | 
 | 
| 57 | 
  | 
# X11 targets | 
| 58 | 
  | 
if env.has_key('X11LIB'): | 
| 59 | 
+ | 
        addobj = env.get('ADDOBJNOTIFY') | 
| 60 | 
  | 
        xincl = env.get('CPPPATH', []) + ['$X11INCLUDE'] | 
| 61 | 
  | 
        xlibp = env.get('LIBPATH', []) + ['$X11LIB'] | 
| 62 | 
  | 
        xglaresrc = env.Program(target=radbin('xglaresrc'), | 
| 63 | 
  | 
                        source=Split('xglaresrc.c') + [env.x11findwind], # XXX remote magic | 
| 64 | 
  | 
                        LIBPATH=xlibp, CPPPATH=xincl, | 
| 65 | 
< | 
                        LIBS=['rtpic','rtmath','rtargs','rtio','X11']+ mlib) | 
| 65 | 
> | 
                        LIBS=['rtrad', 'X11']+ mlib) | 
| 66 | 
  | 
        progs.append(xglaresrc) | 
| 67 | 
  | 
 | 
| 68 | 
  | 
        # OpenGL targets that also depend on X11 | 
| 69 | 
  | 
        if env.has_key('OGL'): | 
| 70 | 
< | 
                glrad = env.Program(target=radbin('glrad'), source=Split('glrad.c'), | 
| 71 | 
< | 
                        CPPFLAGS=env.get('CPPFLAGS', []) + ['$RAD_STEREO'], | 
| 72 | 
< | 
                        LIBPATH=xlibp, CPPPATH=xincl, | 
| 73 | 
< | 
                        LIBS=['rgl','rtpic','rtscene','rtproc','rtpath','rtargs','rtio', | 
| 74 | 
< | 
                        'rtmath','rtcont','rtmem','rterror','rtdummy', | 
| 75 | 
< | 
                        'GL', 'GLU','X11'] + mlib,) | 
| 70 | 
> | 
                glrad = env.Program(target=radbin('glrad'), | 
| 71 | 
> | 
                                source=['glrad.c', addobj], | 
| 72 | 
> | 
                                CPPFLAGS=env.get('CPPFLAGS', []) + ['$RAD_STEREO'], | 
| 73 | 
> | 
                                LIBPATH=xlibp, CPPPATH=xincl, | 
| 74 | 
> | 
                                LIBS=['rgl','rtrad','GL', 'GLU','X11'] + mlib,) | 
| 75 | 
  | 
                progs.append(glrad) | 
| 76 | 
  | 
 | 
| 77 | 
< | 
if os.name == 'posix': # XXX ignoring trad.wsh | 
| 78 | 
< | 
        for s in Split('''objview objline objpict glare dayfact | 
| 79 | 
< | 
                        debugcal rlux raddepend compamb vinfo genambpos fieldcomb'''): | 
| 77 | 
> | 
pyscripts = Split('''rlux''') | 
| 78 | 
> | 
if os.name == 'posix': | 
| 79 | 
> | 
        for s in Split('''objline glare dayfact | 
| 80 | 
> | 
                        debugcal raddepend compamb vinfo fieldcomb'''): | 
| 81 | 
  | 
                Default(env.InstallScript(radbin(s), s + '.csh')) | 
| 82 | 
< | 
# Those don't really work yet | 
| 83 | 
< | 
#else: | 
| 84 | 
< | 
#       for s in Split('''objview glare rlux '''): | 
| 85 | 
< | 
#               prog = env.Program(target=radbin(s), source=s+'.c') | 
| 86 | 
< | 
#               progs.append(prog) | 
| 82 | 
> | 
        for s in Split('''objview objpict | 
| 83 | 
> | 
                        genambpos genklemsamp genskyvec genBSDF bsdfview ltview ltpict'''): | 
| 84 | 
> | 
                Default(env.InstallScript(radbin(s), s + '.pl')) | 
| 85 | 
> | 
        for s in Split('''do_action.tcl do_file.tcl do_options.tcl do_results.tcl | 
| 86 | 
> | 
                do_scene.tcl do_views.tcl do_zone.tcl file.hlp getfile.tcl gethelp.tcl | 
| 87 | 
> | 
                help.hlp tclIndex trad.hlp trad.icon util.tcl'''): | 
| 88 | 
> | 
                Default(env.InstallScript(tclscr(s), s)) | 
| 89 | 
> | 
        Default(env.InstallTCLScript(radbin('trad'), 'trad.wsh')) | 
| 90 | 
> | 
        for s in pyscripts: | 
| 91 | 
> | 
                Default(env.InstallScript(radbin(s), s + '.py')) | 
| 92 | 
> | 
else: | 
| 93 | 
> | 
        for s in pyscripts: | 
| 94 | 
> | 
                Default(env.InstallScript(radbin(s + '.py'), s + '.py')) | 
| 95 | 
> | 
         | 
| 96 | 
  | 
 | 
| 97 | 
  | 
Default('#src/util') | 
| 98 | 
  | 
env.Install('$RAD_BINDIR', progs) | 
| 99 | 
  | 
 | 
| 100 | 
+ | 
# vim: set syntax=python: | 
| 101 | 
+ | 
# vi: set ts=4 sw=4 : |