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