rm old (superceded) psyco win installer proj
[supercollider.git] / wscript
blob0c281389cb238e5c8cbaae435920c6761791db44
1 #! /usr/bin/env python
2 # encoding: utf-8
4 # =====================================================================
5 # Experimental waf build script for SuperCollider, currently Linux-only
6 # use with caution!!
7 # --artfwo
9 import os
10 import sys
12 VERSION='3.3.1'
13 APPNAME='supercollider'
14 srcdir = '.'
15 blddir = 'build/waf' # FIXME
17 SC3_API_VERSION=VERSION
19 def set_options(opt):
20 opt.tool_options('gnu_dirs')
21 opt.tool_options('compiler_cc')
22 opt.tool_options('compiler_cxx')
24 def configure(conf):
25 import Utils
26 platform = Utils.detect_platform()
28 conf.env['IS_LINUX'] = platform == 'linux'
29 conf.env['IS_WIN32'] = platform == 'win32'
30 conf.env['IS_MACOSX'] = platform == 'darwin'
31 conf.env['IS_FREEBSD'] = platform == 'freebsd'
33 if not conf.env['IS_LINUX']:
34 Utils.pprint('RED', 'Sorry, waf builder currently does not work on %s platform!' % platform)
35 sys.exit(1)
37 conf.check_tool('gnu_dirs')
38 conf.check_tool('compiler_cc')
39 conf.check_tool('compiler_cxx')
40 #conf.check_tool('misc')
42 conf.check_cfg(atleast_pkgconfig_version='0.0.0')
44 conf.check_cfg(package='sndfile', atleast_version='1.0.16',
45 args='--cflags --libs', mandatory=True)
46 conf.check_cfg(package='jack', atleast_version='0.100',
47 args='--cflags --libs', mandatory=True)
48 conf.check_cfg(package='avahi-client',
49 args='--cflags --libs', mandatory=True)
50 conf.check_cfg(package='alsa',
51 args='--cflags --libs', mandatory=True)
52 conf.check_cfg(package='xt',
53 args='--cflags --libs', mandatory=True)
54 conf.check_cfg(package='fftw3f',
55 args='--cflags --libs', mandatory=True)
57 conf.check_cc(header_name='cwiid.h', lib='cwiid', uselib_store='CWIID')
58 conf.check_cc(header_name='linux/input.h')
59 conf.check_cc(header_name='xmmintrin.h', ccflags=['-msse', '-mfpmath=sse'], define_name='HAVE_SSE')
61 if conf.env['HAVE_SSE']:
62 conf.env.append_unique('CCFLAGS', ['-msse', '-mfpmath=sse'])
63 conf.env.append_unique('CXXFLAGS', ['-msse', '-mfpmath=sse'])
64 conf.define('SC_MEMORY_ALIGNMENT', 16)
65 else:
66 conf.define('SC_MEMORY_ALIGNMENT', 1)
68 #conf.env['LIBDIR'] = os.path.join(conf.env['PREFIX'], 'lib')
69 #conf.env['DATADIR'] = os.path.join(conf.env['PREFIX'], 'share')
71 # global defines
72 conf.define('HAVE_ALSA', 1)
73 conf.define('HAVE_AVAHI', 1)
74 conf.define('HAVE_LID', 1)
75 conf.define('HAVE_WII', 1)
76 #conf.define('SC_AUDIO_API=SC_AUDIO_API_JACK')
77 conf.define('SC_FFT_FFTW', 1)
78 conf.define('SC_LINUX', 1)
79 #conf.define('SC_MEMORY_ALIGNMENT', 16)
80 conf.define('SC_USE_JACK_CLIENT_NEW', 1)
81 conf.define('USE_RENDEZVOUS', 1)
82 conf.define('USE_SC_TERMINAL_CLIENT', 1)
84 conf.define('SC_DATA_DIR', os.path.join(conf.env['DATADIR'], 'SuperCollider'))
85 conf.define('SC_PLUGIN_DIR', os.path.join(conf.env['LIBDIR'], 'SuperCollider', 'plugins'))
86 conf.define('SC_PLUGIN_EXT', '.so')
87 conf.define('SC_PLUGIN_LOAD_SYM', 'load')
89 # other defines from SConstruct
90 conf.env.append_unique('CCFLAGS', ['-Wno-unknown-pragmas'])
91 conf.env.append_unique('CXXFLAGS', ['-Wno-unknown-pragmas', '-Wno-deprecated'])
93 # FIXME: ugly hack but SC3 does not use config.h now
94 conf.env.append_value('CPPFLAGS', ['-include','default/waf_config.h'])
95 conf.write_config_header('waf_config.h')
97 def sc_plugin_gen(bld, name, source, uselib='', add_objects=[]):
98 obj = bld.new_task_gen('cxx', 'shlib')
99 obj.add_objects = add_objects
100 obj.env['shlib_PATTERN'] = '%s.so'
101 obj.includes = '#Headers/common #Headers/plugin_interface #Headers/server'
102 obj.install_path = '${SC_PLUGIN_DIR}/'
103 obj.source = source
104 obj.target = name
105 obj.uselib = uselib
106 return obj
108 def build(bld):
109 # objects for other targets
110 fftlib = bld.new_task_gen('cc')
111 fftlib.includes = '#Headers/common'
112 fftlib.source = 'Source/common/fftlib.c'
113 fftlib.target = 'fftlib'
115 # libcommon
116 libcommon = bld.new_task_gen('cxx', 'staticlib')
117 libcommon.includes = '#Headers/common #Headers/plugin_interface #Headers/server'
118 libcommon.source = [
119 'Source/common/SC_AllocPool.cpp',
120 'Source/common/SC_DirUtils.cpp',
121 'Source/common/sc_popen.cpp',
122 'Source/common/SC_Sem.cpp',
123 'Source/common/SC_StringBuffer.cpp',
124 'Source/common/SC_StringParser.cpp',
125 'Source/common/scsynthsend.cpp',
126 ] # libcommon_source
127 libcommon.target = 'common'
128 libcommon.install_path = None
130 # libscsynth
131 libscsynth = bld.new_task_gen('cxx', 'shlib')
132 # FIXME: AUDIOAPI -> top
133 libscsynth.defines = 'SC_AUDIO_API=SC_AUDIO_API_JACK'
134 libscsynth.includes = '#Headers/common #Headers/plugin_interface #Headers/server'
135 libscsynth.uselib = 'JACK SNDFILE AVAHI-CLIENT' # FIXME
136 libscsynth.uselib_local = 'common'
137 libscsynth.vnum = SC3_API_VERSION # FIXME
138 libscsynth.source = [
139 'Source/server/Rendezvous.cpp',
140 'Source/server/Samp.cpp',
141 'Source/server/SC_BufGen.cpp',
142 'Source/server/SC_Carbon.cpp',
143 'Source/server/SC_Complex.cpp',
144 'Source/server/SC_ComPort.cpp',
145 'Source/server/SC_CoreAudio.cpp',
146 'Source/server/SC_Dimension.cpp',
147 'Source/server/SC_Errors.cpp',
148 'Source/server/SC_Graph.cpp',
149 'Source/server/SC_GraphDef.cpp',
150 'Source/server/SC_Group.cpp',
151 'Source/server/SC_Lib_Cintf.cpp',
152 'Source/server/SC_Lib.cpp',
153 'Source/server/SC_MiscCmds.cpp',
154 'Source/server/SC_Node.cpp',
155 'Source/server/SC_Rate.cpp',
156 'Source/server/SC_SequencedCommand.cpp',
157 'Source/server/SC_Str4.cpp',
158 'Source/server/SC_SyncCondition.cpp',
159 'Source/server/SC_Unit.cpp',
160 'Source/server/SC_UnitDef.cpp',
161 'Source/server/SC_World.cpp',
162 # FIXME:
163 'Source/server/SC_Jack.cpp',
164 ] # libscsynth_source
165 libscsynth.target = 'scsynth'
167 #uselib_local = 'my_static_lib',
169 scsynth = bld.new_task_gen('cxx', 'program')
170 #scsynth.defines = sc3_defines
171 scsynth.includes = '#Headers/common #Headers/plugin_interface #Headers/server'
172 scsynth.source = ['Source/server/scsynth_main.cpp'] #+ common_sources
173 scsynth.target = 'scsynth'
174 scsynth.uselib_local = 'scsynth' # FIXME
175 #scsynth.uselib = ['JACK']
177 # libsclang
178 libsclang = bld.new_task_gen('cxx', 'shlib')
179 #libsclang.defines = sc3_defines
180 libsclang.includes = '#Headers/common #Headers/plugin_interface #Headers/lang #Source/lang/LangSource/Bison'
181 libsclang.target = 'sclang'
182 libsclang.uselib_local = 'common'
183 libsclang.uselib = 'SNDFILE CWIID ALSA'
184 libsclang.vnum = SC3_API_VERSION # FIXME
185 libsclang.source = [
186 'Source/lang/LangPrimSource/OSCData.cpp',
187 'Source/lang/LangPrimSource/PyrArchiver.cpp',
188 'Source/lang/LangPrimSource/PyrArrayPrimitives.cpp',
189 'Source/lang/LangPrimSource/PyrBitPrim.cpp',
190 'Source/lang/LangPrimSource/PyrCharPrim.cpp',
191 'Source/lang/LangPrimSource/PyrFilePrim.cpp',
192 'Source/lang/LangPrimSource/PyrListPrim.cpp',
193 'Source/lang/LangPrimSource/PyrMathPrim.cpp',
194 'Source/lang/LangPrimSource/PyrPlatformPrim.cpp',
195 'Source/lang/LangPrimSource/PyrPrimitive.cpp',
196 'Source/lang/LangPrimSource/PyrSched.cpp',
197 'Source/lang/LangPrimSource/PyrSerialPrim.cpp',
198 'Source/lang/LangPrimSource/PyrSignalPrim.cpp',
199 'Source/lang/LangPrimSource/PyrStringPrim.cpp',
200 'Source/lang/LangPrimSource/PyrSymbolPrim.cpp',
201 'Source/lang/LangPrimSource/PyrUnixPrim.cpp',
202 'Source/lang/LangPrimSource/PyrUStringPrim.cpp',
203 'Source/lang/LangPrimSource/SC_ComPort.cpp',
204 'Source/lang/LangPrimSource/SC_Wii.cpp',
205 'Source/lang/LangSource/AdvancingAllocPool.cpp',
206 'Source/lang/LangSource/alloca.cpp',
207 'Source/lang/LangSource/Bison/lang11d_tab.cpp',
208 'Source/lang/LangSource/ByteCodeArray.cpp',
209 'Source/lang/LangSource/dumpByteCodes.cpp',
210 'Source/lang/LangSource/DumpParseNode.cpp',
211 'Source/lang/LangSource/GC.cpp',
212 'Source/lang/LangSource/InitAlloc.cpp',
213 'Source/lang/LangSource/PyrFileUtils.cpp',
214 'Source/lang/LangSource/PyrInterpreter3.cpp',
215 'Source/lang/LangSource/PyrLexer.cpp',
216 'Source/lang/LangSource/PyrMathOps.cpp',
217 'Source/lang/LangSource/PyrMathSupport.cpp',
218 'Source/lang/LangSource/PyrMessage.cpp',
219 'Source/lang/LangSource/PyrObject.cpp',
220 'Source/lang/LangSource/PyrParseNode.cpp',
221 'Source/lang/LangSource/PyrSignal.cpp',
222 'Source/lang/LangSource/PyrSymbolTable.cpp',
223 'Source/lang/LangSource/Samp.cpp',
224 'Source/lang/LangSource/SC_LanguageClient.cpp',
225 'Source/lang/LangSource/SC_LibraryConfig.cpp',
226 'Source/lang/LangSource/SC_TerminalClient.cpp',
227 'Source/lang/LangSource/SimpleStack.cpp',
228 'Source/lang/LangSource/VMGlobals.cpp',
229 # FIXME:
230 #'Source/common/fftlib.c',
231 'Source/lang/LangPrimSource/SC_LID.cpp',
232 'Source/lang/LangPrimSource/SC_AlsaMIDI.cpp',
233 ] # libsclang_source
234 libsclang.add_objects = 'fftlib' # FIXME
236 # sclang
237 sclang = bld.new_task_gen('cxx', 'program')
238 sclang.includes = '#Headers/lang #Headers/plugin_interface #Headers/common'
239 sclang.source = ['Source/lang/LangSource/cmdLineFuncs.cpp'] #+ common_sources
240 sclang.target = 'sclang'
241 sclang.uselib_local = 'sclang scsynth'
243 # plugins
244 sccomplex = bld.new_task_gen('cxx')
245 sccomplex.includes = '#Headers/common #Headers/plugin_interface #Headers/server'
246 sccomplex.source = 'Source/plugins/SCComplex.cpp'
247 sccomplex.target = 'SCComplex'
249 stdugens = [
250 'BinaryOpUGens',
251 'ChaosUGens',
252 'DelayUGens',
253 'DemandUGens',
254 'DynNoiseUGens',
255 'FilterUGens',
256 'GendynUGens',
257 'IOUGens',
258 'LFUGens',
259 'MulAddUGens',
260 'NoiseUGens',
261 'OscUGens',
262 'PanUGens',
263 'PhysicalModelingUGens',
264 'TestUGens',
265 'TriggerUGens',
266 'UnaryOpUGens',
267 'GrainUGens',
268 'ReverbUGens'
269 ] # ugens
270 for name in stdugens:
271 sc_plugin_gen(bld, name, source=os.path.join('Source', 'plugins', name + '.cpp'))
273 sc_plugin_gen(bld, 'FFTUgens', source=[
274 'Source/plugins/FFTInterfaceTable.cpp',
275 'Source/plugins/FFT_UGens.cpp',
276 'Source/plugins/PV_UGens.cpp',
277 'Source/plugins/PartitionedConvolution.cpp',
278 'Source/common/SC_fftlib.cpp'], # XXX: special inline
279 uselib='FFTW3F',
280 add_objects='SCComplex')
282 sc_plugin_gen(bld, 'PVThirdParty', source=[
283 'Source/plugins/Convolution.cpp',
284 'Source/plugins/FFT2InterfaceTable.cpp',
285 'Source/plugins/FeatureDetection.cpp',
286 'Source/plugins/PV_ThirdParty.cpp',
287 'Source/common/SC_fftlib.cpp'], # XXX: special inline
288 uselib='FFTW3F',
289 add_objects='SCComplex')
291 sc_plugin_gen(bld, 'UnpackFFTUGens', source=[
292 'Source/plugins/UnpackFFTUGens.cpp'],
293 add_objects='SCComplex')
295 sc_plugin_gen(bld, 'MLUgens', source=[
296 'Source/plugins/ML.cpp',
297 'Source/plugins/Loudness.cpp',
298 'Source/plugins/BeatTrack.cpp',
299 'Source/plugins/Onsets.cpp',
300 'Source/plugins/onsetsds.c',
301 'Source/plugins/KeyTrack.cpp',
302 'Source/plugins/MFCC.cpp',
303 'Source/plugins/BeatTrack2.cpp',
304 'Source/plugins/ML_SpecStats.cpp'],
305 add_objects='SCComplex')
307 sc_plugin_gen(bld, 'DiskIOUgens', source=[
308 'Source/server/SC_SyncCondition.cpp',
309 'Source/plugins/DiskIO_UGens.cpp'])
311 sc_plugin_gen(bld, 'MouseUGens',
312 source=os.path.join('Source', 'plugins', 'MouseUGens.cpp'),
313 uselib='XT')
314 sc_plugin_gen(bld, 'KeyboardUGens',
315 source=os.path.join('Source', 'plugins', 'KeyboardUGens.cpp'),
316 uselib='XT')
318 # install headers
319 bld.install_files('${PREFIX}/include/SuperCollider/common', 'Headers/common/*.h')
320 bld.install_files('${PREFIX}/include/SuperCollider/lang', 'Headers/lang/*.h')
321 bld.install_files('${PREFIX}/include/SuperCollider/plugin_interface', 'Headers/plugin_interface/*.h')
322 bld.install_files('${PREFIX}/include/SuperCollider/server', 'Headers/server/*.h')
324 #bld.install_files('${PREFIX}/share/SuperCollider/',
325 # bld.path.ant_glob('build/SCClassLibrary/**/*.sc'),
326 # relative_trick=True)
327 #classfiles = bld.path.ant_glob('build/SCClassLibrary/**/*.sc', flat=True)
328 #for f in classfiles.split('build/'):
329 # print f