annotate carfac/SConstruct @ 641:fe8ac95fcf9e

Delete CARFAC::Run to tighten up the interface.
author ronw@google.com
date Wed, 29 May 2013 20:33:06 +0000
parents d08c02c8e26f
children 20f64146c2ce
rev   line source
ronw@624 1 # CARFAC Open Source C++ Library
ronw@624 2 #
ronw@624 3 # This C++ file is part of an implementation of Lyon's cochlear model:
ronw@624 4 # "Cascade of Asymmetric Resonators with Fast-Acting Compression"
ronw@624 5 # to supplement Lyon's upcoming book "Human and Machine Hearing"
ronw@624 6 #
ronw@624 7 # Licensed under the Apache License, Version 2.0 (the "License");
ronw@624 8 # you may not use this file except in compliance with the License.
ronw@624 9 # You may obtain a copy of the License at
ronw@624 10 #
ronw@624 11 # http://www.apache.org/licenses/LICENSE-2.0
ronw@624 12 #
ronw@624 13 # Unless required by applicable law or agreed to in writing, software
ronw@624 14 # distributed under the License is distributed on an "AS IS" BASIS,
ronw@624 15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ronw@624 16 # See the License for the specific language governing permissions and
ronw@624 17 # limitations under the License.
ronw@624 18
ronw@624 19 ## @author Ron Weiss <ronw@google.com>
ronw@624 20 # @date created 2013/05/21
ronw@624 21 # @version \$Id$
ronw@624 22
ronw@624 23 """@package SConstruct
ronw@624 24 SConstruct file for the CARFAC Open Source C++ Library.
ronw@624 25
ronw@631 26 To install dependencies on Ubuntu, run:
ronw@624 27
ronw@631 28 sudo apt-get install libeigen3-dev scons \
ronw@631 29 cmake libgtest-dev libsndfile-dev # For testing.
ronw@631 30 export EIGEN_PATH=/usr/include/eigen3
ronw@631 31 export GTEST_SOURCE=/usr/src/gtest
ronw@631 32
ronw@631 33 To build all libraries, run:
ronw@624 34 scons
ronw@631 35
ronw@631 36 To run unit tests, run:
ronw@631 37 scons test
ronw@631 38
ronw@631 39 To clean up binaries, run:
ronw@631 40 scons --clean
ronw@624 41 """
ronw@624 42
ronw@639 43 import commands
ronw@624 44 import os
ronw@624 45
ronw@624 46 carfac_sources = [
alexbrandmeyer@637 47 'carfac_common.cc',
alexbrandmeyer@637 48 'agc_params.h',
alexbrandmeyer@636 49 'agc_coeffs.h',
ronw@639 50 'agc_state.h',
ronw@624 51 'carfac_output.cc',
alexbrandmeyer@637 52 'car_params.h',
alexbrandmeyer@636 53 'car_coeffs.h',
alexbrandmeyer@637 54 'ihc_params.h',
alexbrandmeyer@636 55 'car_state.h',
alexbrandmeyer@636 56 'ihc_coeffs.h',
alexbrandmeyer@636 57 'ihc_state.h',
ronw@624 58 'ear.cc',
alexbrandmeyer@636 59 'carfac.cc'
ronw@624 60 ]
ronw@624 61
ronw@624 62 env = Environment(CPPPATH=[os.environ['EIGEN_PATH']])
ronw@639 63 GCC_VERSION = commands.getoutput(env['CXX'] + ' -dumpversion')
ronw@639 64 if GCC_VERSION.startswith('4.6'):
ronw@639 65 env.MergeFlags(['-std=c++0x'])
ronw@639 66 else:
alexbrandmeyer@640 67 env.MergeFlags(['-std=c++11'])
ronw@639 68
ronw@624 69 env.Library(target = 'carfac', source = carfac_sources)
ronw@625 70
ronw@625 71 env.Command('tmp/libgtest.a', [],
ronw@625 72 [
ronw@625 73 Delete('tmp'),
ronw@625 74 Copy('tmp', os.environ['GTEST_SOURCE']),
ronw@625 75 'cd tmp && cmake . && make',
ronw@625 76 ])
ronw@625 77
ronw@631 78 test_program = env.Program(target = 'carfac_test',
ronw@631 79 source = ['carfac_test.cc'],
ronw@631 80 LIBS = ['carfac', 'gtest', 'gtest_main', 'pthread'],
ronw@631 81 LIBPATH = ['.', 'tmp'])
ronw@631 82 test_alias = Alias('test', [test_program], test_program[0].abspath)
ronw@631 83 AlwaysBuild(test_alias)