ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/SConstruct
Revision: 1.13
Committed: Sat Mar 5 13:24:58 2016 UTC (8 years, 7 months ago) by schorsch
Branch: MAIN
Changes since 1.12: +5 -3 lines
Log Message:
SCons build now fully functional again on linux (SCons 2.3.0, Python 2.7)

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