- Timestamp:
- Jul 10, 2012, 1:06:11 AM (12 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:
- dbf47c6
- Parents:
- f4493f4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wscript
rf4493f4 rd41bc4d 31 31 out = 'build' 32 32 33 def init(opt): 34 pass 35 36 def options(opt): 37 opt.add_option('--enable-double', action='store_true', default=False, 33 def options(ctx): 34 ctx.add_option('--enable-double', action='store_true', default=False, 38 35 help='compile aubio in double precision mode') 39 opt.add_option('--enable-fftw', action='store_true', default=False,36 ctx.add_option('--enable-fftw', action='store_true', default=False, 40 37 help='compile with ooura instead of fftw') 41 opt.add_option('--enable-fftw3f', action='store_true', default=False,38 ctx.add_option('--enable-fftw3f', action='store_true', default=False, 42 39 help='compile with fftw3 instead of fftw3f') 43 opt.add_option('--enable-complex', action='store_true', default=False,40 ctx.add_option('--enable-complex', action='store_true', default=False, 44 41 help='compile with C99 complex') 45 opt.add_option('--enable-jack', action='store_true', default=False,42 ctx.add_option('--enable-jack', action='store_true', default=False, 46 43 help='compile with jack support') 47 opt.add_option('--enable-lash', action='store_true', default=False,44 ctx.add_option('--enable-lash', action='store_true', default=False, 48 45 help='compile with lash support') 49 opt.add_option('--enable-sndfile', action='store_true', default=False,46 ctx.add_option('--enable-sndfile', action='store_true', default=False, 50 47 help='compile with libsndfile support') 51 opt.add_option('--enable-samplerate', action='store_true', default=False,48 ctx.add_option('--enable-samplerate', action='store_true', default=False, 52 49 help='compile with libsamplerate support') 53 opt.add_option('--enable-swig', action='store_true', default=False,50 ctx.add_option('--enable-swig', action='store_true', default=False, 54 51 help='compile with swig support (obsolete)') 55 opt.add_option('--with-target-platform', type='string',52 ctx.add_option('--with-target-platform', type='string', 56 53 help='set target platform for cross-compilation', dest='target_platform') 57 opt.load('compiler_c')58 opt.load('compiler_cxx')59 opt.load('gnu_dirs')60 opt.load('waf_unit_test')61 62 def configure(c onf):54 ctx.load('compiler_c') 55 ctx.load('compiler_cxx') 56 ctx.load('gnu_dirs') 57 ctx.load('waf_unit_test') 58 59 def configure(ctx): 63 60 import Options 64 c onf.check_tool('compiler_c')65 c onf.check_tool('compiler_cxx')66 c onf.check_tool('gnu_dirs') # helpful for autotools transition and .pc generation67 #c onf.check_tool('misc') # needed for subst68 c onf.load('waf_unit_test')61 ctx.check_tool('compiler_c') 62 ctx.check_tool('compiler_cxx') 63 ctx.check_tool('gnu_dirs') # helpful for autotools transition and .pc generation 64 #ctx.check_tool('misc') # needed for subst 65 ctx.load('waf_unit_test') 69 66 70 67 if Options.options.target_platform: … … 72 69 73 70 if Options.platform == 'win32': 74 c onf.env['shlib_PATTERN'] = 'lib%s.dll'71 ctx.env['shlib_PATTERN'] = 'lib%s.dll' 75 72 76 73 # check for required headers 77 c onf.check(header_name='stdlib.h')78 c onf.check(header_name='stdio.h')79 c onf.check(header_name='math.h')80 c onf.check(header_name='string.h')81 c onf.check(header_name='limits.h')74 ctx.check(header_name='stdlib.h') 75 ctx.check(header_name='stdio.h') 76 ctx.check(header_name='math.h') 77 ctx.check(header_name='string.h') 78 ctx.check(header_name='limits.h') 82 79 83 80 # optionally use complex.h 84 81 if (Options.options.enable_complex == True): 85 c onf.check(header_name='complex.h')82 ctx.check(header_name='complex.h') 86 83 87 84 # check dependencies 88 85 if (Options.options.enable_sndfile == True): 89 c onf.check_cfg(package = 'sndfile', atleast_version = '1.0.4',86 ctx.check_cfg(package = 'sndfile', atleast_version = '1.0.4', 90 87 args = '--cflags --libs') 91 88 if (Options.options.enable_samplerate == True): 92 c onf.check_cfg(package = 'samplerate', atleast_version = '0.0.15',89 ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15', 93 90 args = '--cflags --libs') 94 91 95 92 # double precision mode 96 93 if (Options.options.enable_double == True): 97 c onf.define('HAVE_AUBIO_DOUBLE', 1)94 ctx.define('HAVE_AUBIO_DOUBLE', 1) 98 95 else: 99 c onf.define('HAVE_AUBIO_DOUBLE', 0)96 ctx.define('HAVE_AUBIO_DOUBLE', 0) 100 97 101 98 # check if pkg-config is installed, optional 102 99 try: 103 c onf.find_program('pkg-config', var='PKGCONFIG')104 except c onf.errors.ConfigurationError:105 c onf.msg('Could not find pkg-config', 'disabling fftw, jack, and lash')106 c onf.msg('Could not find fftw', 'using ooura')100 ctx.find_program('pkg-config', var='PKGCONFIG') 101 except ctx.errors.ConfigurationError: 102 ctx.msg('Could not find pkg-config', 'disabling fftw, jack, and lash') 103 ctx.msg('Could not find fftw', 'using ooura') 107 104 108 105 # optional dependancies using pkg-config 109 if c onf.env['PKGCONFIG']:106 if ctx.env['PKGCONFIG']: 110 107 111 108 if (Options.options.enable_fftw == True or Options.options.enable_fftw3f == True): 112 109 # one of fftwf or fftw3f 113 110 if (Options.options.enable_fftw3f == True): 114 c onf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',111 ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0', 115 112 args = '--cflags --libs') 116 113 if (Options.options.enable_double == True): 117 c onf.msg('Warning', 'fftw3f enabled, but aubio compiled in double precision!')114 ctx.msg('Warning', 'fftw3f enabled, but aubio compiled in double precision!') 118 115 else: 119 116 # fftw3f not enabled, take most sensible one according to enable_double 120 117 if (Options.options.enable_double == True): 121 c onf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',118 ctx.check_cfg(package = 'fftw3', atleast_version = '3.0.0', 122 119 args = '--cflags --libs') 123 120 else: 124 c onf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',121 ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0', 125 122 args = '--cflags --libs') 126 c onf.define('HAVE_FFTW3', 1)123 ctx.define('HAVE_FFTW3', 1) 127 124 else: 128 125 # fftw disabled, use ooura 129 c onf.msg('Fftw disabled', 'using ooura')126 ctx.msg('Fftw disabled', 'using ooura') 130 127 pass 131 128 132 129 if (Options.options.enable_jack == True): 133 c onf.check_cfg(package = 'jack', atleast_version = '0.15.0',130 ctx.check_cfg(package = 'jack', atleast_version = '0.15.0', 134 131 args = '--cflags --libs') 135 132 136 133 if (Options.options.enable_lash == True): 137 c onf.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',134 ctx.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0', 138 135 args = '--cflags --libs', uselib_store = 'LASH') 139 136 … … 141 138 if (Options.options.enable_swig == True): 142 139 try: 143 c onf.find_program('swig', var='SWIG')144 except c onf.errors.ConfigurationError:145 c onf.to_log('swig was not found, not looking for (ignoring)')146 147 if c onf.env['SWIG']:148 c onf.check_tool('swig')149 c onf.check_swig_version()140 ctx.find_program('swig', var='SWIG') 141 except ctx.errors.ConfigurationError: 142 ctx.to_log('swig was not found, not looking for (ignoring)') 143 144 if ctx.env['SWIG']: 145 ctx.check_tool('swig') 146 ctx.check_swig_version() 150 147 151 148 # python 152 if c onf.find_program('python'):153 c onf.check_tool('python')154 c onf.check_python_version((2,4,2))155 c onf.check_python_headers()149 if ctx.find_program('python'): 150 ctx.check_tool('python') 151 ctx.check_python_version((2,4,2)) 152 ctx.check_python_headers() 156 153 157 154 # check support for C99 __VA_ARGS__ macros … … 160 157 #define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__) 161 158 ''' 162 if c onf.check_cc(fragment = check_c99_varargs,159 if ctx.check_cc(fragment = check_c99_varargs, 163 160 type='cstlib', 164 161 msg = 'Checking for C99 __VA_ARGS__ macro'): 165 c onf.define('HAVE_C99_VARARGS_MACROS', 1)162 ctx.define('HAVE_C99_VARARGS_MACROS', 1) 166 163 167 164 # write configuration header 168 c onf.write_config_header('src/config.h')165 ctx.write_config_header('src/config.h') 169 166 170 167 # add some defines used in examples 171 c onf.define('AUBIO_PREFIX', conf.env['PREFIX'])172 c onf.define('PACKAGE', APPNAME)168 ctx.define('AUBIO_PREFIX', ctx.env['PREFIX']) 169 ctx.define('PACKAGE', APPNAME) 173 170 174 171 # check if docbook-to-man is installed, optional 175 172 try: 176 c onf.find_program('docbook-to-man', var='DOCBOOKTOMAN')177 except c onf.errors.ConfigurationError:178 c onf.to_log('docbook-to-man was not found (ignoring)')179 180 def build( bld):181 bld.env['VERSION'] = VERSION182 bld.env['LIB_VERSION'] = LIB_VERSION173 ctx.find_program('docbook-to-man', var='DOCBOOKTOMAN') 174 except ctx.errors.ConfigurationError: 175 ctx.to_log('docbook-to-man was not found (ignoring)') 176 177 def build(ctx): 178 ctx.env['VERSION'] = VERSION 179 ctx.env['LIB_VERSION'] = LIB_VERSION 183 180 184 181 # add sub directories 185 bld.add_subdirs('src examples')186 if bld.env['SWIG']:187 if bld.env['PYTHON']:188 bld.add_subdirs('python')182 ctx.add_subdirs('src examples') 183 if ctx.env['SWIG']: 184 if ctx.env['PYTHON']: 185 ctx.add_subdirs('python') 189 186 190 187 # create the aubio.pc file for pkg-config 191 if bld.env['TARGET_PLATFORM'] == 'linux':192 aubiopc = bld.new_task_gen('subst')188 if ctx.env['TARGET_PLATFORM'] == 'linux': 189 aubiopc = ctx.new_task_gen('subst') 193 190 aubiopc.source = 'aubio.pc.in' 194 191 aubiopc.target = 'aubio.pc' … … 196 193 197 194 # build manpages from sgml files 198 if bld.env['DOCBOOKTOMAN']:195 if ctx.env['DOCBOOKTOMAN']: 199 196 import TaskGen 200 197 TaskGen.declare_chain( … … 205 202 reentrant = 0, 206 203 ) 207 manpages = bld.new_task_gen(name = 'docbooktoman',208 source= bld.path.ant_glob('doc/*.sgml'))209 bld.install_files('${MANDIR}/man1', bld.path.ant_glob('doc/*.1'))204 manpages = ctx.new_task_gen(name = 'docbooktoman', 205 source=ctx.path.ant_glob('doc/*.sgml')) 206 ctx.install_files('${MANDIR}/man1', ctx.path.ant_glob('doc/*.1')) 210 207 211 208 # install woodblock sound 212 bld.install_files('${PREFIX}/share/sounds/aubio/',209 ctx.install_files('${PREFIX}/share/sounds/aubio/', 213 210 'sounds/woodblock.aiff') 214 211 215 212 # build and run the unit tests 216 build_tests( bld)217 218 def shutdown( bld):213 build_tests(ctx) 214 215 def shutdown(ctx): 219 216 pass 220 217 221 218 # loop over all *.c filenames in tests/src to build them all 222 219 # target name is filename.c without the .c 223 def build_tests( bld):224 for target_name in bld.path.ant_glob('tests/src/**/*.c'):220 def build_tests(ctx): 221 for target_name in ctx.path.ant_glob('tests/src/**/*.c'): 225 222 includes = ['src'] 226 223 uselib = [] … … 231 228 else: 232 229 # phasevoc-jack needs jack 233 if bld.env['JACK']:230 if ctx.env['JACK']: 234 231 includes = ['examples'] 235 232 uselib = ['JACK'] … … 238 235 continue 239 236 240 this_target = bld.new_task_gen(237 this_target = ctx.new_task_gen( 241 238 features = 'c cprogram test', 242 239 uselib = uselib,
Note: See TracChangeset
for help on using the changeset viewer.