⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sconstruct

📁 一个人工神经网络的程序。 文档等说明参见http://aureservoir.sourceforge.net/
💻
字号:
#######################################################################  ::::_aureservoir_::::#  C++ library for analog reservoir computing neural networks##  Scons build system for python bindings##  Georg Holzmann, 2007##  This library is free software; you can redistribute it and/or#  modify it under the terms of the GNU Lesser General Public#  License as published by the Free Software Foundation; either#  version 2.1 of the License, or (at your option) any later version.######################################################################import os, glob, sys# trying import numpytry:	import numpyexcept:	print "You must have numpy installed !"	Exit(1)######################################################################  build system help#####################################################################Help("\nType: 'scons' to build aureservoir python bindings.")Help("\n      'scons -c' to clean objects and python files.\n")Help("\n      'scons install' to install python module.\n")Help("\n      'scons doc' to build module documentation.\n")######################################################################  general build options#####################################################################env = Environment(ENV = {'PATH' : os.environ['PATH'],                         'TERM' : os.environ['TERM'],                         'HOME' : os.environ['HOME']})env.Append( CPPPATH=['.', '../'] )env.Append(CCFLAGS="-O2 -fPIC -Wall -ffast-math -mfpmath=sse -msse -msse2")# get numpy include path (this works through different versions)try:    numpy_include = numpy.get_include()except AttributeError:    numpy_include = numpy.get_numpy_include()env.Append( CPPPATH=[numpy_include,] )######################################################################  command line options#####################################################################opt = Options('options.cache')opt.AddOptions(  PathOption('install_path', 'installation path for python module', \             '/usr/lib/python2.5/site-packages'),  PathOption('aureservoir_path', 'include path for aureservoir', None),  PathOption('flens_path', 'include path for FLENS', None),  PathOption('fftw3_path', 'include path for FFTW3', None),  PathOption('python_path', 'include path for python', \             '/usr/include/python2.5'),  ('arch', 'optimize for specific architecture (e.g. pentium4)', None),)opt.Update(env)opt.Save('options.cache',env)Help(opt.GenerateHelpText(env))if env.has_key('install_path'):	install_path = env['install_path']if env.has_key('aureservoir_path'):	env.Append(CPPPATH=[env['aureservoir_path']])if env.has_key('flens_path'):	env.Append(CPPPATH=[env['flens_path']])if env.has_key('fftw3_path'):	env.Append(CPPPATH=[env['fftw3_path']])if env.has_key('python_path'):	env.Append(CPPPATH=[env['python_path']])if env.has_key('arch'):	env.Append(CCFLAGS="-march=" + env['arch'])######################################################################  check dependencies###################################################################### don't check in help or clean modechecking = 1if "-h" in sys.argv:	checking = 0if env.GetOption('clean'):	checking = 0# do the checksconf = Configure(env)if checking:	if not conf.CheckCXXHeader('aureservoir/aureservoir.h'):		print 'Did not find aureservoir header (aureservoir/aureservoir.h) !'		Exit(1)	if not conf.CheckLib('flens', language="C++"):		print 'Did not find FLENS library !'		Exit(1)	if not conf.CheckCXXHeader('flens/flens.h'):		print 'Did not find FLENS header (flens/flens.h) !'		Exit(1)	if not conf.CheckCHeader('Python.h'):		print 'Did not find python headers !'		Exit(1)	if not conf.CheckLib('fftw3', language="C"):		print 'Did not find FFTW3 library !'		Exit(1)	if not conf.CheckLib('fftw3f', language="C"):		print 'Did not find FFTW3 single precision library !'		Exit(1)	if not conf.CheckHeader('fftw3.h'):		print 'Did not find FFTW3 header !'		Exit(1)env = conf.Finish()######################################################################  builder for SWIG interface#####################################################################swig = Builder(action = 'swig -c++ -python -o $TARGET $SOURCE')env.Append(BUILDERS = {'SWIG' : swig} )######################################################################  build python-files#####################################################################target = "aureservoir"sources = ['aureservoir_wrap.cpp',]# build SWIG interfacewrapper = env.SWIG('aureservoir_wrap.cpp','aureservoir.i')env.NoClean(wrapper)Clean(wrapper, 'aureservoir.pyc')lib = env.SharedLibrary( target,                   sources,                   SHLIBPREFIX="_" )Default(wrapper,lib)######################################################################  install python module#####################################################################install_files = [ 'aureservoir.py',              '_aureservoir.so' ]install = env.Install(install_path, install_files)env.Alias("install", install)######################################################################  build documentation#####################################################################def build_doc(target,source,env):	""" Builder-code to build the documentation.	"""	cmd1 = "python doxy2swig.py -n " + str(source[0]) + " tmp.i"	cmd2 = "sed s/aureservoir:://g tmp.i > " + str(target[0])	os.system(cmd1)	os.system(cmd2)	os.remove("tmp.i")builddoc = Builder(action = build_doc)env.Append(BUILDERS = {'Doc' : builddoc} )doc = env.Doc('ESN.i','../aureservoir/xml/classaureservoir_1_1ESN.xml')env.NoClean(doc)env.Alias("doc", doc)######################################################################  EOF#####################################################################

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -