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.3 by schorsch, Sun Jul 4 12:08:47 2004 UTC vs.
Revision 1.20 by schorsch, Mon Jan 8 13:38:37 2018 UTC

# Line 1 | Line 1
1 + from __future__ import division, print_function, unicode_literals
2  
3   import os
4   import sys
4 import string
5  
6 < OPTFILE = 'rayopts.py'
6 > def set_pre_opts(testenv):
7 >        optfile = File(testenv['CFG_OPTFILE']).abspath
8 >        vars = Variables(optfile, ARGUMENTS)
9 >        vars.Add('SKIP', 'Skip Display of License terms', 0)
10 >        vars.Add('RAD_DEBUG',  'Build a debug version',  0)
11 >        if testenv['CFG_PLATSYS'] == 'Windows':
12 >                # no default, will select the most recent one when empty
13 >                vars.Add('MSVC_VERSION', 'Microsoft VC Version',  )
14 >        vars.Update(testenv)
15 >        return vars
16  
17 < def set_opts(env):
18 <    # XXX add some caching
19 <    opts = Options(OPTFILE, ARGUMENTS)
20 <    opts.Add('SKIP', 'Skip Display of License terms', 0)
21 <    opts.Add('RAD_BINDIR',  'Install executables here',   env['RAD_BINDIR'])
22 <    opts.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR'])
23 <    opts.Add('RAD_MANDIR',  'Install man pages here',     env['RAD_MANDIR'])
24 <    opts.Add('RAD_DEBUG',   'Build a debug version',  0)
25 <    opts.Update(env)
17 <    opts.Save(OPTFILE, env)
18 <    Help(opts.GenerateHelpText(env, sort=cmp))
17 > def set_opts(env, pathfile):
18 >        vars = Variables(pathfile, ARGUMENTS)
19 >        vars.Add('RAD_BASEDIR', 'Installation base directory', env['RAD_BASEDIR'])
20 >        vars.Add('RAD_BINDIR',  'Install executables here',   env['RAD_BINDIR'])
21 >        vars.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR'])
22 >        vars.Add('RAD_MANDIR',  'Install man pages here',     env['RAD_MANDIR'])
23 >        vars.Update(env)
24 >        vars.Save(pathfile, env)
25 >        Help(vars.GenerateHelpText(env))
26          # where stuff is located in the source tree
27 <    env['RAD_BUILDLIB']  = '#src/lib'
28 <    env['RAD_BUILDBIN']  = '#bin'
29 <    env['RAD_BUILDRLIB'] = '#lib'
23 <    env['RAD_BUILDMAN']  = '#doc/man'
27 >        # the binary target libs are configured by platform
28 >        env['RAD_BUILDRLIB'] = '#lib'
29 >        env['RAD_BUILDMAN']  = '#doc/man'
30  
31   def allplats_setup(env):
32 <    from build_utils import find_libs
33 <    find_libs.find_x11(env)
34 <    find_libs.find_gl(env) # OpenGL
35 <    #find_libs.find_pixar(env) # PIXAR_LIB for src/px/ra_pixar.c
32 >        from build_utils import find_libs
33 >        find_libs.find_radlib(env)
34 >        find_libs.find_x11(env)
35 >        find_libs.find_gl(env) # OpenGL
36 >        find_libs.find_libtiff(env)
37 >        find_libs.find_pyinstaller(env)
38  
39   def post_common_setup(env):
40 <    env.Append(CPPPATH = [os.path.join('#src', 'common')])
41 <    env.Append(LIBPATH=['../lib']) # our own libs
42 <    if not env.has_key('RAD_MLIB'):
43 <        env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win
40 >        env.Append(CPPPATH = [os.path.join('#src', 'common')])
41 >        env.Append(LIBPATH=[env['RAD_BUILDLIB']]) # our own libs
42 >        if not env.has_key('RAD_MLIB'):
43 >                env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win
44  
45   def shareinstall_setup(env):
46          from build_utils import install
# Line 42 | Line 50 | def shareinstall_setup(env):
50          if 'install' in sys.argv or 'maninstall' in sys.argv:
51                  install.install_manfiles(env)
52  
53 + # first figure out the platform
54 + from build_utils import load_plat
55 + testenv = Environment()
56 + load_plat.identify_plat(testenv)
57 +
58 + # set stuff before loading platforms
59 + prevars = set_pre_opts(testenv)
60 +
61   # Set up build environment
62 < env = Environment()
62 > env = Environment(variables=prevars)
63 > env.Decider('timestamp-match')
64  
65 + from build_utils import install
66 + script_b = Builder(action = install.install_script, suffix = '')
67 + env.Append(BUILDERS={'InstallScript': script_b})
68 + if os.name == 'posix':
69 +        tclscript_b = Builder(action = install.install_tclscript, suffix = '')
70 +        env.Append(BUILDERS={'InstallTCLScript': tclscript_b})
71 +
72   # configure platform-specific stuff
73 < from build_utils import load_plat
50 < load_plat.load_plat(env, ARGUMENTS, platform=None)
73 > load_plat.load_plat(env, testenv)
74  
75   # override options
76 < set_opts(env)
76 > cfg_pathfile = File(testenv['CFG_PATHFILE']).abspath
77 > set_opts(env, cfg_pathfile)
78  
79 + load_plat.combine_instpaths(env)
80 +
81   # accept license
82 < if not env['SKIP'] and not '-c' in sys.argv:
83 <    from build_utils import copyright
84 <    copyright.show_license()
82 > if ((not env['SKIP']
83 >                        or env['SKIP'].strip().lower() in (0,'0','n','no','false',None))
84 >                and not '-c' in sys.argv and not 'test' in sys.argv):
85 >        from build_utils import copyright
86 >        copyright.show_license()
87 >        testenv['SKIP'] = '1'
88  
89 + # We waited to save this, so that we can add the SKIP
90 + prevars.Save(File(testenv['CFG_OPTFILE']).abspath, testenv)
91 +
92   # fill in generic config
93   allplats_setup(env)
94  
95 + print('Installation directories:')
96 + print('Base:     ', env.subst('$RAD_BASEDIR'))
97 + print('Binaries: ', env.subst('$RAD_BINDIR'))
98 + print('Library:  ', env.subst('$RAD_RLIBDIR'))
99 + print('Manpages: ', env.subst('$RAD_MANDIR'))
100 + print()
101 +
102   # Bring in all the actual things to build
103   Export('env')
104 < SConscript(os.path.join('src', 'common', 'SConscript'))
105 < post_common_setup(env)
106 < for d in Split('meta cv gen ot rt px hd util cal'):
107 <    print d
108 <    SConscript(os.path.join('src', d, 'SConscript'))
104 > if 'test' in sys.argv:
105 >        SConscript(os.path.join('test', 'SConscript'))
106 >        
107 > else:
108 >        SConscript(os.path.join('src', 'common', 'SConscript'),
109 >                        variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0)
110 >        post_common_setup(env)
111 >        dirs = Split('''meta cv gen ot rt px hd util cal''')
112 >        if os.path.isfile('src/winimage/SConscript'):
113 >                dirs.append('winimage')
114 >        if os.path.isfile('src/winrview/SConscript'):
115 >                dirs.append('winrview')
116 >        for d in dirs:
117 >                print(d)
118 >                SConscript(os.path.join('src', d, 'SConscript'),
119 >                                variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0)
120  
121 < if string.find(string.join(sys.argv[1:]), 'install') > -1:
122 <        shareinstall_setup(env)
121 >        if ' '.join(sys.argv[1:]).find('install') > -1:
122 >                shareinstall_setup(env)
123  
124 + Default('.')
125 +
126   # virtual targets
127 < # RAD_XXXINSTALL are filled in by the local scripts
128 < env.Alias('bininstall',  env.get('RAD_BININSTALL', []))
129 < env.Alias('rlibinstall', env.get('RAD_RLIBINSTALL',[]))
78 < env.Alias('maninstall',  env.get('RAD_MANINSTALL', []))
127 > env.Alias('bininstall',  '$RAD_BINDIR')
128 > env.Alias('rlibinstall', '$RAD_RLIBDIR')
129 > env.Alias('maninstall',  '$RAD_MANDIR')
130  
131 < env.Alias('build',   ['#bin'])
132 < env.Alias('test',    ['#src/test'])
131 > env.Alias('build',   ['$RAD_BUILDBIN']) #, '$RAD_BUILDRLIB'])
132 > env.Alias('test',    ['#test'])
133   env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall'])
134  
135 < # Further virtual targets are defined locally:
85 < # meta_special: mt1601 okimate imagew mt160 mx80 impress aed5
86 < #               tcurve tscat tbar mtext libt4014.a plotout t4014
87 < # px_special:   ra_im, t4027, paintjet, mt160t, greyscale, colorscale, d48c
88 < # util_special: scanner, makedist (not for Windows yet)
89 < env.Alias('special', ['meta_special', 'px_special', 'util_special'])
90 < env.Alias('special_install', ['meta_special_install',
91 <                'px_special_install', 'util_special_install'])
92 <
135 > # vi: set ts=4 sw=4 :

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines