various fixes to MidiRegionView selection handling, key handling, drawing of ghost...
[ardour2.git] / libs / ardour / wscript
blobe4d435c0a9b3ec79b85287296ad5df389458bb9b
1 #!/usr/bin/env python
2 import autowaf
3 import os
4 import glob
5 import Options
6 import re
7 import subprocess
9 # Version of this package (even if built as a child)
10 MAJOR = '3'
11 MINOR = '0'
12 MICRO = '0'
13 LIBARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
15 # Library version (UNIX style major, minor, micro)
16 # major increment <=> incompatible changes
17 # minor increment <=> compatible changes (additions)
18 # micro increment <=> no interface changes
19 LIBARDOUR_LIB_VERSION = '3.0.0'
21 # default state file version for this build
22 CURRENT_SESSION_FILE_VERSION = 3000
24 # Variables for 'waf dist'
25 APPNAME = 'libardour'
26 VERSION = LIBARDOUR_VERSION
28 # Mandatory variables
29 srcdir = '.'
30 blddir = 'build'
32 path_prefix = 'libs/ardour/'
34 libardour_sources = [
35 'amp.cc',
36 'analyser.cc',
37 'audio_buffer.cc',
38 'audio_diskstream.cc',
39 'audio_library.cc',
40 'audio_playlist.cc',
41 'audio_playlist_importer.cc',
42 'audio_playlist_source.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 'beats_frames_converter.cc',
59 'broadcast_info.cc',
60 'buffer.cc',
61 'buffer_manager.cc',
62 'buffer_set.cc',
63 'bundle.cc',
64 'butler.cc',
65 'callback.cc',
66 'capturing_processor.cc',
67 'chan_count.cc',
68 'chan_mapping.cc',
69 'configuration.cc',
70 'config_text.cc',
71 'control_protocol_manager.cc',
72 'control_protocol_search_path.cc',
73 'crossfade.cc',
74 'cycle_timer.cc',
75 'data_type.cc',
76 'default_click.cc',
77 'debug.cc',
78 'delivery.cc',
79 'directory_names.cc',
80 'diskstream.cc',
81 'element_import_handler.cc',
82 'element_importer.cc',
83 'enums.cc',
84 'event_type_map.cc',
85 'export_channel.cc',
86 'export_channel_configuration.cc',
87 'export_failed.cc',
88 'export_filename.cc',
89 'export_format_base.cc',
90 'export_format_manager.cc',
91 'export_format_specification.cc',
92 'export_formats.cc',
93 'export_formats_search_path.cc',
94 'export_graph_builder.cc',
95 'export_handler.cc',
96 'export_preset.cc',
97 'export_profile_manager.cc',
98 'export_status.cc',
99 'export_timespan.cc',
100 'file_source.cc',
101 'filename_extensions.cc',
102 'filesystem_paths.cc',
103 'filter.cc',
104 'find_session.cc',
105 'gain.cc',
106 'globals.cc',
107 'graph.cc',
108 'graphnode.cc',
109 'import.cc',
110 'internal_return.cc',
111 'internal_send.cc',
112 'interpolation.cc',
113 'io.cc',
114 'io_processor.cc',
115 'jack_slave.cc',
116 'ladspa_plugin.cc',
117 'location.cc',
118 'location_importer.cc',
119 'meter.cc',
120 'midi_automation_list_binder.cc',
121 'midi_buffer.cc',
122 'midi_clock_slave.cc',
123 'midi_diskstream.cc',
124 'midi_model.cc',
125 'midi_patch_manager.cc',
126 'midi_playlist.cc',
127 'midi_playlist_source.cc',
128 'midi_port.cc',
129 'midi_region.cc',
130 'midi_ring_buffer.cc',
131 'midi_source.cc',
132 'midi_state_tracker.cc',
133 'midi_stretch.cc',
134 'midi_track.cc',
135 'midi_ui.cc',
136 'mix.cc',
137 'monitor_processor.cc',
138 'mtc_slave.cc',
139 'mtdm.cc',
140 'mute_master.cc',
141 'named_selection.cc',
142 'onset_detector.cc',
143 'operations.cc',
144 'pan_controllable.cc',
145 'pannable.cc',
146 'panner.cc',
147 'panner_manager.cc',
148 'panner_search_path.cc',
149 'panner_shell.cc',
150 'pcm_utils.cc',
151 'pi_controller.cc',
152 'playlist.cc',
153 'playlist_factory.cc',
154 'playlist_source.cc',
155 'plugin.cc',
156 'plugin_insert.cc',
157 'plugin_manager.cc',
158 'port.cc',
159 'port_insert.cc',
160 'port_set.cc',
161 'process_thread.cc',
162 'processor.cc',
163 'progress.cc',
164 'quantize.cc',
165 'rc_configuration.cc',
166 'recent_sessions.cc',
167 'region_factory.cc',
168 'resampled_source.cc',
169 'region.cc',
170 'return.cc',
171 'reverse.cc',
172 'route.cc',
173 'route_group.cc',
174 'route_group_member.cc',
175 'rb_effect.cc',
176 'send.cc',
177 'session.cc',
178 'session_butler.cc',
179 'session_click.cc',
180 'session_command.cc',
181 'session_configuration.cc',
182 'session_directory.cc',
183 'session_events.cc',
184 'session_export.cc',
185 'session_handle.cc',
186 'session_metadata.cc',
187 'session_midi.cc',
188 'session_object.cc',
189 'session_playlists.cc',
190 'session_process.cc',
191 'session_rtevents.cc',
192 'session_state.cc',
193 'session_state_utils.cc',
194 'session_time.cc',
195 'session_transport.cc',
196 'session_utils.cc',
197 'slave.cc',
198 'smf_source.cc',
199 'sndfile_helpers.cc',
200 'sndfileimportable.cc',
201 'sndfilesource.cc',
202 'source.cc',
203 'source_factory.cc',
204 'speakers.cc',
205 'strip_silence.cc',
206 'svn_revision.cc',
207 'tape_file_matcher.cc',
208 'template_utils.cc',
209 'tempo.cc',
210 'tempo_map_importer.cc',
211 'thread_buffers.cc',
212 'ticker.cc',
213 'track.cc',
214 'transient_detector.cc',
215 'unknown_processor.cc',
216 'user_bundle.cc',
217 'utils.cc',
218 'version.cc'
221 def flac_supported():
222 cmd = subprocess.Popen ("sndfile-info testfile.flac",
223 stdout = subprocess.PIPE,
224 stderr = subprocess.STDOUT, shell = True)
225 out = cmd.communicate()[0].decode('utf-8');
226 return re.search ('unknown format', out) == None
228 def ogg_supported():
229 cmd = subprocess.Popen ("sndfile-info testfile.ogg",
230 stdout = subprocess.PIPE,
231 stderr = subprocess.STDOUT, shell = True)
232 out = cmd.communicate()[0].decode('utf-8');
233 return re.search ('unknown format', out) == None
235 def set_options(opt):
236 autowaf.set_options(opt)
238 def configure(conf):
239 autowaf.build_version_files(
240 path_prefix + 'ardour/version.h',
241 path_prefix + 'version.cc',
242 'libardour3', MAJOR, MINOR, MICRO)
243 autowaf.configure(conf)
244 conf.check_tool('compiler_cxx gas')
245 autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
246 atleast_version='0.3.2')
247 autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
248 atleast_version='0.118.2')
249 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
250 autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
251 atleast_version='0.4.0')
252 autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
253 atleast_version='0.1.0')
254 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
255 atleast_version='2.0')
256 autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
257 atleast_version='0.0.0', mandatory=False)
258 if conf.env['HAVE_LILV']:
259 autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
260 atleast_version='0.2.0', mandatory=False)
261 else:
262 autowaf.check_pkg(conf, 'slv2', uselib_store='SLV2',
263 atleast_version='0.6.4', mandatory=False)
264 if conf.env['HAVE_SLV2']:
265 autowaf.check_pkg(conf, 'rasqal', uselib_store='RASQAL',
266 atleast_version='0.9.14', mandatory=False)
267 autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH',
268 mandatory=False)
269 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT',
270 atleast_version='1.12.0', mandatory=False)
271 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
272 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
273 atleast_version='1.2.1')
274 autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL',
275 atleast_version='7.0.0')
277 # we don't try to detect this, since its part of our source tree
279 conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
280 conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it
282 conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
284 conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H')
285 conf.check(header_name='wordexp.h', define_name='HAVE_WORDEXP')
287 conf.check(header_name='jack/session.h', uselib = [ 'JACK' ],
288 define_name='HAVE_JACK_SESSION')
290 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD')
292 conf.check_cc(fragment = '''
293 #include <jack/jack.h>
294 void callback(int code, const char* reason, void* arg) { return; }
295 int main(int argc, char **argv) {
296 jack_client_t* c;
297 jack_on_info_shutdown(c, callback, (void*) 0);
298 return 0;
299 }''',
300 uselib= [ 'JACK' ],
301 msg = 'Checking for jack_on_info_shutdown',
302 define_name = 'HAVE_JACK_ON_INFO_SHUTDOWN',
303 okmsg = 'present')
305 missing_jack_message = '''missing - a version of JACK that supports \
306 jack_port_set_latency_range() is required to compile Ardour3. Currently this\
307 means using JACK version 0.120.1 from http://www.jackaudio.org/download'''
309 conf.check_cc(fragment = '''
310 #include <jack/jack.h>
311 int main(int argc, char **argv) {
312 jack_port_t* p;
313 jack_latency_range_t r;
314 jack_port_set_latency_range(p, JackCaptureLatency, &r);
315 return 0;
316 }''',
317 uselib = [ 'JACK' ],
318 msg = 'Checking for new JACK latency API',
319 okmsg = 'present',
320 mandatory = True,
321 errmsg = missing_jack_message)
323 conf.check_cc(fragment = '''
324 #include <jack/jack.h>
325 int main(int argc, char **argv) {
326 jack_port_type_get_buffer_size((jack_client_t*)0, "");
327 return 0;
328 }''',
329 uselib = [ 'JACK' ],
330 msg = 'Checking for new jack_port_type_get_buffer_size',
331 okmsg = 'present',
332 mandatory = True,
333 errmsg = missing_jack_message)
335 if flac_supported():
336 conf.define ('HAVE_FLAC', 1)
337 if ogg_supported():
338 conf.define ('HAVE_OGG', 1)
340 if conf.env['HAVE_LILV'] or conf.env['HAVE_SLV2']:
341 conf.define ('LV2_SUPPORT', 1)
343 conf.write_config_header('libardour-config.h')
345 # Boost headers
346 autowaf.check_header(conf, 'boost/shared_ptr.hpp')
347 autowaf.check_header(conf, 'boost/weak_ptr.hpp')
348 autowaf.check_header(conf, 'boost/scoped_ptr.hpp')
349 autowaf.check_header(conf, 'boost/ptr_container/ptr_list.hpp')
352 def build(bld):
353 # Library
354 obj = bld.new_task_gen('cxx', 'shlib')
355 obj.source = libardour_sources
356 obj.export_incdirs = ['.']
357 obj.includes = ['.', '../surfaces/control_protocol', '..']
358 obj.name = 'libardour'
359 obj.target = 'ardour'
360 obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
361 'JACK','SNDFILE','SAMPLERATE','LRDF','AUDIOUNIT',
362 'OSX','BOOST','CURL','DL']
363 obj.uselib_local = ['libpbd','libmidipp','libevoral','libvamphost',
364 'libvampplugin','libtaglib','librubberband',
365 'libaudiographer']
366 obj.vnum = LIBARDOUR_LIB_VERSION
367 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
368 obj.defines = [
369 'PACKAGE="libardour3"',
370 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
371 'CONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIR']) + '"',
372 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
373 'LOCALEDIR="' + os.path.join(
374 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
375 'VAMP_DIR="' + os.path.join(
376 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"',
377 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
380 #obj.source += ' st_stretch.cc st_pitch.cc '
381 #obj.uselib += ' SOUNDTOUCH '
382 #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
384 if bld.env['HAVE_LILV']:
385 obj.source += [ 'lv2_plugin_lilv.cc', 'lv2_event_buffer.cc',
386 'uri_map.cc', 'rdff.c' ]
387 obj.uselib += ['LILV']
388 if bld.env['HAVE_SUIL']:
389 obj.uselib += ['SUIL']
390 elif bld.env['HAVE_SLV2']:
391 obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc',
392 'uri_map.cc', 'rdff.c' ]
393 obj.uselib += ['SLV2','RASQAL']
395 if bld.env['VST_SUPPORT']:
396 obj.source += [ 'vst_plugin.cc', 'session_vst.cc' ]
397 obj.includes += [ '../fst' ]
398 obj.defines += [ 'VST_SUPPORT' ]
400 if bld.env['COREAUDIO']:
401 obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
402 obj.uselib_local += ['libappleutility']
403 obj.source += [ 'audio_unit.cc' ]
405 if bld.env['FPU_OPTIMIZATION']:
406 if (bld.env['build_target'] == 'i386'
407 or bld.env['build_target'] == 'i686'):
408 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s' ]
409 elif bld.env['build_target'] == 'x86_64':
410 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s' ]
412 # i18n
413 if bld.env['ENABLE_NLS']:
414 mo_files = glob.glob(os.path.join(bld.get_curdir(), 'po/*.mo'))
415 for mo in mo_files:
416 lang = os.path.basename(mo).replace('.mo', '')
417 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
418 lang, 'LC_MESSAGES', 'libardour3.mo'),
421 if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
422 # Unit tests
423 testobj = bld.new_task_gen('cxx', 'program')
424 testobj.source = '''
425 test/bbt_test.cpp
426 test/interpolation_test.cpp
427 test/midi_clock_slave_test.cpp
428 test/resampled_source.cc
429 test/mantis_3356.cc
430 test/testrunner.cpp
431 '''.split()
432 testobj.includes = obj.includes + ['test', '../pbd']
433 testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD',
434 'SAMPLERATE','XML','LRDF','COREAUDIO']
435 testobj.uselib_local = ['libpbd','libmidipp','libardour']
436 testobj.name = 'libardour-tests'
437 testobj.target = 'run-tests'
438 testobj.install_path = ''
439 testobj.defines = [
440 'PACKAGE="libardour3test"',
441 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
442 'CONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIR']) + '"',
443 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
444 'LOCALEDIR="' + os.path.join(
445 os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
446 'VAMP_DIR="' + os.path.join(
447 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"'
449 if bld.env['FPU_OPTIMIZATION']:
450 testobj.source += [ 'sse_functions_xmm.cc' ]
451 if (bld.env['build_target'] == 'i386'
452 or bld.env['build_target'] == 'i686'):
453 testobj.source += [ 'sse_functions.s' ]
454 elif bld.env['build_target'] == 'x86_64':
455 testobj.source += [ 'sse_functions_64bit.s' ]
457 def shutdown():
458 autowaf.shutdown()
460 def i18n(bld):
461 autowaf.build_i18n (bld, '.', 'libs/ardour', APPNAME, libardour_sources)