lots of small fixes related to the rythmic rodent
[ardour.git] / libs / ardour / SConscript
1 # -*- python -*-
2
3 import os
4 import os.path
5 import glob
6
7 Import('env final_prefix install_prefix final_config_prefix libraries i18n')
8
9 ardour = env.Copy()
10
11 #
12 # this defines the version number of libardour
13
14
15 domain = 'libardour2'
16
17 ardour.Append(DOMAIN = domain, MAJOR = 2, MINOR = 0, MICRO = 0)
18 ardour.Append(CXXFLAGS = "-DPACKAGE=\\\"" + domain + "\\\"")
19 ardour.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
20 ardour.Append(PACKAGE = domain)
21 ardour.Append(POTFILE = domain + '.pot')
22
23 #
24 # explicitly reference the control protocol LGPL library for includes
25
26  
27 ardour.Append(CPPPATH = '#libs/surfaces/control_protocol')
28
29 ardour_files=Split("""
30 diskstream.cc
31 audioanalyser.cc
32 audio_diskstream.cc
33 audio_library.cc
34 audio_playlist.cc
35 track.cc
36 audio_track.cc
37 audioengine.cc
38 audiofilesource.cc
39 audiofilter.cc
40 audioregion.cc
41 audiosource.cc
42 auditioner.cc
43 automation.cc
44 automation_event.cc
45 configuration.cc
46 connection.cc
47 control_protocol_manager.cc
48 crossfade.cc
49 curve.cc
50 cycle_timer.cc
51 default_click.cc
52 enums.cc
53 gain.cc
54 gdither.cc
55 globals.cc
56 import.cc
57 insert.cc
58 io.cc
59 jack_slave.cc
60 ladspa_plugin.cc
61 location.cc
62 mtc_slave.cc
63 named_selection.cc
64 panner.cc
65 pcm_utils.cc
66 playlist.cc
67 playlist_factory.cc
68 plugin.cc
69 plugin_manager.cc
70 port.cc
71 recent_sessions.cc
72 redirect.cc
73 region.cc
74 region_factory.cc
75 resampled_source.cc
76 reverse.cc
77 route.cc
78 route_group.cc
79 send.cc
80 session.cc
81 session_butler.cc
82 session_click.cc
83 session_command.cc
84 session_events.cc
85 session_export.cc
86 session_midi.cc
87 session_process.cc
88 session_state.cc
89 session_time.cc
90 session_transport.cc
91 silentfilesource.cc
92 sndfile_helpers.cc
93 sndfilesource.cc
94 source.cc
95 source_factory.cc
96 tempo.cc
97 transient_detector.cc
98 utils.cc
99 version.cc
100 mix.cc
101 """)
102
103 arch_specific_objects = [ ]
104
105 osc_files = [ 'osc.cc' ]
106 vst_files = [ 'vst_plugin.cc', 'session_vst.cc' ]
107 lv2_files = [ 'lv2_plugin.cc' ]
108 audiounit_files = [ 'audio_unit.cc' ]
109 coreaudio_files = [ 'coreaudiosource.cc' ]
110 extra_sources = [ ]
111 timefx_sources = [ ]
112
113 if ardour['VST']:
114         extra_sources += vst_files
115         ardour.Append(CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
116
117 if ardour['LV2']:
118         extra_sources += lv2_files
119         ardour.Append(CCFLAGS="-DHAVE_SLV2")
120
121 if ardour['LIBLO']:
122     extra_sources += osc_files
123
124 ardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
125 ardour.Append(CXXFLAGS="-DDATA_DIR=\\\"" + os.path.join (final_prefix, 'share') + "\\\"")
126 ardour.Append(CXXFLAGS="-DMODULE_DIR=\\\"" + os.path.join (final_prefix, env['LIBDIR']) + "\\\"")
127 ardour.Append(CXXFLAGS="-DVAMP_DIR=\\\"" + os.path.join (final_prefix, env['LIBDIR'], 'ardour2', 'vamp') + "\\\"")
128 ardour.Append(CXXFLAGS="-DCONFIG_DIR=\\\"" + final_config_prefix + "\\\"")
129 ardour.Append(CXXFLAGS="-DLOCALEDIR=\\\"" + os.path.join (final_prefix, 'share', 'locale') + "\\\"")
130
131 ardour.Merge ([ libraries['jack'] ])
132
133 #
134 # See if JACK supports jack_client_open()
135 #
136
137 jack_test_source_file = """
138 #include <jack/jack.h>
139 int main(int argc, char **argv)
140 {
141     jack_client_open ("foo", 0, 0);
142     return 0;
143 }
144 """
145 def CheckJackClientOpen(context):
146         context.Message('Checking for jack_client_open()...')
147         result = context.TryLink(jack_test_source_file, '.c')
148         context.Result(result)
149         return result
150
151 #
152 # See if JACK supports jack_recompute_total_latencies()
153 #
154
155 jack_test_source_file = """
156 #include <jack/jack.h>
157 int main(int argc, char **argv)
158 {
159     jack_recompute_total_latencies ((jack_client_t*) 0);
160     return 0;
161 }
162 """
163 def CheckJackRecomputeLatencies(context):
164         context.Message('Checking for jack_recompute_total_latencies()...')
165         result = context.TryLink(jack_test_source_file, '.c')
166         context.Result(result)
167         return result
168
169 jack_video_frame_offset_test = """
170 #include <jack/transport.h>
171 int main(int argc, char** argv)
172 {
173         jack_position_t pos;
174
175         pos.valid & JackVideoFrameOffset;
176         return 0;
177 }
178 """
179 def CheckJackVideoFrameOffset(context):
180         context.Message('Checking for JackVideoFrameOffset in jack_position_bits_t enum...')
181         result = context.TryLink(jack_video_frame_offset_test, '.c')
182         context.Result(result)
183         return result
184
185 #
186 # See if JACK supports jack_port_ensure_monitor_input()
187 #
188 jack_ensure_monitor_input_test = """
189 #include <jack/jack.h>
190 int main(int argc, char** argv)
191 {
192             jack_port_t **port;
193
194             jack_port_ensure_monitor (*port, 1);
195             return 0;
196
197 }
198 """
199
200 def CheckJackEnsureMonitorInput(context):
201         context.Message('Checking for jack_port_ensure_monitor_input()...')
202         result = context.TryLink(jack_ensure_monitor_input_test, '.c')
203         context.Result(result)
204         return result
205
206 conf = Configure(ardour, custom_tests = {
207         'CheckJackClientOpen' : CheckJackClientOpen,
208         'CheckJackRecomputeLatencies' : CheckJackRecomputeLatencies,
209         'CheckJackVideoFrameOffset' : CheckJackVideoFrameOffset,
210         'CheckJackEnsureMonitorInput' : CheckJackEnsureMonitorInput
211 })
212
213 if conf.CheckJackClientOpen():
214         ardour.Append(CXXFLAGS="-DHAVE_JACK_CLIENT_OPEN")
215
216 if conf.CheckJackRecomputeLatencies():
217     ardour.Append(CXXFLAGS="-DHAVE_JACK_RECOMPUTE_LATENCIES")
218
219 if conf.CheckJackVideoFrameOffset():
220         ardour.Append(CXXFLAGS="-DHAVE_JACK_VIDEO_SUPPORT")
221         
222 if conf.CheckJackEnsureMonitorInput():
223         ardour.Append(CXXFLAGS='-DHAVE_JACK_PORT_ENSURE_MONITOR')
224 else:
225     print '\nWARNING: You need at least svn revision 985 of jack for hardware monitoring to work correctly.\n'
226
227 #
228 # Optional header files
229 #
230
231 if conf.CheckCHeader('wordexp.h'):
232     ardour.Append(CXXFLAGS="-DHAVE_WORDEXP")
233
234 if conf.CheckCHeader('sys/vfs.h'):
235     ardour.Append(CXXFLAGS="-DHAVE_SYS_VFS_H")
236
237 if conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h'):
238     ardour.Append(LINKFLAGS="-framework CoreMIDI")
239
240 if conf.CheckCHeader('/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h'):
241     ardour.Append(LINKFLAGS="-framework AudioToolbox")
242
243 if conf.CheckCHeader('/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h'):
244     ardour.Append(CXXFLAGS="-DHAVE_WEAK_COREAUDIO")
245
246 if conf.CheckCHeader('/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h') and ardour['AUDIOUNITS']:
247     ardour.Append(CXXFLAGS="-DHAVE_AUDIOUNITS")
248     ardour.Append(LINKFLAGS="-framework AudioUnit")
249     extra_sources += audiounit_files
250  
251 if ardour['COREAUDIO']:
252     ardour.Append(CXXFLAGS="-DHAVE_COREAUDIO")    
253     extra_sources += coreaudio_files
254
255 if env['CONFIG_ARCH'] == 'apple':
256     # this next line avoids issues with circular dependencies between libardour and libardour_cp.
257     #
258     ardour.Append(LINKFLAGS='-undefined suppress -flat_namespace') 
259
260 ardour = conf.Finish ()
261
262 ardour.Merge ([
263              libraries['core'],
264              libraries['xml'],
265              libraries['sndfile-ardour'],
266              libraries['raptor'],
267              libraries['lrdf'],
268              libraries['samplerate'],
269              libraries['sigc2'],
270              libraries['pbd'],
271              libraries['midi++2'],
272              libraries['glib2'],
273              libraries['glibmm2'],
274              libraries['vamp'],
275              libraries['vamphost'],
276              libraries['fftw3f'],
277              libraries['fftw3'],
278              ])
279
280 if ardour['RUBBERBAND']:
281         ardour.Merge ([ libraries['rubberband']])
282         timefx_sources += [ 'rb_effect.cc' ]
283 else:
284         ardour.Merge ([ libraries['soundtouch'] ])
285         timefx_sources += [ 'st_stretch.cc', 'st_pitch.cc' ]
286         
287 if ardour['LV2']:
288         ardour.Merge ([ libraries['slv2'] ])
289
290 if ardour['LIBLO']:
291         ardour.Merge ([ libraries['lo'] ])
292
293 if ardour['COREAUDIO'] or ardour['AUDIOUNITS']:
294         ardour.Merge ([ libraries['appleutility'] ])
295
296 def SharedAsmObjectEmitter(target, source, env):
297         for tgt in target:
298                 tgt.attributes.shared = 1
299         return (target, source)
300
301
302 env['BUILDERS']['SharedAsmObject'] = Builder (action = '$CXX -c -fPIC $SOURCE -o $TARGET',
303                                               emitter = SharedAsmObjectEmitter,
304                                               suffix = '$SHOBJSUFFIX',
305                                               src_suffix = '.s',
306                                               single_source = 1)
307 #
308 # handle objects that should always be compiled with -msse in their own
309 # special environment, which is exactly like "ardour" but unconditionally
310 # includes -msse
311
312
313
314 always_sse_objects = []
315 sse_env = ardour.Copy()
316 sse_env.Append (CXXFLAGS="-msse")
317
318 if env['FPU_OPTIMIZATION']:
319         if env['DIST_TARGET'] == "i386":
320                 arch_specific_objects = env.SharedAsmObject('sse_functions.os', 'sse_functions.s')
321                 always_sse_objects += [ sse_env.SharedObject (source = 'sse_functions_xmm.cc') ]
322         if env['DIST_TARGET'] == "i686":
323                 arch_specific_objects = env.SharedAsmObject('sse_functions.os', 'sse_functions.s')
324                 always_sse_objects += [ sse_env.SharedObject (source = 'sse_functions_xmm.cc') ]
325         if env['DIST_TARGET'] == "x86_64":
326                 arch_specific_objects = env.SharedAsmObject('sse_functions_64bit.os', 'sse_functions_64bit.s')
327                 always_sse_objects += [ sse_env.SharedObject (source = 'sse_functions_xmm.cc') ]
328                         
329 libardour = ardour.SharedLibrary('ardour', ardour_files + always_sse_objects + timefx_sources + extra_sources + arch_specific_objects)
330
331 Default(libardour)
332
333 if env['NLS']:
334         i18n (ardour, ardour_files + vst_files + coreaudio_files + timefx_sources + audiounit_files, env)
335
336
337 env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), libardour))
338
339 env.Alias('version', ardour.VersionBuild(['version.cc', 'ardour/version.h'], []))
340
341 env.Alias('tarball', env.Distribute (env['DISTTREE'],
342                                      [ 'SConscript', 'i18n.h', 'gettext.h' ] + 
343                                      [ 'sse_functions_xmm.cc', 'sse_functions.s', 'sse_functions_64bit.s' ] +
344                                      [ 'rb_effect.cc', 'st_stretch.cc', 'st_pitch.cc' ] +
345                                      ardour_files + osc_files + vst_files + coreaudio_files + audiounit_files +
346                                      glob.glob('po/*.po') + glob.glob('ardour/*.h')))