1 |
|
2 |
# Notes to people who come after: |
3 |
# |
4 |
# In general, only use '/' as a path separator in *nix-specific code, use |
5 |
# os.path.join() for everythign else |
6 |
|
7 |
import os |
8 |
import sys |
9 |
import string |
10 |
|
11 |
OPTFILE = 'rayopts.py' |
12 |
|
13 |
def set_opts(env): |
14 |
# XXX add some caching |
15 |
opts = Options(OPTFILE, ARGUMENTS) |
16 |
opts.Add('SKIP', 'Skip Display of License terms', 0) |
17 |
opts.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR']) |
18 |
opts.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) |
19 |
opts.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR']) |
20 |
opts.Update(env) |
21 |
opts.Save(OPTFILE, env) |
22 |
Help(opts.GenerateHelpText(env, sort=cmp)) |
23 |
# where stuff is located in the source tree |
24 |
env['RAD_BUILDLIB'] = '#src/lib' |
25 |
env['RAD_BUILDBIN'] = '#bin' |
26 |
env['RAD_BUILDRLIB'] = '#lib' |
27 |
env['RAD_BUILDMAN'] = '#doc/man' |
28 |
|
29 |
def allplats_setup(env): |
30 |
from build_utils import find_libs |
31 |
find_libs.find_x11(env) |
32 |
find_libs.find_gl(env) # OpenGL |
33 |
#find_libs.find_pixar(env) # PIXAR_LIB for src/px/ra_pixar.c |
34 |
|
35 |
def post_common_setup(env): |
36 |
env.Append(CPPPATH = [os.path.join('#src', 'common')]) |
37 |
env.Append(LIBPATH=['../lib']) # our own libs |
38 |
if not env.has_key('RAD_MLIB'): |
39 |
env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win |
40 |
|
41 |
def shareinstall_setup(env): |
42 |
from build_utils import install |
43 |
# only scan for those files when we actually need them |
44 |
if 'install' in sys.argv or 'rlibinstall' in sys.argv: |
45 |
install.install_rlibfiles(env) |
46 |
if 'install' in sys.argv or 'maninstall' in sys.argv: |
47 |
install.install_manfiles(env) |
48 |
|
49 |
# Set up build environment |
50 |
env = Environment() |
51 |
|
52 |
# configure platform-specific stuff |
53 |
from build_utils import load_plat |
54 |
load_plat.load_plat(env, platform=None) |
55 |
|
56 |
# override options |
57 |
set_opts(env) |
58 |
|
59 |
# accept license |
60 |
if not env['SKIP'] and not '-c' in sys.argv: |
61 |
from build_utils import copyright |
62 |
copyright.show_license() |
63 |
|
64 |
# fill in generic config |
65 |
allplats_setup(env) |
66 |
|
67 |
# Bring in all the actual things to build |
68 |
Export('env') |
69 |
SConscript(os.path.join('src', 'common', 'SConscript')) |
70 |
post_common_setup(env) |
71 |
for d in Split('meta cv gen ot rt px hd util cal'): |
72 |
SConscript(os.path.join('src', d, 'SConscript')) |
73 |
|
74 |
if string.find(string.join(sys.argv[1:]), 'install') > -1: |
75 |
shareinstall_setup(env) |
76 |
|
77 |
# virtual targets |
78 |
# RAD_XXXINSTALL are filled in by the local scripts |
79 |
env.Alias('bininstall', env.get('RAD_BININSTALL', [])) |
80 |
env.Alias('rlibinstall', env.get('RAD_RLIBINSTALL',[])) |
81 |
env.Alias('maninstall', env.get('RAD_MANINSTALL', [])) |
82 |
|
83 |
env.Alias('build', ['#bin']) |
84 |
env.Alias('test', ['#src/test']) |
85 |
env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall']) |
86 |
|
87 |
# Further virtual targets are defined locally: |
88 |
|
89 |
# meta_special -> mt1601 okimate imagew mt160 mx80 impress aed5 |
90 |
# tcurve tscat tbar mtext libt4014.a plotout t4014 |
91 |
# meta_special_install |
92 |
|
93 |
# px_special -> ra_im, t4027, paintjet, mt160t, greyscale, colorscale, d48c |
94 |
# px_special_install |
95 |
|
96 |
# util_special -> scanner, makedist |
97 |
# util_special_install |
98 |
|