1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

feature #457: Refactor Sconstruct files

This commit is contained in:
Ruben S. Montero 2011-01-27 23:12:48 +01:00
parent 43b4340177
commit 3433820b94
22 changed files with 71 additions and 426 deletions

View File

@ -96,6 +96,7 @@ sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
main_env.Append(sqlite='yes')
main_env.Append(CPPFLAGS=["-DSQLITE_DB"])
main_env.Append(LIBS=['sqlite3'])
else:
main_env.Append(sqlite='no')
@ -104,13 +105,10 @@ mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
main_env.Append(mysql='yes')
main_env.Append(CPPFLAGS=["-DMYSQL_DB"])
main_env.Append(LIBS=['mysqlclient'])
else:
main_env.Append(mysql='no')
# Testing
testing=ARGUMENTS.get('testing', 'no')
# xmlrpc
xmlrpc_dir=ARGUMENTS.get('xmlrpc', 'none')
if xmlrpc_dir!='none':
@ -187,17 +185,23 @@ build_scripts=[
'src/authm/SConstruct',
]
# Testing
testing=ARGUMENTS.get('tests', 'no')
if testing=='yes':
main_env.Append(testing='yes')
main_env.ParseConfig('cppunit-config --cflags --libs')
main_env.Append(CPPPATH=[
cwd+'/include/test',
'/usr/include/cppunit/'
'/usr/include/cppunit/' #not provided by cppunit-config command
])
main_env.Append(LIBPATH=[
cwd+'/src/test',
])
main_env.Append(LIBS=[
'nebula_test_common',
])
@ -209,17 +213,16 @@ if testing=='yes':
'src/image/test/SConstruct',
'src/lcm/test/SConstruct',
'src/pool/test/SConstruct',
'src/scheduler/src/pool/test/SConstruct',
'src/scheduler/src/xml/test/SConstruct',
'src/template/test/SConstruct',
'src/test/SConstruct',
'src/um/test/SConstruct',
'src/vm/test/SConstruct',
'src/vnm/test/SConstruct',
])
else:
main_env.Append(testing='no')
for script in build_scripts:
env=main_env.Clone()
SConscript(script, exports='env')

View File

@ -17,7 +17,7 @@
Import('env')
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_template',
'nebula_common',
'nebula_core',
@ -25,22 +25,7 @@ env.Append(LIBS=[
'nebula_authm',
'nebula_sql',
'nebula_log',
'cppunit',
'dl',
'pthread',
'ssl'
'crypto'
])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
env.Program('test','AuthManagerTest.cc')
#

View File

@ -17,12 +17,9 @@
Import('env')
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_common',
'nebula_log',
'cppunit',
'dl',
'pthread'
])
env.Program('test_sa','single_attribute.cc')

View File

@ -26,8 +26,6 @@ source_files=[
'HookManagerDriver.cc'
]
test_names=[]
# Build library
env.StaticLibrary(lib_name, source_files)

View File

@ -18,9 +18,8 @@
Import('env')
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_core_test',
'nebula_host',
'nebula_vmm',
'nebula_im',
@ -36,21 +35,12 @@ env.Append(LIBS=[
'nebula_hm',
'nebula_authm',
'nebula_common',
'nebula_lcm',
'nebula_dm',
'nebula_sql',
'nebula_log',
'nebula_lcm_dm',
'crypto',
'cppunit',
'crypto'
])
# Sources to generate the library
if env['sqlite']=='yes':
env.Append(LIBS=['sqlite3'])
if env['mysql']=='yes':
env.Append(LIBS=['mysqlclient'])
env.Program('test','HostPoolTest.cc')
env.Program('test_hook','HostHookTest.cc')

View File

@ -26,8 +26,6 @@ source_files=[
'InformationManagerDriver.cc'
]
test_names=[]
# Build library
env.StaticLibrary(lib_name, source_files)

View File

