import os, sys import glob options_filename = 'options.cache' opts = Variables(options_filename,ARGUMENTS) #TODO: opts.Add(PathVariable('prefix', 'The prefix where the application will be installed', '')) opts.Add(PathVariable('clam_prefix', 'The prefix where CLAM was installed', '')) opts.Add(PackageOption('plugins_prefix', 'The prefix where the CLAM plugins are installed. Use No for disable them and Yes to use the same CLAM installation path.', 'no')) opts.Add(BoolVariable('debug', 'Enables debug symbols', 'no')) opts.Add( 'distcc_hosts', 'Defines compiling hosts, if defined enables the distcc compiler', '') env = Environment(ENV=os.environ, options=opts) Help(opts.GenerateHelpText(env)) avoid_configure_option=ARGUMENTS.get('force_avoid_configure',0) needs_configure = ('configure' in COMMAND_LINE_TARGETS) or not os.path.exists(options_filename) or len(ARGUMENTS)>0 avoid_configure = '--help' in COMMAND_LINE_TARGETS or avoid_configure_option=='1' or avoid_configure_option=='yes' or '-c' in ARGUMENTS python_version = "python%s.%s" % ( sys.version_info[0], sys.version_info[1] ) if needs_configure and not avoid_configure : print 'Configure phase...' opts.Update(env) opts.Save(options_filename, env) print "Finished. Invoke 'scons' now." Exit(0) try: env['CXX'] = env['ENV']['CC'] except KeyError: pass if env['distcc_hosts'] : env['CXX'] = 'distcc '+env['CXX'] env['ENV']['DISTCC_HOSTS'] = env['distcc_hosts'] SetOption('num_jobs', len(env['distcc_hosts'].split()) ) CLAMInstallDir = env['clam_prefix'] clam_sconstoolspath = os.path.join(CLAMInstallDir,'share','clam','sconstools') env.Tool('clam', toolpath=[clam_sconstoolspath]) sys.path.append(clam_sconstoolspath) env.EnableClamModules([ 'clam_core', 'clam_audioio', 'clam_processing', ], CLAMInstallDir) bindings = glob.glob('src/automatic/*.cpp') bindings += glob.glob('src/manual/*.cpp') sources = ['src/Definitions.cxx','src/indexing/indexing_slice.cpp','src/indexing/python_iterator.cpp'] + bindings sourcePaths = [ os.path.join('.'), os.path.join('src','automatic'), os.path.join('src','manual'), ] extraPaths = [] extraPaths += ['/usr/include/%s'%python_version,'/usr/include/'] extraPaths += [ CLAMInstallDir+'/include', CLAMInstallDir+'/include/CLAM', # KLUDGE to keep old style includes ] includePaths = sourcePaths + extraPaths env.Append(CPPPATH=includePaths) env.Append( LIBS=['boost_python'] ) env.Append( LIBPATH=['/usr/lib/%s/config'%python_version] ) if env['debug']: env.Append( CCFLAGS=['-g','-O3','-Wall'] ) else: env.Append( CCFLAGS=['-O3','-fomit-frame-pointer','-Wall'] ) env.SharedLibrary( target='clam', source=sources, SHLIBPREFIX='' )