-
Notifications
You must be signed in to change notification settings - Fork 1
/
SConstruct
145 lines (128 loc) · 4.33 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# -------------------------------------------------------------------------- #
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
import os
import sys
import shutil
sys.path.append("./share/scons")
from lex_bison import *
# This is the absolute path where the project is located
cwd=os.getcwd()
# Environment that will be applied to each scons child
main_env=Environment()
main_env['ENV']['PATH']=os.environ['PATH']
# Add builders for flex and bison
add_lex(main_env)
add_bison(main_env)
# Include dirs
main_env.Append(CPPPATH=[
cwd+'/include',
])
# Library dirs
main_env.Append(LIBPATH=[
cwd+'/src/common',
cwd+'/src/host',
cwd+'/src/mad',
cwd+'/src/nebula',
cwd+'/src/pool',
cwd+'/src/template',
cwd+'/src/vm',
cwd+'/src/vmm',
cwd+'/src/lcm',
cwd+'/src/tm',
cwd+'/src/dm',
cwd+'/src/im',
cwd+'/src/rm',
cwd+'/src/vnm',
cwd+'/src/hm',
cwd+'/src/um',
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall"
])
# Linking flags
main_env.Append(LDFLAGS=["-g"])
#######################
# EXTRA CONFIGURATION #
#######################
# SQLITE
sqlite_dir=ARGUMENTS.get('sqlite', 'none')
if sqlite_dir!='none':
main_env.Append(LIBPATH=[sqlite_dir+"/lib"])
main_env.Append(CPPPATH=[sqlite_dir+"/include"])
# xmlrpc
xmlrpc_dir=ARGUMENTS.get('xmlrpc', 'none')
if xmlrpc_dir!='none':
main_env.Append(LIBPATH=[xmlrpc_dir+"/lib"])
main_env.Append(CPPPATH=[xmlrpc_dir+"/include"])
# build lex/bison
build_parsers=ARGUMENTS.get('parsers', 'no')
if build_parsers=='yes':
main_env.Append(parsers='yes')
else:
main_env.Append(parsers='no')
if not main_env.GetOption('clean'):
try:
main_env.ParseConfig('share/scons/get_xmlrpc_config server')
main_env.ParseConfig('share/scons/get_xmlrpc_config client')
except Exception, e:
print ""
print "Error searching for xmlrpc-c libraries. Please check this"+\
" things:"
print ""
print " * You have installed development libraries for xmlrpc-c. One"+\
" way to check"
print " this is calling xmlrpc-c-config that is provided with the"+\
" development"
print " package."
print " * Check that the version of xmlrpc-c is at least 1.06. You"+\
" can do this also"
print " calling:"
print " $ xmlrpc-c-config --version"
print " * If all this requirements are already met please send log"+\
" files located in"
print " .xmlrpc_test to the mailing list."
print ""
exit(-1)
else:
shutil.rmtree('.xmlrpc_test', True)
shutil.rmtree('src/nebula/.xmlrpc_test', True)
shutil.rmtree('src/scheduler/.xmlrpc_test', True)
# SCONS scripts to build
build_scripts=[
'src/client/SConstruct',
'src/common/SConstruct',
'src/template/SConstruct',
'src/host/SConstruct',
'src/mad/SConstruct',
'src/nebula/SConstruct',
'src/pool/SConstruct',
'src/vm/SConstruct',
'src/vmm/SConstruct',
'src/lcm/SConstruct',
'src/rm/SConstruct',
'src/tm/SConstruct',
'src/im/SConstruct',
'src/dm/SConstruct',
'src/scheduler/SConstruct',
'src/vnm/SConstruct',
'src/hm/SConstruct',
'src/um/SConstruct',
]
for script in build_scripts:
env=main_env.Clone()
SConscript(script, exports='env')