Skeleton tests for BBT_Time.
[ardour.git] / libs / ardour / wscript
1 #!/usr/bin/env python
2 import autowaf
3 import os
4 import glob
5 import Options
6 import re
7 import subprocess
8 from w18n import build_i18n
9
10 # Version of this package (even if built as a child)
11 MAJOR = '3'
12 MINOR = '0'
13 MICRO = '0'
14 LIBARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
15
16 # Library version (UNIX style major, minor, micro)
17 # major increment <=> incompatible changes
18 # minor increment <=> compatible changes (additions)
19 # micro increment <=> no interface changes
20 LIBARDOUR_LIB_VERSION = '3.0.0'
21
22 # default state file version for this build
23 CURRENT_SESSION_FILE_VERSION = 3000
24
25 # Variables for 'waf dist'
26 APPNAME = 'libardour'
27 VERSION = LIBARDOUR_VERSION
28
29 # Mandatory variables
30 srcdir = '.'
31 blddir = 'build'
32
33 path_prefix = 'libs/ardour/'
34
35 libardour_sources = [
36         'amp.cc',
37         'analyser.cc',
38         'audio_buffer.cc',
39         'audio_diskstream.cc',
40         'audio_library.cc',
41         'audio_playlist.cc',
42         'audio_playlist_importer.cc',
43         'audio_port.cc',
44         'audio_region_importer.cc',
45         'audio_track.cc',
46         'audio_track_importer.cc',
47         'audioanalyser.cc',
48         'audioengine.cc',
49         'audiofile_tagger.cc',
50         'audiofilesource.cc',
51         'audioregion.cc',
52         'audiosource.cc',
53         'auditioner.cc',
54         'automatable.cc',
55         'automation.cc',
56         'automation_control.cc',
57         'automation_list.cc',
58         'bbt_time.cc',
59         'beats_frames_converter.cc',
60         'broadcast_info.cc',
61         'buffer.cc',
62         'buffer_set.cc',
63         'bundle.cc',
64         'butler.cc',
65         'chan_count.cc',
66         'chan_mapping.cc',
67         'configuration.cc',
68         'control_protocol_manager.cc',
69         'control_protocol_search_path.cc',
70         'crossfade.cc',
71         'cycle_timer.cc',
72         'default_click.cc',
73         'delivery.cc',
74         'directory_names.cc',
75         'diskstream.cc',
76         'element_import_handler.cc',
77         'element_importer.cc',
78         'enums.cc',
79         'event_type_map.cc',
80         'export_channel.cc',
81         'export_channel_configuration.cc',
82         'export_file_io.cc',
83         'export_filename.cc',
84         'export_format_base.cc',
85         'export_format_manager.cc',
86         'export_format_specification.cc',
87         'export_formats.cc',
88         'export_handler.cc',
89         'export_preset.cc',
90         'export_processor.cc',
91         'export_profile_manager.cc',
92         'export_status.cc',
93         'export_timespan.cc',
94         'export_utilities.cc',
95         'file_source.cc',
96         'filename_extensions.cc',
97         'filesystem_paths.cc',
98         'filter.cc',
99         'find_session.cc',
100         'gain.cc',
101         'gdither.cc',
102         'globals.cc',
103         'import.cc',
104         'internal_return.cc',
105         'internal_send.cc',
106         'interpolation.cc',
107         'io.cc',
108         'io_processor.cc',
109         'jack_slave.cc',
110         'ladspa_plugin.cc',
111         'location.cc',
112         'location_importer.cc',
113         'meter.cc',
114         'midi_buffer.cc',
115         'midi_clock_slave.cc',
116         'midi_diskstream.cc',
117         'midi_model.cc',
118         'midi_patch_manager.cc',
119         'midi_playlist.cc',
120         'midi_port.cc',
121         'midi_region.cc',
122         'midi_ring_buffer.cc',
123         'midi_source.cc',
124         'midi_state_tracker.cc',
125         'midi_stretch.cc',
126         'midi_track.cc',
127         'mix.cc',
128         'mtc_slave.cc',
129         'mtdm.cc',
130         'mute_master.cc',
131         'named_selection.cc',
132         'onset_detector.cc',
133         'panner.cc',
134         'pcm_utils.cc',
135         'playlist.cc',
136         'playlist_factory.cc',
137         'plugin.cc',
138         'plugin_insert.cc',
139         'plugin_manager.cc',
140         'port.cc',
141         'port_insert.cc',
142         'port_set.cc',
143         'processor.cc',
144         'quantize.cc',
145         'rc_configuration.cc',
146         'recent_sessions.cc',
147         'region.cc',
148         'region_factory.cc',
149         'resampled_source.cc',
150         'return.cc',
151         'reverse.cc',
152         'route.cc',
153         'route_group.cc',
154         'rb_effect.cc',
155         'send.cc',
156         'session.cc',
157         'session_butler.cc',
158         'session_click.cc',
159         'session_command.cc',
160         'session_configuration.cc',
161         'session_directory.cc',
162         'session_events.cc',
163         'session_export.cc',
164         'session_metadata.cc',
165         'session_midi.cc',
166         'session_process.cc',
167         'session_state.cc',
168         'session_state_utils.cc',
169         'session_time.cc',
170         'session_transport.cc',
171         'session_utils.cc',
172         'smf_source.cc',
173         'sndfile_helpers.cc',
174         'sndfileimportable.cc',
175         'sndfilesource.cc',
176         'source.cc',
177         'source_factory.cc',
178         'strip_silence.cc',
179         'svn_revision.cc',
180         'tape_file_matcher.cc',
181         'template_utils.cc',
182         'tempo.cc',
183         'tempo_map_importer.cc',
184         'ticker.cc',
185         'track.cc',
186         'transient_detector.cc',
187         'user_bundle.cc',
188         'utils.cc',
189         'version.cc'
190 ]
191
192 def flac_supported():
193         cmd = subprocess.Popen ("sndfile-info testfile.flac", 
194                                 stdout = subprocess.PIPE,
195                                 stderr = subprocess.STDOUT, shell = True)
196         out = cmd.communicate()[0];
197         return re.search ('unknown format', out) == None
198
199 def ogg_supported():
200         cmd = subprocess.Popen ("sndfile-info testfile.ogg", 
201                                 stdout = subprocess.PIPE,
202                                 stderr = subprocess.STDOUT, shell = True)
203         out = cmd.communicate()[0];
204         return re.search ('unknown format', out) == None
205
206 def set_options(opt):
207         autowaf.set_options(opt)
208
209 def configure(conf):
210         autowaf.build_version_files(path_prefix+'ardour/version.h', path_prefix+'version.cc',
211                         'libardour3', MAJOR, MINOR, MICRO)
212         autowaf.configure(conf)
213         conf.check_tool('compiler_cxx gas')
214         autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', atleast_version='0.3.2')
215         autowaf.check_pkg(conf, 'jack', uselib_store='JACK', atleast_version='0.109.0')
216         autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
217         autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF', atleast_version='0.4.0')
218         autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE', atleast_version='0.1.0')
219         autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
220         autowaf.check_pkg(conf, 'slv2', uselib_store='SLV2', atleast_version='0.6.4', mandatory=False)
221         autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18')
222         autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH', mandatory=False)
223         autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
224         autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
225         autowaf.check_pkg(conf, 'flac', uselib_store='FLAC', atleast_version='1.2.1')
226
227         # we don't try to detect this, since its part of our source tree
228
229         conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
230         conf.define('USE_RUBBERBAND', 1)  # controls whether we actually use it
231
232         conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
233
234         conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H')
235         conf.check(header_name='wordexp.h', define_name='HAVE_WORDEXP')
236         
237         if flac_supported():
238                 conf.define ('HAVE_FLAC', 1)
239                 autowaf.display_msg(conf, 'Checking for FLAC support', True)
240         else:
241                 autowaf.display_msg(conf, 'Checking for FLAC support', False)
242         if ogg_supported():
243                 conf.define ('HAVE_OGG', 1)
244                 autowaf.display_msg(conf, 'Checking for Ogg/Vorbis support', True)
245         else:
246                 autowaf.display_msg(conf, 'Checking for Ogg/Vorbis Support', False)
247
248         conf.write_config_header('libardour-config.h')
249
250         # Boost headers
251         autowaf.check_header(conf, 'boost/shared_ptr.hpp')
252         autowaf.check_header(conf, 'boost/weak_ptr.hpp')
253
254
255 def build(bld):
256         # Library
257         obj              = bld.new_task_gen('cxx', 'shlib')
258         obj.source       = libardour_sources
259         obj.export_incdirs = ['.']
260         obj.includes     = ['.', '../surfaces/control_protocol', '..']
261         obj.name         = 'libardour'
262         obj.target       = 'ardour'
263         obj.uselib       = 'GLIBMM AUBIO SIGCPP XML UUID JACK SNDFILE SAMPLERATE LRDF OSX'
264         obj.uselib_local = 'libpbd libmidipp libevoral libvamphost libvampplugin libtaglib librubberband'
265         obj.vnum         = LIBARDOUR_LIB_VERSION
266         obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
267         obj.cxxflags     = ['-DPACKAGE="libardour3"']
268         obj.cxxflags     += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
269         obj.cxxflags     += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIR']) + '"']
270         obj.cxxflags     += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
271         obj.cxxflags     += ['-DLOCALEDIR="' + os.path.join(
272                         os.path.normpath(bld.env['DATADIR']), 'locale') + '"']
273         obj.cxxflags     += ['-DVAMP_DIR="' + os.path.join(
274                         os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"']
275         #obj.source += ' st_stretch.cc st_pitch.cc '
276         #obj.uselib += ' SOUNDTOUCH '
277         #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
278         
279         obj.env.append_value('LINKFLAGS', 'default/libs/surfaces/control_protocol/smpte_1.o')
280         #
281         #       TODO: The above is an ugly hack that shouldn't be needed.  We really need
282         #       to refactor SMPTE out of libardour_cp to get rid of that circular dependency
283         #       alltogether.
284         #
285         if bld.env['HAVE_SLV2']:
286                 obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc', 'uri_map.cc' ]
287                 obj.uselib += ' SLV2 '
288                 
289         if bld.env['VST']:
290                 obj.source += [ 'vst_plugin.cc', 'session_vst.cc' ]
291
292         if bld.env['HAVE_COREAUDIO'] and bld.env['COREAUDIO']:
293                 obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
294
295         if bld.env['HAVE_AUDIOUNITS'] or bld.env['HAVE_COREAUDIO']:
296                 obj.uselib_local += ' libappleutility'  
297
298         if bld.env['HAVE_AUDIOUNITS'] and bld.env['AUDIOUNITS']:
299                 obj.source += [ 'audio_unit.cc' ]
300
301         if bld.env['FPU_OPTIMIZATION']:
302                 obj.source += [ 'sse_functions_xmm.cc' ]
303                 if bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686':
304                         obj.source += [ 'sse_functions.s' ]
305                 elif bld.env['build_target'] == 'x86_64':
306                         obj.source += [ 'sse_functions_64bit.s' ]
307
308         # i18n
309         if bld.env['ENABLE_NLS']:
310                 mo_files = glob.glob (os.path.join (bld.get_curdir(), 'po/*.mo'))
311                 for mo in mo_files:
312                         lang = os.path.basename (mo).replace ('.mo', '')
313                         bld.install_as (os.path.join (bld.env['PREFIX'], 'share', 'locale', lang, 'LC_MESSAGES', APPNAME + '.mo'), mo)
314
315         if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
316                 # Unit tests
317                 testobj              = bld.new_task_gen('cxx', 'program')
318                 testobj.source       = '''
319                         interpolation.cc
320                         test/BBTTest.cpp
321                         test/interpolation-test.cc
322                         test/testrunner.cpp
323                 '''
324                 testobj.includes     = obj.includes + ['../pbd/']
325                 testobj.uselib       = 'CPPUNIT SIGCPP JACK GLIBMM SAMPLERATE'
326                 testobj.name         = 'libardour-tests'
327                 testobj.target       = 'run-tests'
328                 testobj.install_path = ''
329
330 def shutdown():
331         autowaf.shutdown()
332
333 def i18n(bld):
334         build_i18n (bld, 'libs/ardour', APPNAME, libardour_sources)