fix crash when copy'ing latent plugins
[ardour.git] / libs / audiographer / wscript
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 from waflib.extras import autowaf as autowaf
4 import os
5
6 # Version of this package (even if built as a child)
7 AUDIOGRAPHER_VERSION = '0.0.0'
8
9 # Library version (UNIX style major, minor, micro)
10 # major increment <=> incompatible changes
11 # minor increment <=> compatible changes (additions)
12 # micro increment <=> no interface changes
13 # Version history:
14 #   0.0.0 = 0,0,0
15 AUDIOGRAPHER_LIB_VERSION = '0.0.0'
16
17 # Variables for 'waf dist'
18 APPNAME = 'audiographer'
19 VERSION = AUDIOGRAPHER_VERSION
20
21 # Mandatory variables
22 top = '.'
23 out = 'build'
24
25 def options(opt):
26     autowaf.set_options(opt)
27
28 def configure(conf):
29     conf.load('compiler_cxx')
30     autowaf.configure(conf)
31
32     autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
33     autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0', mandatory=False)
34     autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2', mandatory=False)
35     autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0', mandatory=False)
36     autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.14.0', mandatory=False)
37     autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE', atleast_version='0.1.7', mandatory=False)
38     autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18', mandatory=False)
39     autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F', mandatory=True)
40     autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW35F', atleast_version='3.3.5', mandatory=False)
41
42     # Boost headers
43     autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
44     autowaf.check_header(conf, 'cxx', 'boost/format.hpp')
45
46 def build(bld):
47
48     # Headers
49     #bld.install_files('${INCLUDEDIR}/audiographer', bld.path.ant_glob('audiographer/*.h'))
50     #bld.install_files('${INCLUDEDIR}/audiographer/general', bld.path.ant_glob('audiographer/general/*.h'))
51     #bld.install_files('${INCLUDEDIR}/audiographer/sndfile', bld.path.ant_glob('audiographer/sndfile/*.h'))
52     #bld.install_files('${INCLUDEDIR}/audiographer/utils', bld.path.ant_glob('audiographer/utils/*.h'))
53
54     #bld.env['BUILD_TESTS'] = True
55     bld.env['HAVE_ALL_GTHREAD'] = (bld.is_defined('HAVE_GLIB')
56                                    and bld.is_defined('HAVE_GLIBMM')
57                                    and bld.is_defined('HAVE_GTHREAD'))
58
59     if bld.is_defined('HAVE_FFTW35F') and bld.env['build_target'] != 'mingw':
60         bld.env['LIB_FFTW3F'] += ['fftw3f_threads']
61
62     audiographer_sources = [
63         'private/gdither/gdither.cc',
64         'src/general/sample_format_converter.cc',
65         'src/routines.cc',
66         'src/debug_utils.cc',
67         'src/general/analyser.cc',
68         'src/general/broadcast_info.cc',
69         'src/general/loudness_reader.cc',
70         'src/general/normalizer.cc'
71         ]
72     if bld.is_defined('HAVE_SAMPLERATE'):
73         audiographer_sources += [ 'src/general/sr_converter.cc' ]
74
75     if bld.is_defined ('INTERNAL_SHARED_LIBS'):
76         audiographer              = bld.shlib(features = 'c cxx cshlib cxxshlib', source=audiographer_sources)
77         # macros for this shared library
78         audiographer.defines      = [ 'LIBAUDIOGRAPHER_DLL_EXPORTS=1' ]
79     else:
80         audiographer              = bld.stlib(features = 'c cxx cstlib cxxstlib', source=audiographer_sources)
81         audiographer.cxxflags     = [ '-fPIC' ]
82         audiographer.cflags       = [ '-fPIC' ]
83         audiographer.defines      = []
84
85     audiographer.name           = 'libaudiographer'
86     audiographer.target         = 'audiographer'
87     audiographer.export_includes = ['.', './src']
88     audiographer.includes       = ['.', './src','../ardour','../timecode','../evoral']
89     audiographer.uselib         = 'GLIB GLIBMM GTHREAD SAMPLERATE SNDFILE FFTW3F VAMPSDK VAMPHOSTSDK XML'
90     audiographer.use            = 'libpbd'
91     audiographer.vnum           = AUDIOGRAPHER_LIB_VERSION
92     audiographer.install_path   = bld.env['LIBDIR']
93
94
95     if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
96         # Unit tests
97         obj              = bld(features = 'cxx cxxprogram')
98         obj.source       = '''
99                 tests/test_runner.cc
100                 tests/type_utils_test.cc
101                 tests/utils/identity_vertex_test.cc
102                 tests/general/interleaver_test.cc
103                 tests/general/deinterleaver_test.cc
104                 tests/general/interleaver_deinterleaver_test.cc
105                 tests/general/chunker_test.cc
106                 tests/general/sample_format_converter_test.cc
107                 tests/general/peak_reader_test.cc
108                 tests/general/normalizer_test.cc
109                 tests/general/silence_trimmer_test.cc
110         '''
111
112         if bld.is_defined('HAVE_ALL_GTHREAD'):
113             obj.source += '''
114                     tests/general/threader_test.cc
115             '''
116
117         if bld.is_defined('HAVE_SNDFILE'):
118             obj.source += '''
119                     tests/sndfile/tmp_file_test.cc
120             '''
121
122         if bld.is_defined('HAVE_SAMPLERATE'):
123             obj.source += '''
124                     tests/general/sr_converter_test.cc
125             '''
126
127         obj.use          = 'libaudiographer'
128         obj.uselib       = 'CPPUNIT GLIBMM SAMPLERATE SNDFILE FFTW3F VAMPSDK VAMPHOSTSDK'
129         obj.target       = 'run-tests'
130         obj.install_path = ''
131
132 def shutdown():
133     autowaf.shutdown()