Use ARM neon intrinsics for AudioBufferMixdown
[jack2.git] / common / wscript
blobfcf1d49590833b45b074a12661ec69e1d502f838
1 #! /usr/bin/env python
2 # encoding: utf-8
4 import re
5 import os
7 def configure(conf):
8 conf.env['BUILD_NETLIB'] = conf.env['SAMPLERATE']
9 conf.env['BUILD_ADAPTER'] = conf.env['SAMPLERATE']
11 if conf.env['IS_WINDOWS']:
12 try:
13 conf.check_cc(function_name='regcomp', header_name='regex.h', lib='regex', uselib_store="REGEX", define_name='HAVE_REGEX_H')
14 except:
15 conf.check_cc(function_name='regcomp', header_name='regex.h', lib='tre', uselib_store="REGEX", define_name='HAVE_REGEX_H')
16 conf.check_cc(function_name='htons', header_name='winsock2.h', lib='ws2_32', uselib_store="WS2_32", define_name='HAVE_WINSOCK2_H')
17 conf.check_cc(function_name='timeGetDevCaps', header_name=['windows.h', 'mmsystem.h'], lib='winmm', uselib_store="WINMM", define_name='HAVE_MMSYSTEM_H')
18 conf.check_cc(function_name='EnumProcesses', header_name=['windows.h', 'psapi.h'], lib='psapi', uselib_store="PSAPI", define_name='HAVE_PSAPI_H')
20 def create_jack_process_obj(bld, target, sources, uselib = None):
21 process = bld(features = ['cxx', 'cxxshlib'])
22 if not bld.env['IS_WINDOWS']:
23 process.env['cxxshlib_PATTERN'] = '%s.so'
24 process.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
25 if bld.env['IS_MACOSX']:
26 env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
27 if bld.env['IS_LINUX']:
28 env_includes = ['../linux', '../posix', '../linux/alsa']
29 if bld.env['IS_SUN']:
30 env_includes = ['../solaris', '../posix', '../solaris/oss']
31 if bld.env['IS_WINDOWS']:
32 env_includes = ['../windows', '../windows/portaudio']
33 process.includes = ['.'] + env_includes + ['jack', '..']
34 process.name = target
35 process.target = target
36 process.source = sources
37 if bld.env['IS_LINUX']:
38 process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
39 if bld.env['IS_MACOSX']:
40 process.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
41 #process.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
42 process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
43 process.install_path = '${ADDON_DIR}/'
44 process.use = [uselib.name]
45 return process
47 def build(bld):
48 common_libsources = [
49 'JackActivationCount.cpp',
50 'JackAPI.cpp',
51 'JackClient.cpp',
52 'JackConnectionManager.cpp',
53 'ringbuffer.c',
54 'JackError.cpp',
55 'JackException.cpp',
56 'JackFrameTimer.cpp',
57 'JackGraphManager.cpp',
58 'JackPort.cpp',
59 'JackPortType.cpp',
60 'JackAudioPort.cpp',
61 'JackMidiPort.cpp',
62 'JackMidiAPI.cpp',
63 'JackEngineControl.cpp',
64 'JackShmMem.cpp',
65 'JackGenericClientChannel.cpp',
66 'shm.c',
67 'JackGlobals.cpp',
68 'JackTransportEngine.cpp',
69 'JackTools.cpp',
70 'JackMessageBuffer.cpp',
71 'JackEngineProfiling.cpp',
74 includes = ['.', './jack']
75 if not bld.variant:
76 includes.append('..')
77 else:
78 includes.append('../..')
79 uselib = ["PTHREAD", "CELT", "OPUS"]
81 if bld.env['IS_LINUX']:
82 common_libsources += [
83 'JackDebugClient.cpp',
84 'timestamps.c',
85 '../posix/JackPosixThread.cpp',
86 '../posix/JackPosixSemaphore.cpp',
87 '../posix/JackPosixProcessSync.cpp',
88 '../posix/JackPosixMutex.cpp',
89 '../posix/JackSocket.cpp',
90 '../linux/JackLinuxTime.c',
92 includes = ['../linux', '../posix'] + includes
93 uselib.append('RT')
94 uselib.append('DL')
96 if bld.env['IS_SUN']:
97 common_libsources += [
98 'JackDebugClient.cpp',
99 'timestamps.c',
100 '../posix/JackPosixThread.cpp',
101 '../posix/JackFifo.cpp',
102 '../posix/JackPosixProcessSync.cpp',
103 '../posix/JackPosixMutex.cpp',
104 '../posix/JackSocket.cpp',
105 '../solaris/JackSolarisTime.c',
107 includes = ['../solaris', '../posix'] + includes
108 uselib.append('RT')
110 if bld.env['IS_MACOSX']:
111 common_libsources += [
112 'JackDebugClient.cpp',
113 'timestamps.c',
114 '../posix/JackPosixProcessSync.cpp',
115 '../posix/JackPosixThread.cpp',
116 '../macosx/JackMachThread.cpp',
117 '../macosx/JackMachSemaphore.cpp',
118 '../posix/JackSocket.cpp',
119 '../macosx/JackMachTime.c',
121 includes = ['../macosx', '../macosx/RPC', '../posix'] + includes
123 if bld.env['IS_WINDOWS']:
124 common_libsources += [
125 '../windows/JackWinMutex.cpp',
126 '../windows/JackWinProcessSync.cpp',
127 '../windows/JackWinSemaphore.cpp',
128 '../windows/JackWinThread.cpp',
129 '../windows/JackWinTime.c',
131 includes = ['../windows' ] + includes
132 uselib.append('REGEX')
133 uselib.append('WS2_32')
134 uselib.append('PSAPI')
135 uselib.append('WINMM')
137 clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
138 clientlib.defines = 'HAVE_CONFIG_H'
139 clientlib.use = uselib
140 if bld.env['IS_WINDOWS']:
141 clientlib.install_path = '${BINDIR}'
142 else:
143 clientlib.install_path = '${LIBDIR}'
144 if bld.env['AUTOSTART_METHOD'] == "dbus":
145 clientlib.use.append('DBUS-1')
146 clientlib.includes = includes
147 clientlib.name = 'clientlib'
148 clientlib.target = 'jack'
149 clientlib.source = [] + common_libsources
150 clientlib.source += [
151 'JackLibClient.cpp',
152 'JackLibAPI.cpp',
155 if bld.env['IS_LINUX']:
156 clientlib.source += [
157 '../posix/JackSocketClientChannel.cpp',
158 '../posix/JackPosixServerLaunch.cpp',
161 if bld.env['IS_SUN']:
162 clientlib.source += [
163 '../posix/JackSocketClientChannel.cpp',
164 '../posix/JackPosixServerLaunch.cpp',
167 if bld.env['IS_MACOSX']:
168 clientlib.source += [
169 '../posix/JackSocketClientChannel.cpp',
170 '../posix/JackPosixServerLaunch.cpp',
173 if bld.env['IS_WINDOWS']:
174 clientlib.source += [
175 '../windows/JackWinNamedPipe.cpp',
176 '../windows/JackWinNamedPipeClientChannel.cpp',
177 '../windows/JackWinServerLaunch.cpp',
178 '../windows/JackMMCSS.cpp',
181 clientlib.vnum = bld.env['JACK_API_VERSION']
183 if bld.env['IS_LINUX']:
184 clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
186 if bld.env['IS_MACOSX']:
187 clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
188 clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
189 #clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64"
190 clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
191 clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
193 if bld.env['IS_SUN']:
194 clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
196 if bld.variant:
197 # if there is variant defined, we expect it to be the 32bit client lib one
198 # we don't want to build other stuff in this variant
199 return
201 serverlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
202 serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
203 serverlib.includes = includes
204 serverlib.name = 'serverlib'
205 serverlib.target = 'jackserver'
206 serverlib.use = uselib
207 if bld.env['IS_WINDOWS']:
208 serverlib.install_path = '${BINDIR}'
209 else:
210 serverlib.install_path = '${LIBDIR}'
211 serverlib.source = [] + common_libsources
212 serverlib.source += [
213 'JackAudioDriver.cpp',
214 'JackTimedDriver.cpp',
215 'JackMidiDriver.cpp',
216 'JackDriver.cpp',
217 'JackEngine.cpp',
218 'JackExternalClient.cpp',
219 'JackFreewheelDriver.cpp',
220 'JackInternalClient.cpp',
221 'JackServer.cpp',
222 'JackThreadedDriver.cpp',
223 'JackRestartThreadedDriver.cpp',
224 'JackWaitThreadedDriver.cpp',
225 'JackWaitCallbackDriver.cpp',
226 'JackServerAPI.cpp',
227 'JackDriverLoader.cpp',
228 'JackServerGlobals.cpp',
229 'JackControlAPI.cpp',
230 'JackNetTool.cpp',
231 'JackNetInterface.cpp',
232 'JackArgParser.cpp',
233 'JackRequestDecoder.cpp',
234 'JackMidiAsyncQueue.cpp',
235 'JackMidiAsyncWaitQueue.cpp',
236 'JackMidiBufferReadQueue.cpp',
237 'JackMidiBufferWriteQueue.cpp',
238 'JackMidiRawInputWriteQueue.cpp',
239 'JackMidiRawOutputWriteQueue.cpp',
240 'JackMidiReadQueue.cpp',
241 'JackMidiReceiveQueue.cpp',
242 'JackMidiSendQueue.cpp',
243 'JackMidiUtil.cpp',
244 'JackMidiWriteQueue.cpp'
247 if bld.env['IS_LINUX']:
248 serverlib.source += [
249 '../posix/JackSocketServerChannel.cpp',
250 '../posix/JackSocketNotifyChannel.cpp',
251 '../posix/JackSocketServerNotifyChannel.cpp',
252 '../posix/JackNetUnixSocket.cpp',
255 if bld.env['IS_SUN']:
256 serverlib.source += [
257 '../posix/JackSocketServerChannel.cpp',
258 '../posix/JackSocketNotifyChannel.cpp',
259 '../posix/JackSocketServerNotifyChannel.cpp',
260 '../posix/JackNetUnixSocket.cpp',
263 if bld.env['IS_MACOSX']:
264 serverlib.source += [
265 '../posix/JackSocketServerChannel.cpp',
266 '../posix/JackSocketNotifyChannel.cpp',
267 '../posix/JackSocketServerNotifyChannel.cpp',
268 '../posix/JackNetUnixSocket.cpp',
271 if bld.env['IS_WINDOWS']:
272 serverlib.source += [
273 '../windows/JackMMCSS.cpp',
274 '../windows/JackWinNamedPipe.cpp',
275 '../windows/JackWinNamedPipeServerChannel.cpp',
276 '../windows/JackWinNamedPipeServerNotifyChannel.cpp',
277 '../windows/JackWinNamedPipeNotifyChannel.cpp',
278 '../windows/JackNetWinSocket.cpp',
281 serverlib.vnum = bld.env['JACK_API_VERSION']
283 if bld.env['IS_LINUX']:
284 serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
286 if bld.env['IS_MACOSX']:
287 serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
288 serverlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
289 #serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64")
290 serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
291 serverlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
293 if bld.env['IS_SUN']:
294 serverlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
296 if bld.env['BUILD_NETLIB'] == True:
297 netlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
298 netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
299 netlib.includes = includes
300 netlib.name = 'netlib'
301 netlib.target = 'jacknet'
302 netlib.use = ['SAMPLERATE', 'CELT', 'OPUS', 'PTHREAD']
303 if bld.env['IS_WINDOWS']:
304 netlib.install_path = '${BINDIR}'
305 netlib.use += ['WS2_32', 'WINMM']
306 else:
307 netlib.use += ['RT']
308 netlib.install_path = '${LIBDIR}'
309 netlib.source = [
310 'JackNetAPI.cpp',
311 'JackNetInterface.cpp',
312 'JackNetTool.cpp',
313 'JackException.cpp',
314 'JackAudioAdapterInterface.cpp',
315 'JackLibSampleRateResampler.cpp',
316 'JackResampler.cpp',
317 'JackGlobals.cpp',
318 'ringbuffer.c']
320 if bld.env['IS_LINUX']:
321 netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../linux/JackLinuxTime.c']
322 netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
324 if bld.env['IS_SUN']:
325 netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../solaris/JackSolarisTime.c']
326 netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
329 if bld.env['IS_MACOSX']:
330 netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../macosx/JackMachThread.cpp', '../macosx/JackMachTime.c']
331 netlib.env.append_value("LINKFLAGS", "-framework CoreAudio -single_module")
333 if bld.env['IS_WINDOWS']:
334 netlib.source += ['../windows/JackNetWinSocket.cpp','../windows/JackWinThread.cpp', '../windows/JackMMCSS.cpp', '../windows/JackWinTime.c']
336 netlib.vnum = bld.env['JACK_API_VERSION']
338 create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)
340 create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)
342 net_adapter_sources = [
343 'JackResampler.cpp',
344 'JackLibSampleRateResampler.cpp',
345 'JackAudioAdapter.cpp',
346 'JackAudioAdapterInterface.cpp',
347 'JackNetAdapter.cpp',
350 if bld.env['BUILD_ADAPTER'] == True:
351 process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
352 process.use += ['SAMPLERATE']
354 audio_adapter_sources = [
355 'JackResampler.cpp',
356 'JackLibSampleRateResampler.cpp',
357 'JackAudioAdapter.cpp',
358 'JackAudioAdapterInterface.cpp',
359 'JackAudioAdapterFactory.cpp',
362 if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
363 audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
364 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
365 process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
366 process.use = 'SAMPLERATE'
368 if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
369 audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
370 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
371 process.use = ['ALSA', 'SAMPLERATE']
373 if bld.env['BUILD_ADAPTER'] and bld.env['IS_SUN']:
374 audio_adapter_sources += ['../solaris/oss/JackOSSAdapter.cpp', 'memops.c']
375 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
376 process.use = 'SAMPLERATE'
378 if bld.env['BUILD_ADAPTER'] and bld.env['IS_WINDOWS']:
379 audio_adapter_sources += ['../windows/portaudio/JackPortAudioAdapter.cpp', '../windows/portaudio/JackPortAudioDevices.cpp']
380 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
381 process.use += ['SAMPLERATE', 'PORTAUDIO']
384 bld.install_files('${PREFIX}/include/jack', bld.path.ant_glob('jack/*.h'))
386 # process jack.pc.in -> jack.pc
387 obj = bld(
388 features = 'subst_pc',
389 source = '../jack.pc.in',
390 target = 'jack.pc',
391 install_path = '${LIBDIR}/pkgconfig/',
392 INCLUDEDIR = os.path.normpath(bld.env['PREFIX'] + '/include'),
393 SERVERLIB = serverlib.target,