fix up translation domains to reflect v2; functor command header
[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 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 resampled_source.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 silentfilesource.cc
92 sndfile_helpers.cc
93 sndfilesource.cc
94 source.cc
95 source_factory.cc
96 tempo.cc
97 utils.cc
98 version.cc
99 mix.cc
100 """)
101
102 arch_specific_objects = [ ]
103
104 osc_files = [ 'osc.cc' ]
105 vst_files = [ 'vst_plugin.cc', 'session_vst.cc' ]
106 audiounit_files = [ 'audio_unit.cc' ]
107 coreaudio_files = [ 'coreaudiosource.cc' ]
108 extra_sources = [ ]
109
110 if ardour['VST']:
111         extra_sources += vst_files
112         ardour.Append(CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
113
114 if ardour['LIBLO']:
115     extra_sources += osc_files
116
117 ardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
118 ardour.Append(CXXFLAGS="-DDATA_DIR=\\\"" + os.path.join (final_prefix, 'share') + "\\\"")
119 ardour.Append(CXXFLAGS="-DMODULE_DIR=\\\"" + os.path.join (final_prefix, env['LIBDIR']) + "\\\"")
120 ardour.Append(CXXFLAGS="-DCONFIG_DIR=\\\"" + final_config_prefix + "\\\"")
121 ardour.Append(CXXFLAGS="-DLOCALEDIR=\\\"" + os.path.join (final_prefix, 'share', 'locale') + "\\\"")
122
123 ardour.Merge ([ libraries['jack'] ])
124
125 #
126 # See if JACK supports jack_client_open()
127 #
128
129 jack_test_source_file = """
130 #include <jack/jack.h>
131 int main(int argc, char **argv)
132 {
133     jack_client_open ("foo", 0, 0);
134     return 0;
135 }
136 """
137 def CheckJackClientOpen(context):
138         context.Message('Checking for jack_client_open()...')
139         result = context.TryLink(jack_test_source_file, '.c')
140         context.Result(result)
141         return result
142
143 #
144 # See if JACK supports jack_recompute_total_latencies()
145 #
146
147 jack_test_source_file = """
148 #include <jack/jack.h>
149 int main(int argc, char **argv)
150 {
151     jack_recompute_total_latencies ((jack_client_t*) 0);
152     return 0;
153 }
154 """
155 def CheckJackRecomputeLatencies(context):
156         context.Message('Checking for jack_recompute_total_latencies()...')
157         result = context.TryLink(jack_test_source_file, '.c')
158         context.Result(result)
159         return result
160
161 jack_video_frame_offset_test = """
162 #include <jack/transport.h>
163 int main(int argc, char** argv)
164 {
165         jack_position_t pos;
166
167         pos.valid & JackVideoFrameOffset;
168         return 0;
169 }
170 """
171 def CheckJackVideoFrameOffset(context):
172         context.Message('Checking for JackVideoFrameOffset in jack_position_bits_t enum...')
173         result = context.TryLink(jack_video_frame_offset_test, '.c')
174         context.Result(result)
175         return result
176
177 #
178 # See if JACK supports jack_port_ensure_monitor_input()
179 #
180 jack_ensure_monitor_input_test = """
181 #include <jack/jack.h>
182 int main(int argc, char** argv)
183 {
184             jack_port_t **port;
185
186             jack_port_ensure_monitor (*port, 1);
187             return 0;
188
189 }
190 """
191
192 def CheckJackEnsureMonitorInput(context):
193         context.Message('Checking for jack_port_ensure_monitor_input()...')
194         result = context.TryLink(jack_ensure_monitor_input_test, '.c')
195         context.Result(result)
196         return result
197
198 conf = Configure(ardour, custom_tests = {
199         'CheckJackClientOpen' : CheckJackClientOpen,
200         'CheckJackRecomputeLatencies' : CheckJackRecomputeLatencies,
201         'CheckJackVideoFrameOffset' : CheckJackVideoFrameOffset,
202         'CheckJackEnsureMonitorInput' : CheckJackEnsureMonitorInput
203 })
204
205 if conf.CheckJackClientOpen():
206         ardour.Append(CXXFLAGS="-DHAVE_JACK_CLIENT_OPEN")
207
208 if conf.CheckJackRecomputeLatencies():
209     ardour.Append(CXXFLAGS="-DHAVE_JACK_RECOMPUTE_LATENCIES")
210
211 if conf.CheckJackVideoFrameOffset():
212         ardour.Append(CXXFLAGS="-DHAVE_JACK_VIDEO_SUPPORT")
213         
214 if conf.CheckJackEnsureMonitorInput():
215         ardour.Append(CXXFLAGS='-DHAVE_JACK_PORT_ENSURE_MONITOR')
216 else:
217     print '\nWARNING: You need at least svn revision 985 of jack for hardware monitoring to work correctly.\n'
218
219 #
220 # Optional header files
221 #
222
223 if conf.CheckCHeader('wordexp.h'):
224     ardour.Append(CXXFLAGS="-DHAVE_WORDEXP")
225
226 if conf.CheckCHeader('sys/vfs.h'):
227     ardour.Append(CXXFLAGS="-DHAVE_SYS_VFS_H")
228
229 if conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h'):
230     ardour.Append(LINKFLAGS="-framework CoreMIDI")
231
232 if conf.CheckCHeader('/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h'):
233     ardour.Append(LINKFLAGS="-framework AudioToolbox")
234
235 if conf.CheckCHeader('/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h'):
236     ardour.Append(CXXFLAGS="-DHAVE_WEAK_COREAUDIO")
237
238 if conf.CheckCHeader('/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h') and ardour['AUDIOUNITS']:
239     ardour.Append(CXXFLAGS="-DHAVE_AUDIOUNITS")
240     ardour.Append(LINKFLAGS="-framework AudioUnit")
241     extra_sources += audiounit_files
242  
243 if ardour['COREAUDIO']:
244     ardour.Append(CXXFLAGS="-DHAVE_COREAUDIO")    
245     extra_sources += coreaudio_files
246
247 if env['CONFIG_ARCH'] == 'apple':
248     # this next line avoids issues with circular dependencies between libardour and libardour_cp.
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 # handle objects that should always be compiled with -msse in their own
288 # special environment, which is exactly like "ardour" but unconditionally
289 # includes -msse
290
291
292
293 always_sse_objects = []
294 sse_env = ardour.Copy()
295 sse_env.Append (CXXFLAGS="-msse")
296
297 if env['FPU_OPTIMIZATION']:
298         if env['DIST_TARGET'] == "i386":
299                 arch_specific_objects = env.SharedAsmObject('sse_functions.os', 'sse_functions.s')
300                 always_sse_objects += [ sse_env.SharedObject (source = 'sse_functions_xmm.cc') ]
301         if env['DIST_TARGET'] == "i686":
302                 arch_specific_objects = env.SharedAsmObject('sse_functions.os', 'sse_functions.s')
303                 always_sse_objects += [ sse_env.SharedObject (source = 'sse_functions_xmm.cc') ]
304         if env['DIST_TARGET'] == "x86_64":
305                 arch_specific_objects = env.SharedAsmObject('sse_functions_64bit.os', 'sse_functions_64bit.s')
306                 always_sse_objects += [ sse_env.SharedObject (source = 'sse_functions_xmm.cc') ]
307                         
308 libardour = ardour.SharedLibrary('ardour', ardour_files + always_sse_objects + extra_sources + arch_specific_objects)
309
310 Default(libardour)
311
312 if env['NLS']:
313         i18n (ardour, ardour_files + vst_files + coreaudio_files + audiounit_files, env)
314
315
316 env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), libardour))
317
318 env.Alias('version', ardour.VersionBuild(['version.cc', 'ardour/version.h'], []))
319
320 env.Alias('tarball', env.Distribute (env['DISTTREE'],
321                                      [ 'SConscript', 'i18n.h', 'gettext.h', 'sse_functions_xmm.cc', 'sse_functions.s', 'sse_functions_64bit.s' ] +
322                                      ardour_files + osc_files + vst_files + coreaudio_files + audiounit_files +
323                                      glob.glob('po/*.po') + glob.glob('ardour/*.h')))