#!/usr/bin/python import sys, os # CLAM unit tests build clamToolPath="../scons/sconstools" options = Options('options.cache') options.Add( PathOption( 'clam_prefix', 'Prefix were CLAM was installed', '') ) if sys.platform == 'darwin' : options.Add( PathOption( 'cppunit_prefix', 'Prefix were cppunit was installed', '/opt/local' )) else: options.Add( PathOption( 'cppunit_prefix', 'Prefix were cppunit was installed', '/usr' )) options.Add( BoolOption( 'release', 'Build CLAM Tests enabling compiler optimizations', 'no') ) options.Add( PathOption( 'test_data_path', 'Path to the TestDataPrefix', '') ) options.Add(BoolOption('crossmingw', 'Using MinGW crosscompiler mode in linux', 'no') ) toolchain='default' if sys.platform == 'win32': toolchain = 'mingw' env = Environment(ENV=os.environ, tools=[toolchain], options=options) env.Tool('clam', toolpath=[clamToolPath]) options.Update(env) options.Save('options.cache', env) Help(options.GenerateHelpText(env)) env['project'] = 'CLAMTests' env.SConsignFile() # Single signature file crosscompiling = env["crossmingw"] if crosscompiling : env.Tool('crossmingw', toolpath=[clamToolPath]) env.EnableClamModules([ 'clam_core', 'clam_audioio', 'clam_processing' ], env['clam_prefix'] ) env.Append( CCFLAGS=['-O3', '-fomit-frame-pointer', '-g','-Wall'] ) env.Append( CPPFLAGS = ['-DTEST_DATA_PATH="\\"%s\\""' % env['test_data_path'] ] ) env.Append( CPPFLAGS = ['-DCLAM_MODULE="\\"tests\\""'] ) env.ParseConfig( 'pkg-config --cflags --libs cppunit') if sys.platform == 'darwin': env.AppendUnique( LIBS=['xerces-c'] ) env.AppendUnique( LIBPATH=['/opt/local/lib'] ) #TODO: KLUDGE to allow old style and new style CLAM headers env.Append(CPPPATH=env['clam_prefix']+'/include/CLAM') env.Append(CPPPATH=env['clam_prefix']+'/include') env.Append(CPPPATH='include') env.Append(CPPPATH=os.path.join('..','UnitTests', 'CommonHelpers')) env.Append(CPPPATH=os.path.join('..','UnitTests')) env.Append(CPPPATH=os.path.join('..','FunctionalTests','CommonHelpers')) Export( 'env' ) SConscript('UnitTests/SConscript') SConscript('FunctionalTests/SConscript') Alias( 'all', ['run_unit_tests','run_functional_tests'] )