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