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 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

# User Rev Content
1 schorsch 1.1
2     import os
3     import sys
4     import string
5    
6 schorsch 1.17 PATHFILE = 'raypaths.py'
7 schorsch 1.1 OPTFILE = 'rayopts.py'
8 schorsch 1.17 def set_pre_opts(env):
9 schorsch 1.14 vars = Variables(OPTFILE, ARGUMENTS)
10     vars.Add('SKIP', 'Skip Display of License terms', 0)
11 schorsch 1.17 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 schorsch 1.14 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 schorsch 1.17 vars.Save(PATHFILE, env)
22 schorsch 1.14 Help(vars.GenerateHelpText(env, sort=cmp))
23 schorsch 1.1 # where stuff is located in the source tree
24 schorsch 1.16 # the binary target libs are configured by platform
25 schorsch 1.8 env['RAD_BUILDRLIB'] = '#lib'
26     env['RAD_BUILDMAN'] = '#doc/man'
27 schorsch 1.1
28     def allplats_setup(env):
29 schorsch 1.8 from build_utils import find_libs
30 schorsch 1.9 find_libs.find_radlib(env)
31 schorsch 1.8 find_libs.find_x11(env)
32     find_libs.find_gl(env) # OpenGL
33     find_libs.find_libtiff(env)
34 schorsch 1.1
35     def post_common_setup(env):
36 schorsch 1.8 env.Append(CPPPATH = [os.path.join('#src', 'common')])
37 schorsch 1.16 env.Append(LIBPATH=[env['RAD_BUILDLIB']]) # our own libs
38 schorsch 1.8 if not env.has_key('RAD_MLIB'):
39     env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win
40 schorsch 1.1
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 schorsch 1.16 _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 schorsch 1.1 # Set up build environment
57 schorsch 1.16 env = Environment(TARGET_ARCH=_arch)
58 schorsch 1.7 env.Decider('timestamp-match')
59 schorsch 1.1
60 schorsch 1.18 from build_utils import install
61     script_b = Builder(action = install.install_script, suffix = '')
62     env.Append(BUILDERS={'InstallScript': script_b})
63 schorsch 1.4 if os.name == 'posix':
64 schorsch 1.13 tclscript_b = Builder(action = install.install_tclscript, suffix = '')
65     env.Append(BUILDERS={'InstallTCLScript': tclscript_b})
66 schorsch 1.4
67 schorsch 1.17 # set debug before loading platforms
68     set_pre_opts(env)
69    
70 schorsch 1.1 # configure platform-specific stuff
71     from build_utils import load_plat
72 schorsch 1.17 load_plat.load_plat(env, vars, arch=_arch)
73 schorsch 1.1
74     # override options
75     set_opts(env)
76    
77     # accept license
78 schorsch 1.8 if ((not env['SKIP']
79 schorsch 1.17 or env['SKIP'].strip().lower() in (0,'0','n','no','false',None))
80 schorsch 1.8 and not '-c' in sys.argv and not 'test' in sys.argv):
81     from build_utils import copyright
82     copyright.show_license()
83 schorsch 1.1
84     # fill in generic config
85     allplats_setup(env)
86    
87     # Bring in all the actual things to build
88     Export('env')
89 schorsch 1.8 if 'test' in sys.argv:
90     SConscript(os.path.join('test', 'SConscript'))
91    
92     else:
93 schorsch 1.16 SConscript(os.path.join('src', 'common', 'SConscript'),
94     variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0)
95 schorsch 1.8 post_common_setup(env)
96 schorsch 1.18 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 schorsch 1.16 SConscript(os.path.join('src', d, 'SConscript'),
104     variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0)
105 schorsch 1.1
106 schorsch 1.8 if string.find(string.join(sys.argv[1:]), 'install') > -1:
107     shareinstall_setup(env)
108 schorsch 1.1
109 schorsch 1.6 Default('.')
110    
111 schorsch 1.1 # virtual targets
112 schorsch 1.4 env.Alias('bininstall', '$RAD_BINDIR')
113     env.Alias('rlibinstall', '$RAD_RLIBDIR')
114     env.Alias('maninstall', '$RAD_MANDIR')
115 schorsch 1.1
116 schorsch 1.18 env.Alias('build', ['$RAD_BUILDBIN', '$RAD_BUILDRLIB'])
117 schorsch 1.8 env.Alias('test', ['#test'])
118 schorsch 1.1 env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall'])
119    
120 schorsch 1.13 # vim: set syntax=python: