Apply patch from timbyr to fix building with --test.
[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
40     # Boost headers
41     autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
42     autowaf.check_header(conf, 'cxx', 'boost/format.hpp')
43
44 def build(bld):
45
46     # Headers
47     #bld.install_files('${INCLUDEDIR}/audiographer', bld.path.ant_glob('audiographer/*.h'))
48     #bld.install_files('${INCLUDEDIR}/audiographer/general', bld.path.ant_glob('audiographer/general/*.h'))
49     #bld.install_files('${INCLUDEDIR}/audiographer/sndfile', bld.path.ant_glob('audiographer/sndfile/*.h'))
50     #bld.install_files('${INCLUDEDIR}/audiographer/utils', bld.path.ant_glob('audiographer/utils/*.h'))
51
52     #bld.env['BUILD_TESTS'] = True
53     bld.env['HAVE_ALL_GTHREAD'] = (bld.is_defined('HAVE_GLIB')
54                                    and bld.is_defined('HAVE_GLIBMM')
55                                    and bld.is_defined('HAVE_GTHREAD'))
56
57     audiographer = bld(features = 'cxx cxxshlib')
58     audiographer.source = '''
59             private/gdither/gdither.cc
60             src/general/sample_format_converter.cc
61             src/routines.cc
62             src/debug_utils.cc
63             src/general/broadcast_info.cc
64     '''
65
66     if bld.is_defined('HAVE_SAMPLERATE'):
67         audiographer.source += '''
68                 src/general/sr_converter.cc
69         '''
70
71     audiographer.name           = 'libaudiographer'
72     audiographer.target         = 'audiographer'
73     audiographer.export_includes = ['.', './src']
74     audiographer.includes       = ['.', './src']
75     audiographer.uselib         = 'GLIB GLIBMM GTHREAD SAMPLERATE SNDFILE'
76     audiographer.use            = 'libpbd'
77     audiographer.vnum           = AUDIOGRAPHER_LIB_VERSION
78     audiographer.install_path   = os.path.join(bld.env['LIBDIR'], 'ardour3')
79
80
81     if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
82         # Unit tests
83         obj              = bld(features = 'cxx cxxprogram')
84         obj.source       = '''
85                 tests/test_runner.cc
86                 tests/type_utils_test.cc
87                 tests/utils/identity_vertex_test.cc
88                 tests/general/interleaver_test.cc
89                 tests/general/deinterleaver_test.cc
90                 tests/general/interleaver_deinterleaver_test.cc
91                 tests/general/chunker_test.cc
92                 tests/general/sample_format_converter_test.cc
93                 tests/general/peak_reader_test.cc
94                 tests/general/normalizer_test.cc
95                 tests/general/silence_trimmer_test.cc
96         '''
97
98         if bld.is_defined('HAVE_ALL_GTHREAD'):
99             obj.source += '''
100                     tests/general/threader_test.cc
101             '''
102
103         if bld.is_defined('HAVE_SNDFILE'):
104             obj.source += '''
105                     tests/sndfile/tmp_file_test.cc
106             '''
107
108         if bld.is_defined('HAVE_SAMPLERATE'):
109             obj.source += '''
110                     tests/general/sr_converter_test.cc
111             '''
112
113         obj.use          = 'libaudiographer'
114         obj.uselib       = 'CPPUNIT GLIBMM'
115         obj.target       = 'run-tests'
116         obj.install_path = ''
117
118 def shutdown():
119     autowaf.shutdown()