summaryrefslogtreecommitdiff
path: root/libs/ardour/SConscript
blob: 1d96fd0777d927b3f9cfe52cb28ddb539db1ee6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# -*- python -*-

import os
import os.path
import glob

Import('env final_prefix install_prefix final_config_prefix libraries i18n')

ardour = env.Clone()

#
# this defines the version number of libardour
# 

domain = 'libardour2'

ardour.Append(DOMAIN = domain, MAJOR = 2, MINOR = 0, MICRO = 0)
ardour.Append(CXXFLAGS = "-DPACKAGE=\\\"" + domain + "\\\"")
ardour.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
ardour.Append(PACKAGE = domain)
ardour.Append(POTFILE = domain + '.pot')

if ardour['IS_OSX']:
	ardour.Append (LINKFLAGS="-Xlinker -headerpad -Xlinker 2048")


#
# explicitly reference the control protocol LGPL library for includes
# 
 
ardour.Append(CPPPATH = '#libs/surfaces/control_protocol')

ardour_files=Split("""
analyser.cc
audioanalyser.cc
audio_diskstream.cc
audioengine.cc
audiofilesource.cc
audiofilter.cc
audio_library.cc
audio_playlist.cc
audioregion.cc
audiosource.cc
audio_track.cc
auditioner.cc
automation.cc
automation_event.cc
configuration.cc
connection.cc
control_protocol_manager.cc
crossfade.cc
curve.cc
cycle_timer.cc
default_click.cc
diskstream.cc
enums.cc
gain.cc
gdither.cc
globals.cc
import.cc
insert.cc
io.cc
jack_slave.cc
ladspa_plugin.cc
location.cc
mix.cc
mtc_slave.cc
mtdm.cc
named_selection.cc
onset_detector.cc
panner.cc
pcm_utils.cc
playlist.cc
playlist_factory.cc
plugin.cc
plugin_manager.cc
port.cc
recent_sessions.cc
redirect.cc
region.cc
region_factory.cc
resampled_source.cc
reverse.cc
route.cc
route_group.cc
send.cc
session_butler.cc
session.cc
session_click.cc
session_command.cc
session_events.cc
session_export.cc
session_midi.cc
session_process.cc
session_state.cc
session_time.cc
session_transport.cc
silentfilesource.cc
sndfile_helpers.cc
sndfilesource.cc
sndfileimportable.cc
source.cc
source_factory.cc
svn_revision.cc
tempo.cc
track.cc
transient_detector.cc
utils.cc
version.cc
""")

arch_specific_objects = [ ]

osc_files = [ 'osc.cc' ]
vst_files = [ 'vst_plugin.cc', 'session_vst.cc' ]
lv2_files = [ 'lv2_plugin.cc' ]
audiounit_files = [ 'audio_unit.cc' ]
coreaudio_files = [ 'coreaudiosource.cc', 'caimportable.cc' ]
extra_sources = [ ]
timefx_sources = [ ]

