-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
105 lines (83 loc) · 3.29 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
#!python
import sys
import os
from SCons.Script import BUILD_TARGETS
BUILD_TARGETS.append('fixtest')
have_scons_local=False
if os.path.exists('scons_local'):
try:
sys.path.insert(0, os.path.join(Dir('#').abspath,
'scons_local'))
from prereq_tools import PreReqComponent
from build_info import BuildInfo
have_scons_local=True
print ('Using scons_local build')
except ImportError:
print ('Using traditional build')
pass
env = Environment()
config = Configure(env)
for required_lib in ['uuid', 'cmocka']:
if not config.CheckLib(required_lib):
config.Finish()
exit(1)
if not config.CheckLib('crypto'):
config.Finish()
print ('for libcrypto install openssl-devel package')
exit(1)
for required_header in ['openssl/md5.h']:
if not config.CheckHeader(required_header):
config.Finish()
exit(1)
if have_scons_local:
OPTS_FILE = os.path.join(Dir('#').abspath, 'daos_m.conf')
OPTS = Variables(OPTS_FILE)
COMMITS_FILE = os.path.join(Dir('#').abspath, 'utils/build.config')
if not os.path.exists(COMMITS_FILE):
COMMITS_FILE = None
PREREQS = PreReqComponent(env, OPTS, COMMITS_FILE)
PREREQS.preload(os.path.join(Dir('#').abspath,
'scons_local',
'components.py'))
OPTS.Save(OPTS_FILE, env)
# Define this now, and then the individual components can import this
# through PREREQS when they need it.
env.Append(CPPDEFINES={'DAOS_HAS_NVML' : '1'})
else:
PREREQS = None
env.Replace(PREFIX=Dir('#build').abspath)
if config.CheckHeader('libpmemobj.h'):
env.Append(CPPDEFINES={'DAOS_HAS_NVML' : '1'})
else:
env.Append(CPPDEFINES={'DAOS_HAS_NVML' : '0'})
env.Alias('install', '$PREFIX')
config.Finish()
DAOS_VERSION = "0.0.2"
Export('DAOS_VERSION')
if env['PLATFORM'] == 'darwin':
# generate .so on OSX instead of .dylib
env['SHLIBSUFFIX'] = '.so'
# Compiler options
env.Append(CCFLAGS = ['-g', '-Wall', '-Werror', '-Wno-missing-braces',
'-fpic', '-D_GNU_SOURCE'])
env.Append(CCFLAGS = ['-O2', '-DDAOS_VERSION=\\"' + DAOS_VERSION + '\\"'])
# generate targets in specific build dir to avoid polluting the source code
VariantDir('build', '.', duplicate=0)
SConscript('build/src/SConscript', exports=['env', 'PREREQS'])
if have_scons_local:
BUILDINFO = PREREQS.get_build_info()
BUILDINFO.gen_script('.build_vars.sh')
BUILDINFO.save('.build_vars.json')
env.InstallAs("$PREFIX/TESTING/.build_vars.sh", ".build_vars.sh")
env.InstallAs("$PREFIX/TESTING/.build_vars.json", ".build_vars.json")
# install the test_runner code from scons_local
SConscript('build/scons_local/test_runner/SConscript', exports=['env', 'PREREQS'])
# install the build verification tests
SConscript('utils/bvtest/scripts/SConscript', exports=['env', 'PREREQS'])
env.Command("fixtest", "./utils/bvtest/OrteRunner.py",
[
Copy("$PREFIX/TESTING/test_runner/", "./utils/bvtest/OrteRunner.py", False)
])
Default('build')
Depends('install', 'build')
Depends('fixtest', 'install')