--- ray/SConstruct 2016/03/10 01:49:56 1.16 +++ ray/SConstruct 2016/04/19 21:21:23 1.19 @@ -3,17 +3,23 @@ import os import sys import string -OPTFILE = 'rayopts.py' -def set_opts(env): - # XXX add some caching +PATHFILE = 'scbuild/raypaths.py' +OPTFILE = 'scbuild/rayopts.py' +def set_pre_opts(): vars = Variables(OPTFILE, ARGUMENTS) vars.Add('SKIP', 'Skip Display of License terms', 0) + vars.Add('RAD_DEBUG', 'Build a debug version', 0) + vars.Add('MSVC_VERSION', 'Microsoft VC Version', '12.0') + vars.Add('TARGET_ARCH', 'Windows only: "x68" or "amd64"', '') + return vars + +def set_opts(env): + vars = Variables(PATHFILE, ARGUMENTS) vars.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR']) vars.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) vars.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR']) - vars.Add('RAD_DEBUG', 'Build a debug version', 0) vars.Update(env) - vars.Save(OPTFILE, env) + vars.Save(PATHFILE, env) Help(vars.GenerateHelpText(env, sort=cmp)) # where stuff is located in the source tree # the binary target libs are configured by platform @@ -26,6 +32,7 @@ def allplats_setup(env): find_libs.find_x11(env) find_libs.find_gl(env) # OpenGL find_libs.find_libtiff(env) + find_libs.find_pyinstaller(env) def post_common_setup(env): env.Append(CPPPATH = [os.path.join('#src', 'common')]) @@ -41,34 +48,32 @@ def shareinstall_setup(env): if 'install' in sys.argv or 'maninstall' in sys.argv: install.install_manfiles(env) -_arch = None -for item in sys.argv[1:]: - if item.startswith('TARGET_ARCH'): - res = item.split('=') - if len(res) == 2: - _arch = res[1].strip() +# set stuff before loading platforms +prevars = set_pre_opts() # Set up build environment -env = Environment(TARGET_ARCH=_arch) +env = Environment(variables=prevars) +prevars.Save(OPTFILE, env) env.Decider('timestamp-match') +from build_utils import install +script_b = Builder(action = install.install_script, suffix = '') +env.Append(BUILDERS={'InstallScript': script_b}) if os.name == 'posix': - from build_utils import install - script_b = Builder(action = install.install_script, suffix = '') - env.Append(BUILDERS={'InstallScript': script_b}) tclscript_b = Builder(action = install.install_tclscript, suffix = '') env.Append(BUILDERS={'InstallTCLScript': tclscript_b}) + # configure platform-specific stuff from build_utils import load_plat -load_plat.load_plat(env, ARGUMENTS, arch=_arch) +load_plat.load_plat(env) # override options set_opts(env) # accept license if ((not env['SKIP'] - or env['SKIP'].strip().lower() in (0,'0','no','false')) + or env['SKIP'].strip().lower() in (0,'0','n','no','false',None)) and not '-c' in sys.argv and not 'test' in sys.argv): from build_utils import copyright copyright.show_license() @@ -85,8 +90,13 @@ else: SConscript(os.path.join('src', 'common', 'SConscript'), variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0) post_common_setup(env) - for d in Split('meta cv gen ot rt px hd util cal'): - print d + dirs = Split('''meta cv gen ot rt px hd util cal''') + if os.path.isfile('src/winimage/SConscript'): + dirs.append('winimage') + if os.path.isfile('src/winrview/SConscript'): + dirs.append('winrview') + for d in dirs: + print(d) SConscript(os.path.join('src', d, 'SConscript'), variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0) @@ -100,7 +110,7 @@ env.Alias('bininstall', '$RAD_BINDIR') env.Alias('rlibinstall', '$RAD_RLIBDIR') env.Alias('maninstall', '$RAD_MANDIR') -env.Alias('build', ['$RAD_BUILDBIN']) +env.Alias('build', ['$RAD_BUILDBIN', '$RAD_BUILDRLIB']) env.Alias('test', ['#test']) env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall'])