@ -16,7 +16,7 @@
Import('env')
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_image',
'nebula_um',
'nebula_vm',
@ -27,25 +27,11 @@ env.Append(LIBS=[
'nebula_pool',
'nebula_mad',
'nebula_common',
'nebula_log',
'nebula_core',
'nebula_sql',
'cppunit',
'dl',
'pthread',
'crypto',
'nebula_log',
'crypto'
])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
env.Program('test','ImagePoolTest.cc')

View File

@ -18,9 +18,8 @@
Import('env')
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_core_test',
'nebula_host',
'nebula_vmm',
'nebula_im',
@ -38,18 +37,9 @@ env.Append(LIBS=[
'nebula_common',
'nebula_sql',
'nebula_log',
'nebula_lcm_dm',
'crypto',
'cppunit',
'nebula_lcm',
'nebula_dm',
'crypto'
])
# Sources to generate the library
if env['sqlite']=='yes':
env.Append(LIBS=['sqlite3'])
if env['mysql']=='yes':
env.Append(LIBS=['mysqlclient'])
env.Program('test','LifeCycleManagerTest.cc')

View File

@ -30,7 +30,7 @@ source_files=[
env.StaticLibrary(lib_name, source_files)
# Build daemon
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_core',
'nebula_vmm',
'nebula_lcm',
@ -54,15 +54,4 @@ env.Append(LIBS=[
'crypto'
])
# Sources to generate the library
if env['sqlite']=='yes':
env.Append(LIBS=['sqlite3'])
if env['mysql']=='yes':
env.Append(LIBS=['mysqlclient'])
if not env.GetOption('clean'):
env.ParseConfig('../../share/scons/get_xmlrpc_config server')
env.Program('oned.cc')

View File

@ -21,30 +21,14 @@ env.Append(LIBPATH=[
'.'
])
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_pool',
'nebula_common',
'nebula_log',
'nebula_core',
'nebula_sql',
'cppunit',
'dl',
'pthread',
'test_object'
])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
env.StaticLibrary('test_object', ['TestPoolSQL.cc', 'TestPoolSQL.h'])
env.Program('test','pool.cc')

View File

