1 |
schorsch |
1.1 |
|
2 |
|
|
import os |
3 |
|
|
import sys |
4 |
|
|
import string |
5 |
|
|
|
6 |
schorsch |
1.19 |
PATHFILE = 'scbuild/raypaths.py' |
7 |
|
|
OPTFILE = 'scbuild/rayopts.py' |
8 |
|
|
def set_pre_opts(): |
9 |
schorsch |
1.14 |
vars = Variables(OPTFILE, ARGUMENTS) |
10 |
|
|
vars.Add('SKIP', 'Skip Display of License terms', 0) |
11 |
schorsch |
1.19 |
vars.Add('RAD_DEBUG', 'Build a debug version', 0) |
12 |
|
|
vars.Add('MSVC_VERSION', 'Microsoft VC Version', '12.0') |
13 |
|
|
vars.Add('TARGET_ARCH', 'Windows only: "x68" or "amd64"', '') |
14 |
|
|
return vars |
15 |
schorsch |
1.17 |
|
16 |
|
|
def set_opts(env): |
17 |
|
|
vars = Variables(PATHFILE, ARGUMENTS) |
18 |
schorsch |
1.14 |
vars.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR']) |
19 |
|
|
vars.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) |
20 |
|
|
vars.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR']) |
21 |
|
|
vars.Update(env) |
22 |
schorsch |
1.17 |
vars.Save(PATHFILE, env) |
23 |
schorsch |
1.14 |
Help(vars.GenerateHelpText(env, sort=cmp)) |
24 |
schorsch |
1.1 |
# where stuff is located in the source tree |
25 |
schorsch |
1.16 |
# the binary target libs are configured by platform |
26 |
schorsch |
1.8 |
env['RAD_BUILDRLIB'] = '#lib' |
27 |
|
|
env['RAD_BUILDMAN'] = '#doc/man' |
28 |
schorsch |
1.1 |
|
29 |
|
|
def allplats_setup(env): |
30 |
schorsch |
1.8 |
from build_utils import find_libs |
31 |
schorsch |
1.9 |
find_libs.find_radlib(env) |
32 |
schorsch |
1.8 |
find_libs.find_x11(env) |
33 |
|
|
find_libs.find_gl(env) # OpenGL |
34 |
|
|
find_libs.find_libtiff(env) |
35 |
schorsch |
1.19 |
find_libs.find_pyinstaller(env) |
36 |
schorsch |
1.1 |
|
37 |
|
|
def post_common_setup(env): |
38 |
schorsch |
1.8 |
env.Append(CPPPATH = [os.path.join('#src', 'common')]) |
39 |
schorsch |
1.16 |
env.Append(LIBPATH=[env['RAD_BUILDLIB']]) # our own libs |
40 |
schorsch |
1.8 |
if not env.has_key('RAD_MLIB'): |
41 |
|
|
env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win |
42 |
schorsch |
1.1 |
|
43 |
|
|
def shareinstall_setup(env): |
44 |
|
|
from build_utils import install |
45 |
|
|
# only scan for those files when we actually need them |
46 |
|
|
if 'install' in sys.argv or 'rlibinstall' in sys.argv: |
47 |
|
|
install.install_rlibfiles(env) |
48 |
|
|
if 'install' in sys.argv or 'maninstall' in sys.argv: |
49 |
|
|
install.install_manfiles(env) |
50 |
|
|
|
51 |
schorsch |
1.16 |
|
52 |
schorsch |
1.19 |
# set stuff before loading platforms |
53 |
|
|
prevars = set_pre_opts() |
54 |
schorsch |
1.1 |
# Set up build environment |
55 |
schorsch |
1.19 |
env = Environment(variables=prevars) |
56 |
|
|
prevars.Save(OPTFILE, env) |
57 |
schorsch |
1.7 |
env.Decider('timestamp-match') |
58 |
schorsch |
1.1 |
|
59 |
schorsch |
1.18 |
from build_utils import install |
60 |
|
|
script_b = Builder(action = install.install_script, suffix = '') |
61 |
|
|
env.Append(BUILDERS={'InstallScript': script_b}) |
62 |
schorsch |
1.4 |
if os.name == 'posix': |
63 |
schorsch |
1.13 |
tclscript_b = Builder(action = install.install_tclscript, suffix = '') |
64 |
|
|
env.Append(BUILDERS={'InstallTCLScript': tclscript_b}) |
65 |
schorsch |
1.4 |
|
66 |
schorsch |
1.17 |
|
67 |
schorsch |
1.1 |
# configure platform-specific stuff |
68 |
|
|
from build_utils import load_plat |
69 |
schorsch |
1.19 |
load_plat.load_plat(env) |
70 |
schorsch |
1.1 |
|
71 |
|
|
# override options |
72 |
|
|
set_opts(env) |
73 |
|
|
|
74 |
|
|
# accept license |
75 |
schorsch |
1.8 |
if ((not env['SKIP'] |
76 |
schorsch |
1.17 |
or env['SKIP'].strip().lower() in (0,'0','n','no','false',None)) |
77 |
schorsch |
1.8 |
and not '-c' in sys.argv and not 'test' in sys.argv): |
78 |
|
|
from build_utils import copyright |
79 |
|
|
copyright.show_license() |
80 |
schorsch |
1.1 |
|
81 |
|
|
# fill in generic config |
82 |
|
|
allplats_setup(env) |
83 |
|
|
|
84 |
|
|
# Bring in all the actual things to build |
85 |
|
|
Export('env') |
86 |
schorsch |
1.8 |
if 'test' in sys.argv: |
87 |
|
|
SConscript(os.path.join('test', 'SConscript')) |
88 |
|
|
|
89 |
|
|
else: |
90 |
schorsch |
1.16 |
SConscript(os.path.join('src', 'common', 'SConscript'), |
91 |
|
|
variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0) |
92 |
schorsch |
1.8 |
post_common_setup(env) |
93 |
schorsch |
1.18 |
dirs = Split('''meta cv gen ot rt px hd util cal''') |
94 |
|
|
if os.path.isfile('src/winimage/SConscript'): |
95 |
|
|
dirs.append('winimage') |
96 |
|
|
if os.path.isfile('src/winrview/SConscript'): |
97 |
|
|
dirs.append('winrview') |
98 |
|
|
for d in dirs: |
99 |
|
|
print(d) |
100 |
schorsch |
1.16 |
SConscript(os.path.join('src', d, 'SConscript'), |
101 |
|
|
variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0) |
102 |
schorsch |
1.1 |
|
103 |
schorsch |
1.8 |
if string.find(string.join(sys.argv[1:]), 'install') > -1: |
104 |
|
|
shareinstall_setup(env) |
105 |
schorsch |
1.1 |
|
106 |
schorsch |
1.6 |
Default('.') |
107 |
|
|
|
108 |
schorsch |
1.1 |
# virtual targets |
109 |
schorsch |
1.4 |
env.Alias('bininstall', '$RAD_BINDIR') |
110 |
|
|
env.Alias('rlibinstall', '$RAD_RLIBDIR') |
111 |
|
|
env.Alias('maninstall', '$RAD_MANDIR') |
112 |
schorsch |
1.1 |
|
113 |
schorsch |
1.18 |
env.Alias('build', ['$RAD_BUILDBIN', '$RAD_BUILDRLIB']) |
114 |
schorsch |
1.8 |
env.Alias('test', ['#test']) |
115 |
schorsch |
1.1 |
env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall']) |
116 |
|
|
|
117 |
schorsch |
1.13 |
# vim: set syntax=python: |