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