annotate trunk/carfac/SConstruct @ 667:9b719047eca5

Add support for building the main test file using scons, linking in gtest.
author ronw@google.com
date Tue, 21 May 2013 21:48:34 +0000
parents 6ec6b50f13da
children a9694d0bb55a
rev   line source
ronw@666 1 # CARFAC Open Source C++ Library
ronw@666 2 #
ronw@666 3 # This C++ file is part of an implementation of Lyon's cochlear model:
ronw@666 4 # "Cascade of Asymmetric Resonators with Fast-Acting Compression"
ronw@666 5 # to supplement Lyon's upcoming book "Human and Machine Hearing"
ronw@666 6 #
ronw@666 7 # Licensed under the Apache License, Version 2.0 (the "License");
ronw@666 8 # you may not use this file except in compliance with the License.
ronw@666 9 # You may obtain a copy of the License at
ronw@666 10 #
ronw@666 11 # http://www.apache.org/licenses/LICENSE-2.0
ronw@666 12 #
ronw@666 13 # Unless required by applicable law or agreed to in writing, software
ronw@666 14 # distributed under the License is distributed on an "AS IS" BASIS,
ronw@666 15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ronw@666 16 # See the License for the specific language governing permissions and
ronw@666 17 # limitations under the License.
ronw@666 18
ronw@666 19 ## @author Ron Weiss <ronw@google.com>
ronw@666 20 # @date created 2013/05/21
ronw@666 21 # @version \$Id$
ronw@666 22
ronw@666 23 """@package SConstruct
ronw@666 24 SConstruct file for the CARFAC Open Source C++ Library.
ronw@666 25
ronw@666 26 To install dependencies and build on Ubuntu, run:
ronw@666 27
ronw@667 28 sudo apt-get install libeigen3-dev scons \
ronw@667 29 cmake libgtest-dev libsndfile-dev # For testing.
ronw@666 30 export EIGEN_PATH=/usr/include/eigen3
ronw@667 31 export GTEST_SOURCE=/usr/src/gtest
ronw@666 32 scons
ronw@666 33 """
ronw@666 34
ronw@666 35 import os
ronw@666 36
ronw@666 37 carfac_sources = [
ronw@666 38 'agc_params.cc',
ronw@666 39 'carfac.cc',
ronw@666 40 'carfac_common.cc',
ronw@666 41 'carfac_output.cc',
ronw@666 42 'car_params.cc',
ronw@666 43 'ear.cc',
ronw@666 44 'ear_output.cc',
ronw@666 45 'ihc_params.cc',
ronw@666 46 ]
ronw@666 47
ronw@666 48 env = Environment(CPPPATH=[os.environ['EIGEN_PATH']])
ronw@666 49 # Needed to support std::vector initialization lists.
ronw@666 50 env.MergeFlags(['-std=c++0x'])
ronw@666 51 env.Library(target = 'carfac', source = carfac_sources)
ronw@667 52
ronw@667 53 env.Command('tmp/libgtest.a', [],
ronw@667 54 [
ronw@667 55 Delete('tmp'),
ronw@667 56 Copy('tmp', os.environ['GTEST_SOURCE']),
ronw@667 57 'cd tmp && cmake . && make',
ronw@667 58 ])
ronw@667 59
ronw@667 60 env.Program(target = 'main',
ronw@667 61 source = ['main.cc'],
ronw@667 62 LIBS = ['carfac', 'sndfile', 'gtest', 'pthread'],
ronw@667 63 LIBPATH = ['.', 'tmp'])