| 1 | from __future__ import division, print_function, unicode_literals | 
| 2 |  | 
| 3 | import os | 
| 4 |  | 
| 5 | Import('env') # inherit from parent | 
| 6 |  | 
| 7 | mlib = ['$RAD_MLIB'] | 
| 8 | progs = [] | 
| 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 | def tclscr(name): return os.path.join('$RAD_BUILDRLIB', 'tcl', name) | 
| 14 |  | 
| 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'), ['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 | # 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=['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=['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'), | 
| 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 | 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 | 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 : |