if ardour['VST']:
	extra_sources += vst_files
	ardour.Append(CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")

if ardour['LV2']:
	extra_sources += lv2_files
	ardour.Append(CCFLAGS="-DHAVE_SLV2")

if ardour['LIBLO']:
    extra_sources += osc_files

ardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
ardour.Append(CXXFLAGS="-DDATA_DIR=\\\"" + os.path.join (final_prefix, 'share') + "\\\"")
ardour.Append(CXXFLAGS="-DMODULE_DIR=\\\"" + os.path.join (final_prefix, env['LIBDIR']) + "\\\"")
ardour.Append(CXXFLAGS="-DVAMP_DIR=\\\"" + os.path.join (final_prefix, env['LIBDIR'], 'ardour2', 'vamp') + "\\\"")
ardour.Append(CXXFLAGS="-DCONFIG_DIR=\\\"" + final_config_prefix + "\\\"")
ardour.Append(CXXFLAGS="-DLOCALEDIR=\\\"" + os.path.join (final_prefix, 'share', 'locale') + "\\\"")

ardour.Merge ([ libraries['jack'] ])

#
# See if JACK supports jack_client_open()
#

jack_test_source_file = """
#include <jack/jack.h>
int main(int argc, char **argv)
{
    jack_client_open ("foo", 0, 0);
    return 0;
}
"""
def CheckJackClientOpen(context):
        context.Message('Checking for jack_client_open()...')
        result = context.TryLink(jack_test_source_file, '.c')
        context.Result(result)
        return result

#
# See if JACK supports jack_recompute_total_latencies()
#

jack_test_source_file = """
#include <jack/jack.h>
int main(int argc, char **argv)
{
    jack_recompute_total_latencies ((jack_client_t*) 0);
    return 0;
}
"""
def CheckJackRecomputeLatencies(context):
        context.Message('Checking for jack_recompute_total_latencies()...')
        result = context.TryLink(jack_test_source_file, '.c')
        context.Result(result)
        return result

jack_video_frame_offset_test = """
#include <jack/transport.h>
int main(int argc, char** argv)
{
	jack_position_t pos;

	pos.valid & JackVideoFrameOffset;
	return 0;
}
"""
def CheckJackVideoFrameOffset(context):
	context.Message('Checking for JackVideoFrameOffset in jack_position_bits_t enum...')
	result = context.TryLink(jack_video_frame_offset_test, '.c')
	context.Result(result)
	return result

#
# See if JACK supports jack_port_ensure_monitor_input()
#
jack_ensure_monitor_input_test = """
#include <jack/jack.h>
int main(int argc, char** argv)
{
	    jack_port_t **port;

	    jack_port_ensure_monitor (*port, 1);
	    return 0;

}
"""

def CheckJackEnsureMonitorInput(context):
        context.Message('Checking for jack_port_ensure_monitor_input()...')
        result = context.TryLink(jack_ensure_monitor_input_test, '.c')
        context.Result(result)
        return result

conf = Configure(ardour, custom_tests = {
	'CheckJackClientOpen' : CheckJackClientOpen,
	'CheckJackRecomputeLatencies' : CheckJackRecomputeLatencies,
	'CheckJackVideoFrameOffset' : CheckJackVideoFrameOffset,
	'CheckJackEnsureMonitorInput' : CheckJackEnsureMonitorInput
})

if conf.CheckJackClientOpen():
	ardour.Append(CXXFLAGS="-DHAVE_JACK_CLIENT_OPEN")

if conf.CheckJackRecomputeLatencies():
    ardour.Append(CXXFLAGS="-DHAVE_JACK_RECOMPUTE_LATENCIES")

if conf.CheckJackVideoFrameOffset():
	ardour.Append(CXXFLAGS="-DHAVE_JACK_VIDEO_SUPPORT")
	
if conf.CheckJackEnsureMonitorInput():
	ardour.Append(CXXFLAGS='-DHAVE_JACK_PORT_ENSURE_MONITOR')
else:
    print '\nWARNING: You need at least svn revision 985 of jack for hardware monitoring to work correctly.\n'

#
# Optional header files
#

if conf.CheckCHeader('wordexp.h'):
    ardour.Append(CXXFLAGS="-DHAVE_WORDEXP")

if conf.CheckCHeader('sys/vfs.h'):
    ardour.Append(CXXFLAGS="-DHAVE_SYS_VFS_H")

if conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h'):
    ardour.Append(LINKFLAGS="-framework CoreMIDI")

if conf.CheckCHeader('/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h'):
    ardour.Append(LINKFLAGS="-framework AudioToolbox")

if conf.CheckCHeader('/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h'):
    ardour.Append(CXXFLAGS="-DHAVE_WEAK_COREAUDIO")

if conf.CheckCHeader('/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h') and ardour['AUDIOUNITS']:
    ardour.Append(CXXFLAGS="-DHAVE_AUDIOUNITS")
    ardour.Append(LINKFLAGS="-framework AudioUnit")
    if ardour['AUSTATE']:
	    ardour.Append(CXXFLAGS="-DAU_STATE_SUPPORT")
    extra_sources += audiounit_files
 
if ardour['COREAUDIO']:
    ardour.Append(CXXFLAGS="-DHAVE_COREAUDIO")    
    extra_sources += coreaudio_files

if env['CONFIG_ARCH'] == 'apple':
    # this next line avoids issues with circular dependencies between libardour and libardour_cp.
    #
    ardour.Append(LINKFLAGS='-undefined suppress -flat_namespace') 

ardour = conf.Finish ()

ardour.Merge ([
	     libraries['core'],
	     libraries['fftw3'],
	     libraries['fftw3f'],
	     libraries['glib2'],
	     libraries['glibmm2'],
	     libraries['lrdf'],
	     libraries['midi++2'],
	     libraries['pbd'],
	     libraries['raptor'],
	     libraries['samplerate'],
	     libraries['sigc2'],
	     libraries['sndfile'],
	     libraries['vamp'],
	     libraries['vamphost'],
	     libraries['xml']
	     ])

if ardour['RUBBERBAND']:
	ardour.Merge ([ libraries['rubberband']])
	timefx_sources += [ 'rb_effect.cc' ]
else:
	ardour.Merge ([ libraries['soundtouch'] ])
	timefx_sources += [ 'st_stretch.cc', 'st_pitch.cc' ]
	
if ardour['LV2']:
	ardour.Merge ([ libraries['slv2'] ])

if ardour['LIBLO']:
	ardour.Merge ([ libraries['lo'] ])

if ardour['COREAUDIO'] or ardour['AUDIOUNITS']:
	ardour.Merge ([ libraries['appleutility'] ])

def SharedAsmObjectEmitter(target, source, env):
	for tgt in target:
		tgt.attributes.shared = 1
	return (target, source)


env['BUILDERS']['SharedAsmObject'] = Builder (action = '$CXX -c -fPIC $SOURCE -o $TARGET',
					      emitter = SharedAsmObjectEmitter,
					      suffix = '$SHOBJSUFFIX',
					      src_suffix = '.s',
					      single_source = 1)
#
# handle objects that should always be compiled with -msse in their own
# special environment, which is exactly like "ardour" but unconditionally
# includes -msse
# 


always_sse_objects = []
sse_env = ardour.Clone()
sse_env.Append (CXXFLAGS="-msse")

if env['FPU_OPTIMIZATION']:
	if env['DIST_TARGET'] == "i386":
		arch_specific_objects = env.SharedAsmObject('sse_functions.os', 'sse_functions.s')
		always_sse_objects += [ sse_env.SharedObject (source = 'sse_functions_xmm.cc') ]
	if env['DIST_TARGET'] == "i686":
		arch_specific_objects = env.SharedAsmObject('sse_functions.os', 'sse_functions.s')
		always_sse_objects += [ sse_env.SharedObject (source = 'sse_functions_xmm.cc') ]
	if env['DIST_TARGET'] == "x86_64":
		arch_specific_objects = env.SharedAsmObject('sse_functions_64bit.os', 'sse_functions_64bit.s')
		always_sse_objects += [ sse_env.SharedObject (source = 'sse_functions_xmm.cc') ]
			
libardour = ardour.SharedLibrary('ardour', ardour_files + always_sse_objects + timefx_sources + extra_sources + arch_specific_objects)

Default(libardour)

if env['NLS']:
	i18n (ardour, ardour_files + vst_files + coreaudio_files + timefx_sources + audiounit_files, env)


env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), libardour))

env.Alias('version', ardour.VersionBuild(['version.cc', 'ardour/version.h'], []))

env.Alias('tarball', env.Distribute (env['DISTTREE'],
				     [ 'SConscript', 'i18n.h', 'gettext.h' ] + 
				     [ 'sse_functions_xmm.cc', 'sse_functions.s', 'sse_functions_64bit.s' ] +
				     [ 'rb_effect.cc', 'st_stretch.cc', 'st_pitch.cc' ] +
				     ardour_files + 
				     osc_files + 
				     vst_files + 
				     coreaudio_files + 
				     audiounit_files +
				     lv2_files +
				     glob.glob('po/*.po') + glob.glob('ardour/*.h')))