Remove old Windows projects.
[jack2.git] / common / wscript
blob7a79a8a8a37fc7618ad3ee87b1c30660f6f62433
1 #! /usr/bin/env python
2 # encoding: utf-8
4 import Build
5 import re
6 import os
8 def configure(conf):
9 conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
11 if conf.is_defined('HAVE_SAMPLERATE'):
12 conf.env['LIB_SAMPLERATE'] = ['samplerate']
14 conf.env['BUILD_NETLIB'] = conf.is_defined('HAVE_SAMPLERATE')
15 conf.env['BUILD_ADAPTER'] = conf.is_defined('HAVE_SAMPLERATE')
17 def create_jack_process_obj(bld, target, sources, uselib = None):
18 process = bld.new_task_gen('cxx', 'shlib')
19 process.env['shlib_PATTERN'] = '%s.so'
20 process.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
21 if bld.env['IS_MACOSX']:
22 env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
23 if bld.env['IS_LINUX']:
24 env_includes = ['../linux', '../posix', '../linux/alsa']
25 if bld.env['IS_SUN']:
26 env_includes = ['../solaris', '../posix', '../solaris/oss']
27 process.includes = ['.'] + env_includes + ['jack', '..']
28 process.name = target
29 process.target = target
30 process.source = sources
31 if bld.env['IS_LINUX']:
32 process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
33 if bld.env['IS_MACOSX']:
34 process.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
35 #process.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
36 process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
37 process.install_path = '${ADDON_DIR}/'
38 process.uselib_local = uselib.name
39 return process
41 def build(bld):
42 common_libsources = [
43 'JackActivationCount.cpp',
44 'JackAPI.cpp',
45 'JackClient.cpp',
46 'JackConnectionManager.cpp',
47 'ringbuffer.c',
48 'JackError.cpp',
49 'JackException.cpp',
50 'JackFrameTimer.cpp',
51 'JackGraphManager.cpp',
52 'JackPort.cpp',
53 'JackPortType.cpp',
54 'JackAudioPort.cpp',
55 'JackMidiPort.cpp',
56 'JackMidiAPI.cpp',
57 'JackEngineControl.cpp',
58 'JackShmMem.cpp',
59 'JackGenericClientChannel.cpp',
60 'shm.c',
61 'JackGlobals.cpp',
62 'JackDebugClient.cpp',
63 'JackTransportEngine.cpp',
64 'timestamps.c',
65 'JackTools.cpp',
66 'JackMessageBuffer.cpp',
67 'JackEngineProfiling.cpp',
70 includes = ['.', './jack', '..']
71 uselib = ["PTHREAD", "CELT"]
73 if bld.env['IS_LINUX']:
74 common_libsources += [
75 '../posix/JackPosixThread.cpp',
76 '../posix/JackPosixSemaphore.cpp',
77 '../posix/JackPosixProcessSync.cpp',
78 '../posix/JackPosixMutex.cpp',
79 '../posix/JackSocket.cpp',
80 '../linux/JackLinuxTime.c',
82 includes = ['../linux', '../posix'] + includes
83 uselib.append('RT')
84 uselib.append('DL')
86 if bld.env['IS_SUN']:
87 common_libsources += [
88 '../posix/JackPosixThread.cpp',
89 '../posix/JackFifo.cpp',
90 '../posix/JackPosixProcessSync.cpp',
91 '../posix/JackPosixMutex.cpp',
92 '../posix/JackSocket.cpp',
93 '../solaris/JackSolarisTime.c',
95 includes = ['../solaris', '../posix'] + includes
96 uselib.append('RT')
98 if bld.env['IS_MACOSX']:
99 common_libsources += [
100 '../posix/JackPosixProcessSync.cpp',
101 '../posix/JackPosixThread.cpp',
102 '../macosx/JackMachThread.cpp',
103 '../macosx/JackMachSemaphore.cpp',
104 '../posix/JackSocket.cpp',
105 '../macosx/JackMachTime.c',
107 includes = ['../macosx', '../macosx/RPC', '../posix'] + includes
109 serverlib = bld.new_task_gen('cxx', 'shlib')
110 serverlib.features.append('cc')
111 serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
112 serverlib.includes = includes
113 serverlib.name = 'serverlib'
114 serverlib.target = 'jackserver'
115 serverlib.uselib = uselib
116 serverlib.install_path = '${LIBDIR}'
117 serverlib.source = [] + common_libsources
118 serverlib.source += [
119 'JackAudioDriver.cpp',
120 'JackTimedDriver.cpp',
121 'JackMidiDriver.cpp',
122 'JackDriver.cpp',
123 'JackEngine.cpp',
124 'JackExternalClient.cpp',
125 'JackFreewheelDriver.cpp',
126 'JackInternalClient.cpp',
127 'JackServer.cpp',
128 'JackThreadedDriver.cpp',
129 'JackRestartThreadedDriver.cpp',
130 'JackWaitThreadedDriver.cpp',
131 'JackServerAPI.cpp',
132 'JackDriverLoader.cpp',
133 'JackServerGlobals.cpp',
134 'JackControlAPI.cpp',
135 'JackNetTool.cpp',
136 'JackNetInterface.cpp',
137 'JackArgParser.cpp',
138 'JackRequestDecoder.cpp',
139 'JackMidiAsyncQueue.cpp',
140 'JackMidiAsyncWaitQueue.cpp',
141 'JackMidiBufferReadQueue.cpp',
142 'JackMidiBufferWriteQueue.cpp',
143 'JackMidiRawInputWriteQueue.cpp',
144 'JackMidiRawOutputWriteQueue.cpp',
145 'JackMidiReadQueue.cpp',
146 'JackMidiReceiveQueue.cpp',
147 'JackMidiSendQueue.cpp',
148 'JackMidiUtil.cpp',
149 'JackMidiWriteQueue.cpp'
152 if bld.env['IS_LINUX']:
153 serverlib.source += [
154 '../posix/JackSocketServerChannel.cpp',
155 '../posix/JackSocketNotifyChannel.cpp',
156 '../posix/JackSocketServerNotifyChannel.cpp',
157 '../posix/JackNetUnixSocket.cpp',
160 if bld.env['IS_SUN']:
161 serverlib.source += [
162 '../posix/JackSocketServerChannel.cpp',
163 '../posix/JackSocketNotifyChannel.cpp',
164 '../posix/JackSocketServerNotifyChannel.cpp',
165 '../posix/JackNetUnixSocket.cpp',
168 if bld.env['IS_MACOSX']:
169 serverlib.source += [
170 '../posix/JackSocketServerChannel.cpp',
171 '../posix/JackSocketNotifyChannel.cpp',
172 '../posix/JackSocketServerNotifyChannel.cpp',
173 '../posix/JackNetUnixSocket.cpp',
176 serverlib.vnum = bld.env['JACK_API_VERSION']
178 if bld.env['IS_LINUX']:
179 serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
181 if bld.env['IS_MACOSX']:
182 serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
183 serverlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
184 #serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64")
185 serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
186 serverlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
188 if bld.env['IS_SUN']:
189 serverlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
191 if bld.env['BUILD_NETLIB'] == True:
192 netlib = bld.new_task_gen('cxx', 'shlib')
193 netlib.features.append('cc')
194 netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
195 netlib.includes = includes
196 netlib.name = 'netlib'
197 netlib.target = 'jacknet'
198 netlib.uselib = ['SAMPLERATE', 'CELT', 'PTHREAD' , 'RT']
199 netlib.install_path = '${LIBDIR}'
200 netlib.source = [
201 'JackNetAPI.cpp',
202 'JackNetInterface.cpp',
203 'JackNetTool.cpp',
204 'JackException.cpp',
205 'JackAudioAdapterInterface.cpp',
206 'JackLibSampleRateResampler.cpp',
207 'JackResampler.cpp',
208 'JackGlobals.cpp',
209 'ringbuffer.c']
211 if bld.env['IS_LINUX']:
212 netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../linux/JackLinuxTime.c']
213 netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
215 if bld.env['IS_SUN']:
216 netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../solaris/JackSolarisTime.c']
217 netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
220 if bld.env['IS_MACOSX']:
221 netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../macosx/JackMachThread.cpp', '../macosx/JackMachTime.c']
222 netlib.env.append_value("LINKFLAGS", "-framework CoreAudio -single_module")
224 netlib.vnum = bld.env['JACK_API_VERSION']
226 clientlib = bld.new_task_gen('cxx', 'shlib')
227 clientlib.features.append('cc')
228 clientlib.defines = 'HAVE_CONFIG_H'
229 clientlib.uselib = uselib
230 clientlib.install_path = '${LIBDIR}'
231 if bld.env['BUILD_JACKDBUS'] == True and bld.env['BUILD_JACKD'] == False:
232 clientlib.uselib.append('DBUS-1')
233 clientlib.includes = includes
234 clientlib.name = 'clientlib'
235 clientlib.target = 'jack'
236 clientlib.source = [] + common_libsources
237 clientlib.source += [
238 'JackLibClient.cpp',
239 'JackLibAPI.cpp',
242 if bld.env['IS_LINUX']:
243 clientlib.source += [
244 '../posix/JackSocketClientChannel.cpp',
245 '../posix/JackPosixServerLaunch.cpp',
248 if bld.env['IS_SUN']:
249 clientlib.source += [
250 '../posix/JackSocketClientChannel.cpp',
251 '../posix/JackPosixServerLaunch.cpp',
254 if bld.env['IS_MACOSX']:
255 clientlib.source += [
256 '../posix/JackSocketClientChannel.cpp',
257 '../posix/JackPosixServerLaunch.cpp',
260 clientlib.vnum = bld.env['JACK_API_VERSION']
262 if bld.env['IS_LINUX']:
263 clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
265 if bld.env['IS_MACOSX']:
266 clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
267 clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
268 #clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64"
269 clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
270 clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
272 if bld.env['IS_SUN']:
273 clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
275 if bld.env['BUILD_WITH_32_64']:
276 print "create 32bit lib..."
277 clientlib32bit = clientlib.clone('lib32')
279 create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)
281 create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)
283 net_adapter_sources = [
284 'JackResampler.cpp',
285 'JackLibSampleRateResampler.cpp',
286 'JackAudioAdapter.cpp',
287 'JackAudioAdapterInterface.cpp',
288 'JackNetAdapter.cpp',
291 if bld.env['BUILD_ADAPTER'] == True:
292 process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
293 process.uselib = 'SAMPLERATE'
295 audio_adapter_sources = [
296 'JackResampler.cpp',
297 'JackLibSampleRateResampler.cpp',
298 'JackAudioAdapter.cpp',
299 'JackAudioAdapterInterface.cpp',
300 'JackAudioAdapterFactory.cpp',
303 if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
304 audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
305 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
306 process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
307 process.uselib = 'SAMPLERATE'
309 if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
310 audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
311 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
312 process.uselib = ['ALSA', 'SAMPLERATE']
314 if bld.env['BUILD_ADAPTER'] and bld.env['IS_SUN']:
315 audio_adapter_sources += ['../solaris/oss/JackOSSAdapter.cpp', 'memops.c']
316 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
317 process.uselib = 'SAMPLERATE'
319 #audio_adapter_sources += ['../windows/JackPortAudioAdapter.cpp']
320 #process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
322 bld.install_files('${PREFIX}/include/jack', 'jack/*.h')
324 # process jack.pc.in -> jack.pc
325 import misc
326 obj = bld.new_task_gen('subst')
327 obj.source = '../jack.pc.in'
328 obj.target = 'jack.pc'
329 obj.dict = {'PREFIX': bld.env['PREFIX'],
330 'LIBDIR': bld.env['LIBDIR'],
331 'INCLUDEDIR': os.path.normpath(bld.env['PREFIX'] + '/include'),
332 'SERVERLIB': serverlib.target,
333 'JACK_VERSION': bld.env['JACK_VERSION'],
335 obj.install_path = '${LIBDIR}/pkgconfig/'
336 obj.fun = misc.subst_func