973dd97071ea5e624182d8a9cb01f641cbc3922d
[pd-aubio.git] / wscript
1 #! /usr/bin/python
2 # build puredata external
3
4 srcdir = '.'
5 blddir = 'build'
6
7 def set_options(opt):
8   opt.tool_options('compiler_cc')
9
10 def configure(conf):
11   conf.check_tool('compiler_cc')
12   # required dependancies
13   conf.check_cfg(package = 'aubio', atleast_version = '0.4.0',
14     args = '--cflags --libs')
15
16 def build(bld):
17     aubio_pd = bld.new_task_gen(
18         features = 'cc cshlib',
19         uselib = ['AUBIO'],
20         defines = ['PD'],
21         install_path = '${PREFIX}/lib/pd/extra')
22
23     if bld.env['DEST_OS'] == 'win32':
24         aubio_pd.target = 'aubio.dll'
25         # do not use -fPIC -DPIC on windows
26         aubio_pd.env.shlib_CCFLAGS.remove('-fPIC')
27         aubio_pd.env.shlib_CCFLAGS.remove('-DPIC')
28         aubio_pd.env.append_unique('shlib_LINKFLAGS', ['-export_dynamic', '-lpd'])
29     elif bld.env['DEST_OS'] == 'darwin':
30         aubio_pd.target = 'aubio.pd_darwin'
31         aubio_pd.env.append_unique('shlib_LINKFLAGS', 
32             ['-bundle', '-undefined suppres', '-flat_namespace'])
33     else: #if bld.env['DEST_OS'] == 'linux':
34         aubio_pd.target = 'aubio.pd_linux'
35         aubio_pd.env.append_unique('shlib_LINKFLAGS', ['--export_dynamic'])
36
37     # do not rename the shlib at all
38     aubio_pd.env.shlib_PATTERN = '%s'
39     # get the source files
40     aubio_pd.find_sources_in_dirs('.')
41
42     bld.install_files('${PREFIX}/lib/pd/doc/5.reference', 'help/*.pd')
43
44     bld.install_files('${PREFIX}/lib/pd/doc/aubio', 'examples/*.pd')