0a7d72a401f0a2eeed790c125b09c80aabfb198b
[aubio.git] / src / wscript_build
1 # vim:set syntax=python:
2
3 uselib = []
4 uselib += ['M']
5 uselib += ['FFTW3', 'FFTW3F']
6 uselib += ['SAMPLERATE']
7 uselib += ['SNDFILE']
8 uselib += ['AVCODEC']
9 uselib += ['AVFORMAT']
10 uselib += ['SWRESAMPLE']
11 uselib += ['AVRESAMPLE']
12 uselib += ['AVUTIL']
13 uselib += ['BLAS']
14
15 source = ctx.path.ant_glob('*.c **/*.c')
16
17 ctx(features = 'c',
18         source = source,
19         includes = ['.'],
20         use = uselib,
21         target = 'lib_objects')
22
23 # build libaubio.so (cshlib) and/or libaubio.a (cstlib)
24 if ctx.env['DEST_OS'] in ['ios', 'iosimulator']:
25     build_features = ['cstlib', 'cshlib']
26 elif ctx.env['DEST_OS'] in ['win32', 'win64']:
27     build_features = ['cstlib', 'cshlib']
28 elif ctx.env['DEST_OS'] in ['emscripten']:
29     build_features = ['cstlib']
30 elif '--static' in ctx.env['LDFLAGS'] or '--static' in ctx.env['LINKFLAGS']:
31     # static in cflags, ...
32     build_features = ['cstlib']
33 else:
34     # linux, darwin, android, mingw, ...
35     build_features = ['cstlib', 'cshlib']
36
37 # also install static lib
38 from waflib.Tools.c import cstlib
39 from waflib.Tools.fc import fcstlib
40 fcstlib.inst_to = cstlib.inst_to = '${LIBDIR}'
41
42 for target in build_features:
43     ctx(features = 'c ' + target,
44             use = uselib + ['lib_objects'],
45             target = 'aubio',
46             vnum = ctx.env['LIB_VERSION'])
47
48 # install headers, except _priv.h ones
49 ctx.install_files('${INCLUDEDIR}/aubio/',
50         ctx.path.ant_glob('**/*.h', excl = ['**_priv.h', 'config.h']),
51         relative_trick=True)