step back JACK dependency to 0.118
[ardour2.git] / libs / ardour / wscript
blobdda7f440865913a910fae9929998f0e584562419
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_port.cc',
43 'audio_region_importer.cc',
44 'audio_track.cc',
45 'audio_track_importer.cc',
46 'audioanalyser.cc',
47 'audioengine.cc',
48 'audiofile_tagger.cc',
49 'audiofilesource.cc',
50 'audioregion.cc',
51 'audiosource.cc',
52 'auditioner.cc',
53 'automatable.cc',
54 'automation.cc',
55 'automation_control.cc',
56 'automation_list.cc',
57 'beats_frames_converter.cc',
58 'broadcast_info.cc',
59 'buffer.cc',
60 'buffer_manager.cc',
61 'buffer_set.cc',
62 'bundle.cc',
63 'butler.cc',
64 'chan_count.cc',
65 'chan_mapping.cc',
66 'configuration.cc',
67 'config_text.cc',
68 'control_protocol_manager.cc',
69 'control_protocol_search_path.cc',
70 'crossfade.cc',
71 'cycle_timer.cc',
72 'default_click.cc',
73 'debug.cc',
74 'delivery.cc',
75 'directory_names.cc',
76 'diskstream.cc',
77 'element_import_handler.cc',
78 'element_importer.cc',
79 'enums.cc',
80 'event_type_map.cc',
81 'export_channel.cc',
82 'export_channel_configuration.cc',
83 'export_failed.cc',
84 'export_filename.cc',
85 'export_format_base.cc',
86 'export_format_manager.cc',
87 'export_format_specification.cc',
88 'export_formats.cc',
89 'export_graph_builder.cc',
90 'export_handler.cc',
91 'export_preset.cc',
92 'export_profile_manager.cc',
93 'export_status.cc',
94 'export_timespan.cc',
95 'file_source.cc',
96 'filename_extensions.cc',
97 'filesystem_paths.cc',
98 'filter.cc',
99 'find_session.cc',
100 'gain.cc',
101 'globals.cc',
102 'graph.cc',
103 'graphnode.cc',
104 'import.cc',
105 'internal_return.cc',
106 'internal_send.cc',
107 'interpolation.cc',
108 'io.cc',
109 'io_processor.cc',
110 'jack_slave.cc',
111 'ladspa_plugin.cc',
112 'location.cc',
113 'location_importer.cc',
114 'meter.cc',
115 'midi_buffer.cc',
116 'midi_clock_slave.cc',
117 'midi_diskstream.cc',
118 'midi_model.cc',
119 'midi_patch_manager.cc',
120 'midi_playlist.cc',
121 'midi_port.cc',
122 'midi_region.cc',
123 'midi_ring_buffer.cc',
124 'midi_source.cc',
125 'midi_state_tracker.cc',
126 'midi_stretch.cc',
127 'midi_track.cc',
128 'midi_ui.cc',
129 'mix.cc',
130 'monitor_processor.cc',
131 'mtc_slave.cc',
132 'mtdm.cc',
133 'mute_master.cc',
134 'named_selection.cc',
135 'onset_detector.cc',
136 'panner.cc',
137 'pcm_utils.cc',
138 'pi_controller.cc',
139 'playlist.cc',
140 'playlist_factory.cc',
141 'plugin.cc',
142 'plugin_insert.cc',
143 'plugin_manager.cc',
144 'port.cc',
145 'port_insert.cc',
146 'port_set.cc',
147 'process_thread.cc',
148 'processor.cc',
149 'quantize.cc',
150 'rc_configuration.cc',
151 'recent_sessions.cc',
152 'region_factory.cc',
153 'resampled_source.cc',
154 'region.cc',
155 'return.cc',
156 'reverse.cc',
157 'route.cc',
158 'route_group.cc',
159 'route_group_member.cc',
160 'rb_effect.cc',
161 'send.cc',
162 'session.cc',
163 'session_butler.cc',
164 'session_click.cc',
165 'session_command.cc',
166 'session_configuration.cc',
167 'session_directory.cc',
168 'session_events.cc',
169 'session_export.cc',
170 'session_handle.cc',
171 'session_metadata.cc',
172 'session_midi.cc',
173 'session_object.cc',
174 'session_playlists.cc',
175 'session_process.cc',
176 'session_rtevents.cc',
177 'session_state.cc',
178 'session_state_utils.cc',
179 'session_time.cc',
180 'session_transport.cc',
181 'session_utils.cc',
182 'slave.cc',
183 'smf_source.cc',
184 'sndfile_helpers.cc',
185 'sndfileimportable.cc',
186 'sndfilesource.cc',
187 'source.cc',
188 'source_factory.cc',
189 'strip_silence.cc',
190 'svn_revision.cc',
191 'tape_file_matcher.cc',
192 'template_utils.cc',
193 'tempo.cc',
194 'tempo_map_importer.cc',
195 'thread_buffers.cc',
196 'ticker.cc',
197 'track.cc',
198 'transient_detector.cc',
199 'user_bundle.cc',
200 'utils.cc',
201 'version.cc'
204 def flac_supported():
205 cmd = subprocess.Popen ("sndfile-info testfile.flac",
206 stdout = subprocess.PIPE,
207 stderr = subprocess.STDOUT, shell = True)
208 out = cmd.communicate()[0];
209 return re.search ('unknown format', out) == None
211 def ogg_supported():
212 cmd = subprocess.Popen ("sndfile-info testfile.ogg",
213 stdout = subprocess.PIPE,
214 stderr = subprocess.STDOUT, shell = True)
215 out = cmd.communicate()[0];
216 return re.search ('unknown format', out) == None
218 def set_options(opt):
219 autowaf.set_options(opt)
221 def configure(conf):
222 autowaf.build_version_files(path_prefix+'ardour/version.h', path_prefix+'version.cc',
223 'libardour3', MAJOR, MINOR, MICRO)
224 autowaf.configure(conf)
225 conf.check_tool('compiler_cxx gas')
226 autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', atleast_version='0.3.2')
227 autowaf.check_pkg(conf, 'jack', uselib_store='JACK', atleast_version='0.118.0')
228 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
229 autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF', atleast_version='0.4.0')
230 autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE', atleast_version='0.1.0')
231 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
232 autowaf.check_pkg(conf, 'slv2', uselib_store='SLV2', atleast_version='0.6.4', mandatory=False)
233 autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18')
234 autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH', mandatory=False)
235 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
236 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
237 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC', atleast_version='1.2.1')
239 # we don't try to detect this, since its part of our source tree
241 conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it
242 conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it
244 conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
246 conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H')
247 conf.check(header_name='wordexp.h', define_name='HAVE_WORDEXP')
249 conf.check(header_name='jack/session.h', define_name='HAVE_JACK_SESSION')
251 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD')
253 conf.check_cc(fragment = "#include <jack/jack.h>\nvoid callback (int code, const char* reason, void* arg) { return; }\nint main(int argc, char **argv) { jack_client_t* c; jack_on_info_shutdown (c, callback, (void*) 0); return 0; }\n",
254 linkflags = ['-ljack'],
255 msg = 'Checking for jack_on_info_shutdown',
256 define_name = 'HAVE_JACK_ON_INFO_SHUTDOWN',
257 okmsg = 'ok')
259 if flac_supported():
260 conf.define ('HAVE_FLAC', 1)
261 autowaf.display_msg(conf, 'Checking for FLAC support', True)
262 else:
263 autowaf.display_msg(conf, 'Checking for FLAC support', False)
264 if ogg_supported():
265 conf.define ('HAVE_OGG', 1)
266 autowaf.display_msg(conf, 'Checking for Ogg/Vorbis support', True)
267 else:
268 autowaf.display_msg(conf, 'Checking for Ogg/Vorbis Support', False)
270 conf.write_config_header('libardour-config.h')
272 # Boost headers
273 autowaf.check_header(conf, 'boost/shared_ptr.hpp')
274 autowaf.check_header(conf, 'boost/weak_ptr.hpp')
275 autowaf.check_header(conf, 'boost/scoped_ptr.hpp')
276 autowaf.check_header(conf, 'boost/ptr_container/ptr_list.hpp')
279 def build(bld):
280 # Library
281 obj = bld.new_task_gen('cxx', 'shlib')
282 obj.source = libardour_sources
283 obj.export_incdirs = ['.']
284 obj.includes = ['.', '../surfaces/control_protocol', '..']
285 obj.name = 'libardour'
286 obj.target = 'ardour'
287 obj.uselib = 'GLIBMM GTHREAD AUBIO SIGCPP XML UUID JACK SNDFILE SAMPLERATE LRDF OSX COREAUDIO'
288 obj.uselib_local = 'libpbd libmidipp libevoral libvamphost libvampplugin libtaglib librubberband libaudiographer'
289 obj.vnum = LIBARDOUR_LIB_VERSION
290 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
291 obj.cxxflags = ['-DPACKAGE="libardour3"']
292 obj.cxxflags += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
293 obj.cxxflags += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIR']) + '"']
294 obj.cxxflags += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
295 obj.cxxflags += ['-DLOCALEDIR="' + os.path.join(
296 os.path.normpath(bld.env['DATADIR']), 'locale') + '"']
297 obj.cxxflags += ['-DVAMP_DIR="' + os.path.join(
298 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"']
299 obj.cxxflags += ['-DPROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"']
301 #obj.source += ' st_stretch.cc st_pitch.cc '
302 #obj.uselib += ' SOUNDTOUCH '
303 #obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
305 obj.env.append_value('LINKFLAGS', 'default/libs/surfaces/control_protocol/smpte_1.o')
307 # TODO: The above is an ugly hack that shouldn't be needed. We really need
308 # to refactor SMPTE out of libardour_cp to get rid of that circular dependency
309 # alltogether.
311 if bld.env['HAVE_SLV2']:
312 obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc', 'uri_map.cc' ]
313 obj.uselib += ' SLV2 '
315 if bld.env['VST']:
316 obj.source += [ 'vst_plugin.cc', 'session_vst.cc' ]
318 if bld.env['HAVE_COREAUDIO'] and bld.env['COREAUDIO']:
319 obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
321 if bld.env['HAVE_AUDIOUNITS'] or bld.env['HAVE_COREAUDIO']:
322 obj.uselib_local += ' libappleutility'
324 if bld.env['HAVE_AUDIOUNITS'] and bld.env['AUDIOUNITS']:
325 obj.source += [ 'audio_unit.cc' ]
327 if bld.env['FPU_OPTIMIZATION']:
328 if bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686':
329 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions.s' ]
330 elif bld.env['build_target'] == 'x86_64':
331 obj.source += [ 'sse_functions_xmm.cc', 'sse_functions_64bit.s' ]
333 # i18n
334 if bld.env['ENABLE_NLS']:
335 mo_files = glob.glob (os.path.join (bld.get_curdir(), 'po/*.mo'))
336 for mo in mo_files:
337 lang = os.path.basename (mo).replace ('.mo', '')
338 bld.install_as (os.path.join (bld.env['PREFIX'], 'share', 'locale', lang, 'LC_MESSAGES', APPNAME + '.mo'), mo)
340 if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
341 # Unit tests
342 testobj = bld.new_task_gen('cxx', 'program')
343 testobj.source = '''
344 test/bbt_test.cpp
345 test/interpolation_test.cpp
346 test/midi_clock_slave_test.cpp
347 test/resampled_source.cc
348 test/testrunner.cpp
349 '''.split()
350 testobj.includes = obj.includes + ['test', '../pbd']
351 testobj.uselib = 'CPPUNIT SIGCPP JACK GLIBMM GTHREAD SAMPLERATE XML LRDF COREAUDIO'
352 testobj.uselib_local = 'libpbd libmidipp libardour'
353 testobj.name = 'libardour-tests'
354 testobj.target = 'run-tests'
355 testobj.install_path = ''
356 testobj.cxxflags = ['-DPACKAGE="libardour3test"']
357 testobj.cxxflags += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
358 testobj.cxxflags += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIR']) + '"']
359 testobj.cxxflags += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
360 testobj.cxxflags += ['-DLOCALEDIR="' + os.path.join(
361 os.path.normpath(bld.env['DATADIR']), 'locale') + '"']
362 testobj.cxxflags += ['-DVAMP_DIR="' + os.path.join(
363 os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"']
364 if bld.env['FPU_OPTIMIZATION']:
365 testobj.source += [ 'sse_functions_xmm.cc' ]
366 if bld.env['build_target'] == 'i386' or bld.env['build_target'] == 'i686':
367 testobj.source += [ 'sse_functions.s' ]
368 elif bld.env['build_target'] == 'x86_64':
369 testobj.source += [ 'sse_functions_64bit.s' ]
371 def shutdown():
372 autowaf.shutdown()
374 def i18n(bld):
375 autowaf.build_i18n (bld, 'libs/ardour', APPNAME, libardour_sources)