ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/SConstruct
(Generate patch)

Comparing ray/SConstruct (file contents):
Revision 1.7 by schorsch, Tue Dec 23 15:03:58 2008 UTC vs.
Revision 1.17 by schorsch, Thu Mar 10 17:36:18 2016 UTC

# Line 3 | Line 3 | 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 <    # XXX add some caching
17 <    opts = Options(OPTFILE, ARGUMENTS)
18 <    opts.Add('SKIP', 'Skip Display of License terms', 0)
19 <    opts.Add('RAD_BINDIR',  'Install executables here',   env['RAD_BINDIR'])
20 <    opts.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR'])
21 <    opts.Add('RAD_MANDIR',  'Install man pages here',     env['RAD_MANDIR'])
22 <    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))
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 <    env['RAD_BUILDLIB']  = '#src/lib'
25 <    env['RAD_BUILDBIN']  = '#bin'
26 <    env['RAD_BUILDRLIB'] = '#lib'
22 <    env['RAD_BUILDMAN']  = '#doc/man'
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_x11(env)
31 <    find_libs.find_gl(env) # OpenGL
32 <    find_libs.find_libtiff(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=['../lib']) # our own libs
38 <    if not env.has_key('RAD_MLIB'):
39 <        env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win
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
# Line 41 | Line 46 | def shareinstall_setup(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()
57 > env = Environment(TARGET_ARCH=_arch)
58   env.Decider('timestamp-match')
59  
60   if os.name == 'posix':
61          from build_utils import install
62 <        csh_b = Builder(action = install.install_cshscript,
63 <                        suffix = '', src_suffix = '.csh')
64 <        env.Append(BUILDERS={'InstallCsh': csh_b})
62 >        script_b = Builder(action = install.install_script, suffix = '')
63 >        env.Append(BUILDERS={'InstallScript': script_b})
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, ARGUMENTS, platform=None)
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'] and not '-c' in sys.argv:
79 <    from build_utils import copyright
80 <    copyright.show_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  
69                
70
87   # Bring in all the actual things to build
88   Export('env')
89 < SConscript(os.path.join('src', 'common', 'SConscript'))
90 < post_common_setup(env)
91 < for d in Split('meta cv gen ot rt px hd util cal'):
92 <    print d
93 <    SConscript(os.path.join('src', d, 'SConscript'))
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 >        for d in Split('meta cv gen ot rt px hd util cal'):
97 >                print d
98 >                SConscript(os.path.join('src', d, 'SConscript'),
99 >                                variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0)
100  
101 < if string.find(string.join(sys.argv[1:]), 'install') > -1:
102 <        shareinstall_setup(env)
101 >        if string.find(string.join(sys.argv[1:]), 'install') > -1:
102 >                shareinstall_setup(env)
103  
104   Default('.')
105  
# Line 86 | Line 108 | env.Alias('bininstall',  '$RAD_BINDIR')
108   env.Alias('rlibinstall', '$RAD_RLIBDIR')
109   env.Alias('maninstall',  '$RAD_MANDIR')
110  
111 < env.Alias('build',   ['#bin'])
112 < env.Alias('test',    ['#src/test'])
111 > env.Alias('build',   ['$RAD_BUILDBIN'])
112 > env.Alias('test',    ['#test'])
113   env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall'])
114  
115 + # vim: set syntax=python:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines