| 1 |
+ |
from __future__ import division, print_function, unicode_literals |
| 2 |
|
|
| 3 |
|
import os |
| 4 |
|
import sys |
| 4 |
– |
import string |
| 5 |
|
|
| 6 |
< |
OPTFILE = 'rayopts.py' |
| 7 |
< |
def set_opts(env): |
| 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)) |
| 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 |
> |
else: # not yet supported on Windows |
| 15 |
> |
vars.Add('PMAP_OOC', 'Build Pmap with Out-of-core Data', 1) |
| 16 |
> |
vars.Update(testenv) |
| 17 |
> |
return vars |
| 18 |
> |
|
| 19 |
> |
def set_opts(env, pathfile): |
| 20 |
> |
vars = Variables(pathfile, ARGUMENTS) |
| 21 |
> |
vars.Add('RAD_BASEDIR', 'Installation base directory', env['RAD_BASEDIR']) |
| 22 |
> |
vars.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR']) |
| 23 |
> |
vars.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) |
| 24 |
> |
vars.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR']) |
| 25 |
> |
vars.Update(env) |
| 26 |
> |
vars.Save(pathfile, env) |
| 27 |
> |
Help(vars.GenerateHelpText(env)) |
| 28 |
|
# where stuff is located in the source tree |
| 29 |
< |
env['RAD_BUILDLIB'] = '#src/lib' |
| 20 |
< |
env['RAD_BUILDBIN'] = '#bin' |
| 29 |
> |
# the binary target libs are configured by platform |
| 30 |
|
env['RAD_BUILDRLIB'] = '#lib' |
| 31 |
|
env['RAD_BUILDMAN'] = '#doc/man' |
| 32 |
|
|
| 36 |
|
find_libs.find_x11(env) |
| 37 |
|
find_libs.find_gl(env) # OpenGL |
| 38 |
|
find_libs.find_libtiff(env) |
| 39 |
+ |
find_libs.find_pyinstaller(env) |
| 40 |
|
|
| 41 |
|
def post_common_setup(env): |
| 42 |
|
env.Append(CPPPATH = [os.path.join('#src', 'common')]) |
| 43 |
< |
env.Append(LIBPATH=['../lib']) # our own libs |
| 43 |
> |
env.Append(LIBPATH=[env['RAD_BUILDLIB']]) # our own libs |
| 44 |
|
if not env.has_key('RAD_MLIB'): |
| 45 |
|
env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win |
| 46 |
|
|
| 52 |
|
if 'install' in sys.argv or 'maninstall' in sys.argv: |
| 53 |
|
install.install_manfiles(env) |
| 54 |
|
|
| 55 |
+ |
# first figure out the platform |
| 56 |
+ |
from build_utils import load_plat |
| 57 |
+ |
testenv = Environment() |
| 58 |
+ |
load_plat.identify_plat(testenv) |
| 59 |
+ |
|
| 60 |
+ |
# set stuff before loading platforms |
| 61 |
+ |
prevars = set_pre_opts(testenv) |
| 62 |
+ |
|
| 63 |
|
# Set up build environment |
| 64 |
< |
env = Environment() |
| 64 |
> |
env = Environment(variables=prevars) |
| 65 |
|
env.Decider('timestamp-match') |
| 66 |
|
|
| 67 |
+ |
if env.get('PMAP_OOC', 0) in (0,'0','','n','no','false',False,None): |
| 68 |
+ |
print('Building Photon-Maps with In-core KD-Tree') |
| 69 |
+ |
else: |
| 70 |
+ |
print('Building Photon-Maps with Out-of-core Octree') |
| 71 |
+ |
|
| 72 |
+ |
from build_utils import install |
| 73 |
+ |
script_b = Builder(action = install.install_script, suffix = '') |
| 74 |
+ |
env.Append(BUILDERS={'InstallScript': script_b}) |
| 75 |
|
if os.name == 'posix': |
| 76 |
< |
from build_utils import install |
| 77 |
< |
csh_b = Builder(action = install.install_cshscript, |
| 52 |
< |
suffix = '', src_suffix = '.csh') |
| 53 |
< |
env.Append(BUILDERS={'InstallCsh': csh_b}) |
| 76 |
> |
tclscript_b = Builder(action = install.install_tclscript, suffix = '') |
| 77 |
> |
env.Append(BUILDERS={'InstallTCLScript': tclscript_b}) |
| 78 |
|
|
| 79 |
|
# configure platform-specific stuff |
| 80 |
< |
from build_utils import load_plat |
| 57 |
< |
load_plat.load_plat(env, ARGUMENTS, platform=None) |
| 80 |
> |
load_plat.load_plat(env, testenv) |
| 81 |
|
|
| 82 |
|
# override options |
| 83 |
< |
set_opts(env) |
| 83 |
> |
cfg_pathfile = File(testenv['CFG_PATHFILE']).abspath |
| 84 |
> |
set_opts(env, cfg_pathfile) |
| 85 |
|
|
| 86 |
+ |
load_plat.combine_instpaths(env) |
| 87 |
+ |
|
| 88 |
|
# accept license |
| 89 |
|
if ((not env['SKIP'] |
| 90 |
< |
or env['SKIP'].strip().lower() in (0,'0','no','false')) |
| 90 |
> |
or env['SKIP'].strip().lower() in (0,'0','n','no','false',None)) |
| 91 |
|
and not '-c' in sys.argv and not 'test' in sys.argv): |
| 92 |
|
from build_utils import copyright |
| 93 |
|
copyright.show_license() |
| 94 |
+ |
testenv['SKIP'] = '1' |
| 95 |
|
|
| 96 |
+ |
# We waited to save this, so that we can add the SKIP |
| 97 |
+ |
prevars.Save(File(testenv['CFG_OPTFILE']).abspath, testenv) |
| 98 |
+ |
|
| 99 |
|
# fill in generic config |
| 100 |
|
allplats_setup(env) |
| 101 |
|
|
| 102 |
+ |
print('Installation directories:') |
| 103 |
+ |
print('Base: ', env.subst('$RAD_BASEDIR')) |
| 104 |
+ |
print('Binaries: ', env.subst('$RAD_BINDIR')) |
| 105 |
+ |
print('Library: ', env.subst('$RAD_RLIBDIR')) |
| 106 |
+ |
print('Manpages: ', env.subst('$RAD_MANDIR')) |
| 107 |
+ |
print() |
| 108 |
|
|
| 109 |
|
# Bring in all the actual things to build |
| 110 |
|
Export('env') |
| 112 |
|
SConscript(os.path.join('test', 'SConscript')) |
| 113 |
|
|
| 114 |
|
else: |
| 115 |
< |
SConscript(os.path.join('src', 'common', 'SConscript')) |
| 115 |
> |
SConscript(os.path.join('src', 'common', 'SConscript'), |
| 116 |
> |
variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0) |
| 117 |
|
post_common_setup(env) |
| 118 |
< |
for d in Split('meta cv gen ot rt px hd util cal'): |
| 119 |
< |
print d |
| 120 |
< |
SConscript(os.path.join('src', d, 'SConscript')) |
| 118 |
> |
dirs = Split('''meta cv gen ot rt px hd util cal''') |
| 119 |
> |
if os.path.isfile('src/winimage/SConscript'): |
| 120 |
> |
dirs.append('winimage') |
| 121 |
> |
if os.path.isfile('src/winrview/SConscript'): |
| 122 |
> |
dirs.append('winrview') |
| 123 |
> |
for d in dirs: |
| 124 |
> |
print(d) |
| 125 |
> |
SConscript(os.path.join('src', d, 'SConscript'), |
| 126 |
> |
variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0) |
| 127 |
|
|
| 128 |
< |
if string.find(string.join(sys.argv[1:]), 'install') > -1: |
| 128 |
> |
if ' '.join(sys.argv[1:]).find('install') > -1: |
| 129 |
|
shareinstall_setup(env) |
| 130 |
|
|
| 131 |
|
Default('.') |
| 135 |
|
env.Alias('rlibinstall', '$RAD_RLIBDIR') |
| 136 |
|
env.Alias('maninstall', '$RAD_MANDIR') |
| 137 |
|
|
| 138 |
< |
env.Alias('build', ['#bin']) |
| 138 |
> |
env.Alias('build', ['$RAD_BUILDBIN']) #, '$RAD_BUILDRLIB']) |
| 139 |
|
env.Alias('test', ['#test']) |
| 140 |
|
env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall']) |
| 141 |
|
|
| 142 |
+ |
# vi: set ts=4 sw=4 : |
| 143 |
+ |
# vim: set syntax=python : |