-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
106 lines (82 loc) · 3.05 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!python
import os
import sys
##sys.path.insert(0, "./scons_local")
##from prereq_tools import *
ROOT = Dir('#').abspath
DAOS_HL_VERSION = "0.0.1"
SRC_DIRS = ['array',
'.',
]
def save_build_info(env, prereqs, platform):
"""Save the build information"""
build_info = prereqs.get_build_info()
#Save the build info locally
json_build_vars = '.build_vars-%s.json' % platform
sh_build_vars = '.build_vars-%s.sh' % platform
build_info.save(json_build_vars)
build_info.gen_script(sh_build_vars)
#Install the build info to the testing directory
env.InstallAs('$PREFIX/TESTING/.build_vars.sh',
sh_build_vars)
env.InstallAs('$PREFIX/TESTING/.build_vars.json',
json_build_vars)
def load_sconscripts(arch_dir):
"""Load the SConscripts"""
VariantDir(arch_dir, '.', duplicate=0)
src_prefix = '%s/src' % arch_dir
for src_dir in SRC_DIRS:
SConscript('%s/%s/SConscript' % (src_prefix, src_dir))
Default('src/%s' % src_dir)
## SConscript('%s/scons_local/test_runner/SConscript' % arch_dir)
## Default('example')
def scons():
"""Run SCons"""
platform = os.uname()[0]
arch_dir = 'build/%s' % platform
opt_file = os.path.join(ROOT, "daos_hl-%s.conf" % platform)
if os.path.exists('daos_hl.conf') and not os.path.exists(opt_file):
print 'Renaming legacy conf file'
os.rename('daos_hl.conf', opt_file)
opts = Variables(opt_file)
AddOption('--prefix',
dest='prefix',
type='string',
nargs=1,
action='store',
metavar='DIR',
help='installation prefix')
env = Environment(PREFIX = GetOption('prefix'))
print "PREFIX is", env['PREFIX']
INCLUDE_PREFIX = os.path.join("$PREFIX", "include")
LIB_PREFIX = os.path.join("$PREFIX", "lib")
BIN_PREFIX = os.path.join("$PREFIX", "bin")
## env = DefaultEnvironment()
# env = Environment()
config = Configure(env)
# if not config.CheckHeader("daos_api.h"):
# print "daos_api.h header is required"
# Exit(-1)
# if not config.CheckHeader("daos_types.h"):
# print "daos_types.h header is required"
# Exit(-1)
# if not config.CheckLib("daos"):
# print "libdaos package is required"
# Exit(-1)
# env.Append(CCFLAGS=['-g', '-Wall', '-Werror', '-D_GNU_SOURCE', '-fPIC'])
env.Append(CCFLAGS=['-g', '-D_GNU_SOURCE', '-fPIC'])
env.Append(CPPPATH=['/home/mschaara/install/daos_m/include'])
env.Append(CPPPATH=['/scratch/mschaara/deps/include'])
env.Append(LIBS=['daos', 'uuid', 'crt', 'mpi'])
env.Append(LIBPATH=['/home/mschaara/install/daos_m/lib'])
env.Append(LIBPATH=['/scratch/mschaara/deps/lib'])
Export('env INCLUDE_PREFIX LIB_PREFIX BIN_PREFIX DAOS_HL_VERSION')
config.Finish()
load_sconscripts(arch_dir)
env.Alias('install', '$PREFIX')
try:
Help(opts.GenerateHelpText(env), append=True)
except TypeError:
Help(opts.GenerateHelpText(env))
if __name__ == 'SCons.Script':
scons()