@ -14,81 +14,24 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
Import('env')
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=[
env.Append(CPPPATH=[
cwd + '/include/',
cwd + '../../../include/'
])
# Library dirs
main_env.Append(LIBPATH=[
env.Append(LIBPATH=[
cwd+'/src/xml',
cwd+'/src/pool',
cwd+'/src/sched',
cwd+'/../log',
cwd+'/../common',
cwd+'/src/sched'
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall"
])
# Linking flags
main_env.Append(LINKFLAGS=['-g', '-pthread'])
################################################################################
# EXTRA CONFIGURATION
################################################################################
#-------------------------------------------------------------------------------
# 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"])
main_env.ParseConfig('../../share/scons/get_xmlrpc_config client')
#-------------------------------------------------------------------------------
# build lex/bison
#-------------------------------------------------------------------------------
build_parsers=ARGUMENTS.get('parsers', 'no')
if build_parsers=='yes':
main_env.Append(parsers='yes')
else:
main_env.Append(parsers='no')
#-------------------------------------------------------------------------------
# libxml2
#-------------------------------------------------------------------------------
main_env.ParseConfig('xml2-config --libs --cflags')
################################################################################
# SCONS scripts to build
################################################################################
@ -99,6 +42,12 @@ build_scripts=[
'src/sched/SConstruct'
]
if env['testing']=='yes':
build_scripts.extend([
'src/pool/test/SConstruct',
'src/xml/test/SConstruct',
])
for script in build_scripts:
env=main_env.Clone()
SConscript(script, exports='env')
sched_env=env.Clone()
SConscript(script, exports='sched_env')

View File

@ -16,7 +16,7 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
Import('env')
Import('sched_env')
lib_name='scheduler_pool'
@ -27,4 +27,4 @@ source_files=[
'VirtualMachineXML.cc']
# Build library
env.StaticLibrary(lib_name, source_files)
sched_env.StaticLibrary(lib_name, source_files)

View File

@ -14,47 +14,10 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
import os
import sys
import shutil
sys.path.append("../../../../../share/scons")
# 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']
# Include dirs
main_env.Append(CPPPATH=[
cwd+'/../../../include',
cwd+'/../../../../../include',
'/usr/include/cppunit/'
])
# Library dirs
main_env.Append(LIBPATH=[
cwd+'/..',
cwd+'/../../xml',
cwd+'/../../../../log',
cwd+'/../../../../common',
cwd+'/../../../../test',
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# Linking flags
main_env.Append(LDFLAGS=["-g"])
Import('sched_env')
# Libraries
main_env.Append(LIBS=[
'cppunit',
sched_env.Prepend(LIBS=[
'scheduler_xml',
'scheduler_pool',
'nebula_log',
@ -62,38 +25,5 @@ main_env.Append(LIBS=[
'nebula_test_common',
])
main_env.Program('test_vm','VirtualMachineXMLTest.cc')
main_env.Program('test_host','HostXMLTest.cc')
################################################################################
# EXTRA CONFIGURATION
################################################################################
#-------------------------------------------------------------------------------
# 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"])
main_env.ParseConfig('../../../../../share/scons/get_xmlrpc_config client')
#-------------------------------------------------------------------------------
# build lex/bison
#-------------------------------------------------------------------------------
build_parsers=ARGUMENTS.get('parsers', 'no')
if build_parsers=='yes':
main_env.Append(parsers='yes')
else:
main_env.Append(parsers='no')
#-------------------------------------------------------------------------------
# libxml2
#-------------------------------------------------------------------------------
main_env.ParseConfig('xml2-config --libs --cflags')
sched_env.Program('test_vm','VirtualMachineXMLTest.cc')
sched_env.Program('test_host','HostXMLTest.cc')

View File

@ -16,28 +16,23 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
Import('env')
Import('sched_env')
lib_name='scheduler_sched'
source_files=['Scheduler.cc']
# Build library
env.StaticLibrary(lib_name, source_files)
sched_env.StaticLibrary(lib_name, source_files)
# Build daemon
env.Append(LIBS=[
sched_env.Prepend(LIBS=[
'scheduler_sched',
'scheduler_pool',
'nebula_log',
'scheduler_xml',
'nebula_common',
'crypto',
'pthread'
])
if not env.GetOption('clean'):
env.ParseConfig('../../../../share/scons/get_xmlrpc_config client')
env.Program('mm_sched.cc')
sched_env.Program('mm_sched.cc')

View File

@ -16,27 +16,27 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
Import('env')
Import('sched_env')
lib_name='scheduler_xml'
if env['parsers']=='yes':
if sched_env['parsers']=='yes':
# LEX
parser=env.Lex(
parser=sched_env.Lex(
source='expr_parser.l'
)
env.NoClean(parser)
sched_env.NoClean(parser)
# BISON
parser=env.Bison(
parser=sched_env.Bison(
source='expr_arith.y'
)
env.NoClean(parser)
sched_env.NoClean(parser)
parser=env.Bison(
parser=sched_env.Bison(
source='expr_bool.y'
)
env.NoClean(parser)
sched_env.NoClean(parser)
source_files=['ObjectXML.cc',
'Client.cc',
@ -45,4 +45,4 @@ source_files=['ObjectXML.cc',
'expr_arith.cc']
# Build library
env.StaticLibrary(lib_name, source_files)
sched_env.StaticLibrary(lib_name, source_files)

View File

@ -14,83 +14,14 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
import os
import sys
import shutil
sys.path.append("../../../../../share/scons")
# 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']
# Include dirs
main_env.Append(CPPPATH=[
cwd+'/../../../include',
cwd+'/../../../../../include',
'/usr/include/cppunit/'
])
# Library dirs
main_env.Append(LIBPATH=[
cwd+'/../../../../common',
cwd+'/../../../../log',
'../',
cwd+'/../../../../test',
])
# Compile flags
main_env.Append(CPPFLAGS=[
"-g",
"-Wall",
"-Werror"
])
# Linking flags
main_env.Append(LDFLAGS=["-g"])
Import('sched_env')
# Libraries
main_env.Append(LIBS=[
'cppunit',
sched_env.Prepend(LIBS=[
'nebula_log',
'scheduler_xml',
'nebula_common',
'nebula_test_common',
])
main_env.Program('test_xml','ObjectXMLTest.cc')
################################################################################
# EXTRA CONFIGURATION
################################################################################
#-------------------------------------------------------------------------------
# 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"])
main_env.ParseConfig('../../../../../share/scons/get_xmlrpc_config client')
#-------------------------------------------------------------------------------
# build lex/bison
#-------------------------------------------------------------------------------
build_parsers=ARGUMENTS.get('parsers', 'no')
if build_parsers=='yes':
main_env.Append(parsers='yes')
else:
main_env.Append(parsers='no')
#-------------------------------------------------------------------------------
# libxml2
#-------------------------------------------------------------------------------
main_env.ParseConfig('xml2-config --libs --cflags')
sched_env.Program('test_xml','ObjectXMLTest.cc')

View File

@ -30,4 +30,4 @@ if env['mysql']=='yes':
source_files.append('MySqlDB.cc')
# Build library
env.StaticLibrary(lib_name, source_files)
env.StaticLibrary(lib_name, source_files)

View File

@ -21,22 +21,7 @@ env.Append(LIBS=[
'nebula_template',
'nebula_common',
'nebula_core',
'nebula_log',
'cppunit',
'dl',
'pthread'
'nebula_log'
])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
env.Program('test','template.cc')
#

View File

@ -18,37 +18,18 @@
Import('env')
# Build LCM and DM toguether in a lib
lib_name='nebula_lcm_dm'
# Sources to generate the library
source_files=[
'../lcm/LifeCycleManager.cc',
'../lcm/LifeCycleActions.cc',
'../lcm/LifeCycleStates.cc',
'../dm/DispatchManager.cc',
'../dm/DispatchManagerActions.cc',
'../dm/DispatchManagerStates.cc',
]
# Build library
env.StaticLibrary(lib_name, source_files)
# Build a modified Nebula lib
lib_name='nebula_core_test'
# Sources to generate the library
source_files=[
'Nebula.cc',
'NebulaTest.cc',
'../nebula/NebulaTemplate.cc',
'NebulaTest.cc'
]
# Build library
env.StaticLibrary(lib_name, source_files)
# Build a modified Nebula lib
lib_name='nebula_test_common'
@ -59,5 +40,3 @@ source_files=[
# Build library
env.StaticLibrary(lib_name, source_files)

View File

@ -16,7 +16,7 @@
Import('env')
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_um',
'nebula_pool',
'nebula_log',
@ -25,21 +25,7 @@ env.Append(LIBS=[
'nebula_mad',
'nebula_core',
'nebula_sql',
'cppunit',
'dl',
'pthread',
'crypto'
])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
env.Program('test','UserPoolTest.cc')

View File

@ -16,7 +16,7 @@
Import('env')
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_um',
'nebula_vm',
'nebula_hm',
@ -30,22 +30,7 @@ env.Append(LIBS=[
'nebula_log',
'nebula_core',
'nebula_sql',
'cppunit',
'dl',
'pthread',
'crypto',
'crypto'
])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
env.Program('test','VirtualMachinePoolTest.cc')

View File

@ -16,7 +16,7 @@
Import('env')
env.Append(LIBS=[
env.Prepend(LIBS=[
'nebula_log',
'nebula_um',
'nebula_vnm',
@ -27,22 +27,7 @@ env.Append(LIBS=[
'nebula_core',
'nebula_common',
'nebula_sql',
'cppunit',
'dl',
'pthread',
'crypto',
'crypto'
])
sqlite=ARGUMENTS.get('sqlite', 'yes')
if sqlite=='yes':
env.Append(CPPFLAGS=["-DSQLITE_DB"])
env.Append(LIBS=[ 'sqlite3', ])
# MySQL
mysql=ARGUMENTS.get('mysql', 'no')
if mysql=='yes':
env.Append(CPPFLAGS=["-DMYSQL_DB"])
env.Append(LIBS=[ 'mysqlclient', ])
env.Program('test','VirtualNetworkPoolTest.cc')