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