-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
55 lines (43 loc) · 1.84 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
def createStaticPicLibraryBuilder(env):
"""This is a utility function that creates the StaticExtLibrary Builder in
an Environment if it is not there already.
If it is already there, we return the existing one."""
import SCons.Action
try:
static_extlib = env['BUILDERS']['StaticPicLibrary']
except KeyError:
action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ]
if env.Detect('ranlib'):
ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR")
action_list.append(ranlib_action)
static_extlib = SCons.Builder.Builder(action = action_list,
emitter = '$LIBEMITTER',
prefix = '$LIBPREFIX',
suffix = '$LIBSUFFIX',
src_suffix = '$OBJSUFFIX',
src_builder = 'SharedObject')
env['BUILDERS']['StaticPicLibrary'] = static_extlib
return static_extlib
env = Environment(
CXXFLAGS=['-std=gnu++11', '-Wall'],
LIBS=['-lm']
)
createStaticPicLibraryBuilder(env)
libsources = Split("""
agent.cc
markov.cc
rand.cc
runner.cc
""")
shared = env.Clone()
shared.VariantDir('build/shared', 'core', duplicate=0)
shared_lib = shared.SharedLibrary('build/shared/decider', File(libsources, 'build/shared'))
staticdyn_lib = shared.StaticPicLibrary('build/shared/decider_dyn', File(libsources, 'build/shared'))
static = env.Clone()
static.VariantDir('build/static', 'core', duplicate=0)
static_lib = static.StaticLibrary('build/static/decider', File(libsources, 'build/static'))
env.Default([shared_lib, staticdyn_lib, static_lib])
env.VariantDir('build', 'core', duplicate=0)
test = env.Program('build/test', File(['main.cc'] + libsources), 'build')
env.Alias('test', test)
# vim:set ft=python sw=3: