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