Changeset a93dab3
- Timestamp:
- Dec 8, 2013, 5:14:12 AM (11 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 0a509c6
- Parents:
- 6b14351
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wscript
r6b14351 ra93dab3 1 1 #! /usr/bin/python 2 2 # 3 # waf build script, see http://code.google.com/p/waf/ 3 # waf build system, see http://code.google.com/p/waf/ 4 # 4 5 # usage: 5 # $ waf distclean configure build 6 # get it: 7 # $ svn co http://waf.googlecode.com/svn/trunk /path/to/waf 8 # $ alias waf=/path/to/waf/waf-light 6 # $ ./waf distclean configure build 9 7 # 10 8 # TODO … … 33 31 def add_option_enable_disable(ctx, name, default = None, 34 32 help_str = None, help_disable_str = None): 35 if help_str == None:36 help_str = 'enable ' + name + ' support'37 if help_disable_str == None:38 help_disable_str = 'do not ' + help_str39 ctx.add_option('--enable-' + name, action = 'store_true'40 default = default,41 dest = 'enable_' + name.replace('-','_'),42 help = help_str)43 ctx.add_option('--disable-' + name, action = 'store_false',44 #default = default,45 dest = 'enable_' + name.replace('-','_'),46 help = help_disable_str )33 if help_str == None: 34 help_str = 'enable ' + name + ' support' 35 if help_disable_str == None: 36 help_disable_str = 'do not ' + help_str 37 ctx.add_option('--enable-' + name, action = 'store_true', 38 default = default, 39 dest = 'enable_' + name.replace('-','_'), 40 help = help_str) 41 ctx.add_option('--disable-' + name, action = 'store_false', 42 #default = default, 43 dest = 'enable_' + name.replace('-','_'), 44 help = help_disable_str ) 47 45 48 46 def options(ctx): 49 add_option_enable_disable(ctx, 'fftw3f', default = False, 50 help_str = 'compile with fftw3f instead of ooura (recommended)', 51 help_disable_str = 'do not compile with fftw3f') 52 add_option_enable_disable(ctx, 'fftw3', default = False, 53 help_str = 'compile with fftw3 instead of ooura', 54 help_disable_str = 'do not compile with fftw3') 55 add_option_enable_disable(ctx, 'complex', default = False, 56 help_str ='compile with C99 complex', 57 help_disable_str = 'do not use C99 complex (default)' ) 58 add_option_enable_disable(ctx, 'jack', default = None, 59 help_str = 'compile with jack (auto)', 60 help_disable_str = 'disable jack support') 61 add_option_enable_disable(ctx, 'sndfile', default = None, 62 help_str = 'compile with sndfile (auto)', 63 help_disable_str = 'disable sndfile') 64 add_option_enable_disable(ctx, 'avcodec', default = None, 65 help_str = 'compile with libavcodec (auto)', 66 help_disable_str = 'disable libavcodec') 67 add_option_enable_disable(ctx, 'samplerate', default = None, 68 help_str = 'compile with samplerate (auto)', 69 help_disable_str = 'disable samplerate') 70 add_option_enable_disable(ctx, 'memcpy', default = True, 71 help_str = 'use memcpy hacks (default)', 72 help_disable_str = 'do not use memcpy hacks') 73 add_option_enable_disable(ctx, 'double', default = False, 74 help_str = 'compile aubio in double precision mode', 75 help_disable_str = 'compile aubio in single precision mode (default)') 76 77 ctx.add_option('--with-target-platform', type='string', 78 help='set target platform for cross-compilation', dest='target_platform') 79 ctx.load('compiler_c') 80 ctx.load('waf_unit_test') 81 ctx.load('gnu_dirs') 47 add_option_enable_disable(ctx, 'fftw3f', default = False, 48 help_str = 'compile with fftw3f instead of ooura (recommended)', 49 help_disable_str = 'do not compile with fftw3f') 50 add_option_enable_disable(ctx, 'fftw3', default = False, 51 help_str = 'compile with fftw3 instead of ooura', 52 help_disable_str = 'do not compile with fftw3') 53 add_option_enable_disable(ctx, 'complex', default = False, 54 help_str ='compile with C99 complex', 55 help_disable_str = 'do not use C99 complex (default)' ) 56 add_option_enable_disable(ctx, 'jack', default = None, 57 help_str = 'compile with jack (auto)', 58 help_disable_str = 'disable jack support') 59 add_option_enable_disable(ctx, 'sndfile', default = None, 60 help_str = 'compile with sndfile (auto)', 61 help_disable_str = 'disable sndfile') 62 add_option_enable_disable(ctx, 'avcodec', default = None, 63 help_str = 'compile with libavcodec (auto)', 64 help_disable_str = 'disable libavcodec') 65 add_option_enable_disable(ctx, 'samplerate', default = None, 66 help_str = 'compile with samplerate (auto)', 67 help_disable_str = 'disable samplerate') 68 add_option_enable_disable(ctx, 'memcpy', default = True, 69 help_str = 'use memcpy hacks (default)', 70 help_disable_str = 'do not use memcpy hacks') 71 add_option_enable_disable(ctx, 'double', default = False, 72 help_str = 'compile in double precision mode', 73 help_disable_str = 'compile in single precision mode (default)') 74 75 ctx.add_option('--with-target-platform', type='string', 76 help='set target platform for cross-compilation', dest='target_platform') 77 78 ctx.load('compiler_c') 79 ctx.load('waf_unit_test') 80 ctx.load('gnu_dirs') 82 81 83 82 def configure(ctx): 84 from waflib import Options85 ctx.load('compiler_c')86 ctx.load('waf_unit_test')87 ctx.load('gnu_dirs')88 ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra', '-fPIC']89 90 target_platform = Options.platform91 if ctx.options.target_platform:92 target_platform = ctx.options.target_platform93 ctx.env['DEST_OS'] = target_platform94 95 if target_platform == 'win32':96 ctx.env['shlib_PATTERN'] = 'lib%s.dll'97 98 if target_platform == 'darwin':99 ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64']100 ctx.env.LINKFLAGS += ['-arch', 'i386', '-arch', 'x86_64']101 ctx.env.FRAMEWORK = ['CoreFoundation', 'AudioToolbox', 'Accelerate']102 ctx.define('HAVE_ACCELERATE', 1)103 104 if target_platform in [ 'ios', 'iosimulator' ]:105 ctx.define('HAVE_ACCELERATE', 1)106 ctx.define('TARGET_OS_IPHONE', 1)107 ctx.env.FRAMEWORK = ['CoreFoundation', 'AudioToolbox', 'Accelerate']108 SDKVER="7.0"109 MINSDKVER="6.1"110 ctx.env.CFLAGS += ['-std=c99']111 if target_platform == 'ios':112 DEVROOT = "/Applications/Xcode.app/Contents"113 DEVROOT += "/Developer/Platforms/iPhoneOS.platform/Developer"114 SDKROOT = "%(DEVROOT)s/SDKs/iPhoneOS%(SDKVER)s.sdk" % locals()115 ctx.env.CFLAGS += [ '-arch', 'arm64' ]116 ctx.env.CFLAGS += [ '-arch', 'armv7' ]117 ctx.env.CFLAGS += [ '-arch', 'armv7s' ]118 ctx.env.LINKFLAGS += [ '-arch', 'arm64' ]119 ctx.env.LINKFLAGS += ['-arch', 'armv7']120 ctx.env.LINKFLAGS += ['-arch', 'armv7s']121 ctx.env.CFLAGS += [ '-miphoneos-version-min=' + MINSDKVER ]122 ctx.env.LINKFLAGS += [ '-miphoneos-version-min=' + MINSDKVER ]123 else:124 DEVROOT = "/Applications/Xcode.app/Contents"125 DEVROOT += "/Developer/Platforms/iPhoneSimulator.platform/Developer"126 SDKROOT = "%(DEVROOT)s/SDKs/iPhoneSimulator%(SDKVER)s.sdk" % locals()127 ctx.env.CFLAGS += [ '-arch', 'i386' ]128 ctx.env.CFLAGS += [ '-arch', 'x86_64' ]129 ctx.env.LINKFLAGS += ['-arch', 'i386']130 ctx.env.LINKFLAGS += ['-arch', 'x86_64']131 ctx.env.CFLAGS += [ '-mios-simulator-version-min=' + MINSDKVER ]132 ctx.env.LINKFLAGS += [ '-mios-simulator-version-min=' + MINSDKVER ]133 ctx.env.CFLAGS += [ '-isysroot' , SDKROOT]134 ctx.env.LINKFLAGS += [ '-isysroot' , SDKROOT]135 136 # check for required headers137 ctx.check(header_name='stdlib.h')138 ctx.check(header_name='stdio.h')139 ctx.check(header_name='math.h')140 ctx.check(header_name='string.h')141 ctx.check(header_name='limits.h')142 143 # check support for C99 __VA_ARGS__ macros144 check_c99_varargs = '''83 from waflib import Options 84 ctx.load('compiler_c') 85 ctx.load('waf_unit_test') 86 ctx.load('gnu_dirs') 87 ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra', '-fPIC'] 88 89 target_platform = Options.platform 90 if ctx.options.target_platform: 91 target_platform = ctx.options.target_platform 92 ctx.env['DEST_OS'] = target_platform 93 94 if target_platform == 'win32': 95 ctx.env['shlib_PATTERN'] = 'lib%s.dll' 96 97 if target_platform == 'darwin': 98 ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64'] 99 ctx.env.LINKFLAGS += ['-arch', 'i386', '-arch', 'x86_64'] 100 ctx.env.FRAMEWORK = ['CoreFoundation', 'AudioToolbox', 'Accelerate'] 101 ctx.define('HAVE_ACCELERATE', 1) 102 103 if target_platform in [ 'ios', 'iosimulator' ]: 104 ctx.define('HAVE_ACCELERATE', 1) 105 ctx.define('TARGET_OS_IPHONE', 1) 106 ctx.env.FRAMEWORK = ['CoreFoundation', 'AudioToolbox', 'Accelerate'] 107 SDKVER="7.0" 108 MINSDKVER="6.1" 109 ctx.env.CFLAGS += ['-std=c99'] 110 if target_platform == 'ios': 111 DEVROOT = "/Applications/Xcode.app/Contents" 112 DEVROOT += "/Developer/Platforms/iPhoneOS.platform/Developer" 113 SDKROOT = "%(DEVROOT)s/SDKs/iPhoneOS%(SDKVER)s.sdk" % locals() 114 ctx.env.CFLAGS += [ '-arch', 'arm64' ] 115 ctx.env.CFLAGS += [ '-arch', 'armv7' ] 116 ctx.env.CFLAGS += [ '-arch', 'armv7s' ] 117 ctx.env.LINKFLAGS += [ '-arch', 'arm64' ] 118 ctx.env.LINKFLAGS += ['-arch', 'armv7'] 119 ctx.env.LINKFLAGS += ['-arch', 'armv7s'] 120 ctx.env.CFLAGS += [ '-miphoneos-version-min=' + MINSDKVER ] 121 ctx.env.LINKFLAGS += [ '-miphoneos-version-min=' + MINSDKVER ] 122 else: 123 DEVROOT = "/Applications/Xcode.app/Contents" 124 DEVROOT += "/Developer/Platforms/iPhoneSimulator.platform/Developer" 125 SDKROOT = "%(DEVROOT)s/SDKs/iPhoneSimulator%(SDKVER)s.sdk" % locals() 126 ctx.env.CFLAGS += [ '-arch', 'i386' ] 127 ctx.env.CFLAGS += [ '-arch', 'x86_64' ] 128 ctx.env.LINKFLAGS += ['-arch', 'i386'] 129 ctx.env.LINKFLAGS += ['-arch', 'x86_64'] 130 ctx.env.CFLAGS += [ '-mios-simulator-version-min=' + MINSDKVER ] 131 ctx.env.LINKFLAGS += [ '-mios-simulator-version-min=' + MINSDKVER ] 132 ctx.env.CFLAGS += [ '-isysroot' , SDKROOT] 133 ctx.env.LINKFLAGS += [ '-isysroot' , SDKROOT] 134 135 # check for required headers 136 ctx.check(header_name='stdlib.h') 137 ctx.check(header_name='stdio.h') 138 ctx.check(header_name='math.h') 139 ctx.check(header_name='string.h') 140 ctx.check(header_name='limits.h') 141 142 # check support for C99 __VA_ARGS__ macros 143 check_c99_varargs = ''' 145 144 #include <stdio.h> 146 145 #define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__) 147 146 ''' 148 if ctx.check_cc(fragment = check_c99_varargs, 149 type='cstlib', 150 msg = 'Checking for C99 __VA_ARGS__ macro'): 151 ctx.define('HAVE_C99_VARARGS_MACROS', 1) 152 153 # optionally use complex.h 154 if (ctx.options.enable_complex == True): 155 ctx.check(header_name='complex.h') 156 157 # check dependencies 158 if (ctx.options.enable_sndfile != False): 159 ctx.check_cfg(package = 'sndfile', atleast_version = '1.0.4', 160 args = '--cflags --libs', mandatory = False) 161 if (ctx.options.enable_samplerate != False): 162 ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15', 163 args = '--cflags --libs', mandatory = False) 164 165 # double precision mode 166 if (ctx.options.enable_double == True): 167 ctx.define('HAVE_AUBIO_DOUBLE', 1) 168 else: 169 ctx.define('HAVE_AUBIO_DOUBLE', 0) 170 171 # optional dependancies using pkg-config 172 if (ctx.options.enable_fftw3 != False or ctx.options.enable_fftw3f != False): 173 # one of fftwf or fftw3f 174 if (ctx.options.enable_fftw3f != False): 175 ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0', 176 args = '--cflags --libs', mandatory = False) 177 if (ctx.options.enable_double == True): 178 ctx.msg('Warning', 'fftw3f enabled, but compiling in double precision!') 147 148 if ctx.check_cc(fragment = check_c99_varargs, 149 type='cstlib', 150 msg = 'Checking for C99 __VA_ARGS__ macro'): 151 ctx.define('HAVE_C99_VARARGS_MACROS', 1) 152 153 # double precision mode 154 if (ctx.options.enable_double == True): 155 ctx.define('HAVE_AUBIO_DOUBLE', 1) 179 156 else: 180 # fftw3f not enabled, take most sensible one according to enable_double 181 if (ctx.options.enable_double == True): 182 ctx.check_cfg(package = 'fftw3', atleast_version = '3.0.0', 183 args = '--cflags --libs', mandatory = False) 184 else: 185 ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0', 186 args = '--cflags --libs', mandatory = False) 187 ctx.define('HAVE_FFTW3', 1) 188 189 # fftw disabled, use ooura 190 if 'HAVE_FFTW3F' in ctx.env.define_key: 191 ctx.msg('Checking for FFT implementation', 'fftw3f') 192 elif 'HAVE_FFTW3' in ctx.env.define_key: 193 ctx.msg('Checking for FFT implementation', 'fftw3') 194 elif 'HAVE_ACCELERATE' in ctx.env.define_key: 195 ctx.msg('Checking for FFT implementation', 'vDSP') 196 else: 197 ctx.msg('Checking for FFT implementation', 'ooura') 198 199 # use memcpy hacks 200 if (ctx.options.enable_memcpy == True): 201 ctx.define('HAVE_MEMCPY_HACKS', 1) 202 else: 203 ctx.define('HAVE_MEMCPY_HACKS', 0) 204 205 if (ctx.options.enable_jack != False): 206 ctx.check_cfg(package = 'jack', atleast_version = '0.15.0', 207 args = '--cflags --libs', mandatory = False) 208 209 if (ctx.options.enable_avcodec != False): 210 ctx.check_cfg(package = 'libavcodec', atleast_version = '54.35.0', 211 args = '--cflags --libs', uselib_store = 'AVCODEC', mandatory = False) 212 ctx.check_cfg(package = 'libavformat', atleast_version = '52.3.0', 213 args = '--cflags --libs', uselib_store = 'AVFORMAT', mandatory = False) 214 ctx.check_cfg(package = 'libavutil', atleast_version = '52.3.0', 215 args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False) 216 ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1', 217 args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False) 218 219 # write configuration header 220 ctx.write_config_header('src/config.h') 221 222 # add some defines used in examples 223 ctx.define('AUBIO_PREFIX', ctx.env['PREFIX']) 224 ctx.define('PACKAGE', APPNAME) 225 226 # check if txt2man is installed, optional 227 try: 228 ctx.find_program('txt2man', var='TXT2MAN') 229 except ctx.errors.ConfigurationError: 230 ctx.to_log('txt2man was not found (ignoring)') 157 ctx.define('HAVE_AUBIO_DOUBLE', 0) 158 159 # optionally use complex.h 160 if (ctx.options.enable_complex == True): 161 ctx.check(header_name='complex.h') 162 163 # check for fftw3 164 if (ctx.options.enable_fftw3 != False or ctx.options.enable_fftw3f != False): 165 # one of fftwf or fftw3f 166 if (ctx.options.enable_fftw3f != False): 167 ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0', 168 args = '--cflags --libs', mandatory = False) 169 if (ctx.options.enable_double == True): 170 ctx.msg('Warning', 'fftw3f enabled, but compiling in double precision!') 171 else: 172 # fftw3f not enabled, take most sensible one according to enable_double 173 if (ctx.options.enable_double == True): 174 ctx.check_cfg(package = 'fftw3', atleast_version = '3.0.0', 175 args = '--cflags --libs', mandatory = False) 176 else: 177 ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0', 178 args = '--cflags --libs', mandatory = False) 179 ctx.define('HAVE_FFTW3', 1) 180 181 # fftw not enabled, use vDSP or ooura 182 if 'HAVE_FFTW3F' in ctx.env.define_key: 183 ctx.msg('Checking for FFT implementation', 'fftw3f') 184 elif 'HAVE_FFTW3' in ctx.env.define_key: 185 ctx.msg('Checking for FFT implementation', 'fftw3') 186 elif 'HAVE_ACCELERATE' in ctx.env.define_key: 187 ctx.msg('Checking for FFT implementation', 'vDSP') 188 else: 189 ctx.msg('Checking for FFT implementation', 'ooura') 190 191 # check for libsndfile 192 if (ctx.options.enable_sndfile != False): 193 ctx.check_cfg(package = 'sndfile', atleast_version = '1.0.4', 194 args = '--cflags --libs', mandatory = False) 195 196 # check for libsamplerate 197 if (ctx.options.enable_samplerate != False): 198 ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15', 199 args = '--cflags --libs', mandatory = False) 200 201 # check for jack 202 if (ctx.options.enable_jack != False): 203 ctx.check_cfg(package = 'jack', atleast_version = '0.15.0', 204 args = '--cflags --libs', mandatory = False) 205 206 # check for libav 207 if (ctx.options.enable_avcodec != False): 208 ctx.check_cfg(package = 'libavcodec', atleast_version = '54.35.0', 209 args = '--cflags --libs', uselib_store = 'AVCODEC', mandatory = False) 210 ctx.check_cfg(package = 'libavformat', atleast_version = '52.3.0', 211 args = '--cflags --libs', uselib_store = 'AVFORMAT', mandatory = False) 212 ctx.check_cfg(package = 'libavutil', atleast_version = '52.3.0', 213 args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False) 214 ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1', 215 args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False) 216 217 # use memcpy hacks 218 if (ctx.options.enable_memcpy == True): 219 ctx.define('HAVE_MEMCPY_HACKS', 1) 220 else: 221 ctx.define('HAVE_MEMCPY_HACKS', 0) 222 223 # write configuration header 224 ctx.write_config_header('src/config.h') 225 226 # add some defines used in examples 227 ctx.define('AUBIO_PREFIX', ctx.env['PREFIX']) 228 ctx.define('PACKAGE', APPNAME) 229 230 # check if txt2man is installed, optional 231 try: 232 ctx.find_program('txt2man', var='TXT2MAN') 233 except ctx.errors.ConfigurationError: 234 ctx.to_log('txt2man was not found (ignoring)') 231 235 232 236 def build(bld): … … 256 260 name = 'txt2man', 257 261 rule = rule_str, 258 #rule = '${TXT2MAN} -p -P aubio -s 1 -r aubio-0.4.0 ${SRC} > ${TGT}',259 262 ext_in = '.txt', 260 263 ext_out = '.1', … … 282 285 ctx.excl += ' **/python/gen **/python/build **/python/dist' 283 286 ctx.excl += ' **/**.zip **/**.tar.bz2' 284 ctx.excl += ' **/doc/full/* '287 ctx.excl += ' **/doc/full/* **/doc/web/*' 285 288 ctx.excl += ' **/python/*.db' 286 289 ctx.excl += ' **/python.old/*'
Note: See TracChangeset
for help on using the changeset viewer.