ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/SConstruct
Revision: 1.16
Committed: Thu Mar 10 01:49:56 2016 UTC (8 years, 1 month ago) by schorsch
Branch: MAIN
Changes since 1.15: +16 -8 lines
Log Message:
SCons build system learns about platform architecture

File Contents

# User Rev Content
1 schorsch 1.1
2     import os
3     import sys
4     import string
5    
6     OPTFILE = 'rayopts.py'
7     def set_opts(env):
8 schorsch 1.8 # XXX add some caching
9 schorsch 1.14 vars = Variables(OPTFILE, ARGUMENTS)
10     vars.Add('SKIP', 'Skip Display of License terms', 0)
11     vars.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR'])
12     vars.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR'])
13     vars.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR'])
14     vars.Add('RAD_DEBUG', 'Build a debug version', 0)
15     vars.Update(env)
16     vars.Save(OPTFILE, env)
17     Help(vars.GenerateHelpText(env, sort=cmp))
18 schorsch 1.1 # where stuff is located in the source tree
19 schorsch 1.16 # the binary target libs are configured by platform
20 schorsch 1.8 env['RAD_BUILDRLIB'] = '#lib'
21     env['RAD_BUILDMAN'] = '#doc/man'
22 schorsch 1.1
23     def allplats_setup(env):
24 schorsch 1.8 from build_utils import find_libs
25 schorsch 1.9 find_libs.find_radlib(env)
26 schorsch 1.8 find_libs.find_x11(env)
27     find_libs.find_gl(env) # OpenGL
28     find_libs.find_libtiff(env)
29 schorsch 1.1
30     def post_common_setup(env):
31 schorsch 1.8 env.Append(CPPPATH = [os.path.join('#src', 'common')])
32 schorsch 1.16 env.Append(LIBPATH=[env['RAD_BUILDLIB']]) # our own libs
33 schorsch 1.8 if not env.has_key('RAD_MLIB'):
34     env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win
35 schorsch 1.1
36     def shareinstall_setup(env):
37     from build_utils import install
38     # only scan for those files when we actually need them
39     if 'install' in sys.argv or 'rlibinstall' in sys.argv:
40     install.install_rlibfiles(env)
41     if 'install' in sys.argv or 'maninstall' in sys.argv:
42     install.install_manfiles(env)
43    
44 schorsch 1.16 _arch = None
45     for item in sys.argv[1:]:
46     if item.startswith('TARGET_ARCH'):
47     res = item.split('=')
48     if len(res) == 2:
49     _arch = res[1].strip()
50    
51 schorsch 1.1 # Set up build environment
52 schorsch 1.16 env = Environment(TARGET_ARCH=_arch)
53 schorsch 1.7 env.Decider('timestamp-match')
54 schorsch 1.1
55 schorsch 1.4 if os.name == 'posix':
56     from build_utils import install
57 schorsch 1.13 script_b = Builder(action = install.install_script, suffix = '')
58     env.Append(BUILDERS={'InstallScript': script_b})
59     tclscript_b = Builder(action = install.install_tclscript, suffix = '')
60     env.Append(BUILDERS={'InstallTCLScript': tclscript_b})
61 schorsch 1.4
62 schorsch 1.1 # configure platform-specific stuff
63     from build_utils import load_plat
64 schorsch 1.16 load_plat.load_plat(env, ARGUMENTS, arch=_arch)
65 schorsch 1.1
66     # override options
67     set_opts(env)
68    
69     # accept license
70 schorsch 1.8 if ((not env['SKIP']
71     or env['SKIP'].strip().lower() in (0,'0','no','false'))
72     and not '-c' in sys.argv and not 'test' in sys.argv):
73     from build_utils import copyright
74     copyright.show_license()
75 schorsch 1.1
76     # fill in generic config
77     allplats_setup(env)
78    
79     # Bring in all the actual things to build
80     Export('env')
81 schorsch 1.8 if 'test' in sys.argv:
82     SConscript(os.path.join('test', 'SConscript'))
83    
84     else:
85 schorsch 1.16 SConscript(os.path.join('src', 'common', 'SConscript'),
86     variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0)
87 schorsch 1.8 post_common_setup(env)
88     for d in Split('meta cv gen ot rt px hd util cal'):
89     print d
90 schorsch 1.16 SConscript(os.path.join('src', d, 'SConscript'),
91     variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0)
92 schorsch 1.1
93 schorsch 1.8 if string.find(string.join(sys.argv[1:]), 'install') > -1:
94     shareinstall_setup(env)
95 schorsch 1.1
96 schorsch 1.6 Default('.')
97    
98 schorsch 1.1 # virtual targets
99 schorsch 1.4 env.Alias('bininstall', '$RAD_BINDIR')
100     env.Alias('rlibinstall', '$RAD_RLIBDIR')
101     env.Alias('maninstall', '$RAD_MANDIR')
102 schorsch 1.1
103 schorsch 1.16 env.Alias('build', ['$RAD_BUILDBIN'])
104 schorsch 1.8 env.Alias('test', ['#test'])
105 schorsch 1.1 env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall'])
106    
107 schorsch 1.13 # vim: set syntax=python: