ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/SConstruct
Revision: 1.18
Committed: Mon Mar 28 17:48:43 2016 UTC (8 years, 6 months ago) by schorsch
Branch: MAIN
Changes since 1.17: +11 -6 lines
Log Message:
Refactoring of test suite, use independently of SCons and with Py2.7 or 3.x.

File Contents

# Content
1
2 import os
3 import sys
4 import string
5
6 PATHFILE = 'raypaths.py'
7 OPTFILE = 'rayopts.py'
8 def set_pre_opts(env):
9 vars = Variables(OPTFILE, ARGUMENTS)
10 vars.Add('SKIP', 'Skip Display of License terms', 0)
11 vars.Add('RAD_DEBUG', 'Build a debug version', 0)
12 vars.Update(env)
13 vars.Save(OPTFILE, env)
14
15 def set_opts(env):
16 vars = Variables(PATHFILE, ARGUMENTS)
17 vars.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR'])
18 vars.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR'])
19 vars.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR'])
20 vars.Update(env)
21 vars.Save(PATHFILE, env)
22 Help(vars.GenerateHelpText(env, sort=cmp))
23 # where stuff is located in the source tree
24 # the binary target libs are configured by platform
25 env['RAD_BUILDRLIB'] = '#lib'
26 env['RAD_BUILDMAN'] = '#doc/man'
27
28 def allplats_setup(env):
29 from build_utils import find_libs
30 find_libs.find_radlib(env)
31 find_libs.find_x11(env)
32 find_libs.find_gl(env) # OpenGL
33 find_libs.find_libtiff(env)
34
35 def post_common_setup(env):
36 env.Append(CPPPATH = [os.path.join('#src', 'common')])
37 env.Append(LIBPATH=[env['RAD_BUILDLIB']]) # 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 _arch = None
50 for item in sys.argv[1:]:
51 if item.startswith('TARGET_ARCH'):
52 res = item.split('=')
53 if len(res) == 2:
54 _arch = res[1].strip()
55
56 # Set up build environment
57 env = Environment(TARGET_ARCH=_arch)
58 env.Decider('timestamp-match')
59
60 from build_utils import install
61 script_b = Builder(action = install.install_script, suffix = '')
62 env.Append(BUILDERS={'InstallScript': script_b})
63 if os.name == 'posix':
64 tclscript_b = Builder(action = install.install_tclscript, suffix = '')
65 env.Append(BUILDERS={'InstallTCLScript': tclscript_b})
66
67 # set debug before loading platforms
68 set_pre_opts(env)
69
70 # configure platform-specific stuff
71 from build_utils import load_plat
72 load_plat.load_plat(env, vars, arch=_arch)
73
74 # override options
75 set_opts(env)
76
77 # accept license
78 if ((not env['SKIP']
79 or env['SKIP'].strip().lower() in (0,'0','n','no','false',None))
80 and not '-c' in sys.argv and not 'test' in sys.argv):
81 from build_utils import copyright
82 copyright.show_license()
83
84 # fill in generic config
85 allplats_setup(env)
86
87 # Bring in all the actual things to build
88 Export('env')
89 if 'test' in sys.argv:
90 SConscript(os.path.join('test', 'SConscript'))
91
92 else:
93 SConscript(os.path.join('src', 'common', 'SConscript'),
94 variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0)
95 post_common_setup(env)
96 dirs = Split('''meta cv gen ot rt px hd util cal''')
97 if os.path.isfile('src/winimage/SConscript'):
98 dirs.append('winimage')
99 if os.path.isfile('src/winrview/SConscript'):
100 dirs.append('winrview')
101 for d in dirs:
102 print(d)
103 SConscript(os.path.join('src', d, 'SConscript'),
104 variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0)
105
106 if string.find(string.join(sys.argv[1:]), 'install') > -1:
107 shareinstall_setup(env)
108
109 Default('.')
110
111 # virtual targets
112 env.Alias('bininstall', '$RAD_BINDIR')
113 env.Alias('rlibinstall', '$RAD_RLIBDIR')
114 env.Alias('maninstall', '$RAD_MANDIR')
115
116 env.Alias('build', ['$RAD_BUILDBIN', '$RAD_BUILDRLIB'])
117 env.Alias('test', ['#test'])
118 env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall'])
119
120 # vim: set syntax=python: