5
SCons build file for Csound 5:
6
API library, plugin opcodes, utilities, and front ends.
8
By Michael Gogins <gogins at pipeline dot com>
10
For custom options, run 'scons -h'.
11
For default options, run 'scons -H'.
12
If headers or libraries are not found, edit 'custom.py'.
13
For Linux, run in the standard shell
14
with standard Python and just run 'scons'.
15
For MinGW, run in the MSys shell
16
and use www.python.org WIN32 Python to run scons.
17
For Microsoft Visual C++, run in the Platform SDK
18
command shell, and use www.python.org WIN32 Python to run scons.
30
#############################################################################
34
#############################################################################
39
H/cfgvar.h H/cscore.h H/csdl.h H/csound.h H/csound.hpp H/csoundCore.h
40
H/cwindow.h H/msg_attr.h H/OpcodeBase.hpp H/pstream.h H/pvfileio.h
41
H/soundio.h H/sysdep.h H/text.h H/version.h H/float-version.h
42
interfaces/CsoundFile.hpp interfaces/CppSound.hpp interfaces/filebuilding.h
48
return time.strftime("%Y-%m-%d", time.localtime())
50
# Detect OPERATING SYSTEM platform.
53
if sys.platform[:5] == 'linux':
55
elif sys.platform[:3] == 'win':
57
elif sys.platform[:6] == 'darwin':
59
elif sys.platform[:5] == 'sunos':
64
#############################################################################
66
# DEFINE CONFIGURATION
68
#############################################################################
70
print "System platform is '" + getPlatform() + "'."
73
# Create options that can be set from the command line.
75
commandOptions = Options()
76
commandOptions.Add('CC')
77
commandOptions.Add('CXX')
78
commandOptions.Add('LINK')
79
commandOptions.Add('LINKFLAGS')
80
commandOptions.Add('custom',
81
'Specify name of custom options file (default is "custom.py")',
83
commandOptions.Add('useDouble',
84
'Set to 1 to use double-precision floating point for audio samples.',
86
commandOptions.Add('usePortAudio',
87
'Set to 1 to use PortAudio for real-time audio input and output.',
89
commandOptions.Add('usePortMIDI',
90
'Build PortMidi plugin for real time MIDI input and output.',
92
commandOptions.Add('useALSA',
93
'Set to 1 to use ALSA for real-time audio and MIDI input and output.',
95
commandOptions.Add('useJack',
96
'Set to 1 if you compiled PortAudio to use Jack; also builds Jack plugin.',
98
commandOptions.Add('useFLTK',
99
'Set to 1 to use FLTK for graphs and widget opcodes.',
101
commandOptions.Add('noFLTKThreads',
102
'Set to 1 to disable use of a separate thread for FLTK widgets.',
104
commandOptions.Add('pythonVersion',
105
'Set to the Python version to be used.',
106
'%d.%d' % (int(sys.hexversion) >> 24, (int(sys.hexversion) >> 16) & 255))
107
commandOptions.Add('buildCsoundVST',
108
'Set to 1 to build CsoundVST (needs CsoundAC, FLTK, boost, Python, SWIG).',
110
commandOptions.Add('buildCsoundAC',
111
'Set to 1 to build CsoundAC (needs FLTK, boost, Python, SWIG).',
113
commandOptions.Add('buildCsound5GUI',
114
'Build FLTK GUI frontend (requires FLTK 1.1.7 or later).',
116
commandOptions.Add('generateTags',
117
'Set to 1 to generate TAGS',
119
commandOptions.Add('generatePdf',
120
'Set to 1 to generate PDF documentation',
122
commandOptions.Add('buildLoris',
123
'Set to 1 to build the Loris Python extension and opcodes',
125
commandOptions.Add('useOSC',
126
'Set to 1 if you want OSC support',
128
commandOptions.Add('bufferoverflowu',
129
'Set to 1 to use the Windows buffer overflow library, required if you use MinGW to link with MSVC-built libraries',
131
if getPlatform() != 'win32':
132
commandOptions.Add('useUDP',
133
'Set to 0 if you do not want UDP support',
136
commandOptions.Add('useUDP',
137
'Set to 1 if you want UDP support',
139
commandOptions.Add('buildPythonOpcodes',
140
'Set to 1 to build Python opcodes',
142
commandOptions.Add('buildLuaOpcodes',
143
'Set to 1 to build Lua opcodes',
145
commandOptions.Add('prefix',
146
'Base directory for installs. Defaults to /usr/local.',
148
commandOptions.Add('instdir',
149
'For the install target: puts instdir before the prefix',
151
commandOptions.Add('buildRelease',
152
'Set to 1 to build for release (implies noDebug).',
154
commandOptions.Add('noDebug',
155
'Build without debugging information.',
157
commandOptions.Add('gcc3opt',
158
'Enable gcc 3.3.x or later optimizations for the specified CPU architecture (e.g. pentium3); implies noDebug.',
160
commandOptions.Add('gcc4opt',
161
'Enable gcc 4.0 or later optimizations for the specified CPU architecture (e.g. pentium3); implies noDebug.',
163
commandOptions.Add('useLrint',
164
'Use lrint() and lrintf() for converting floating point values to integers.',
166
commandOptions.Add('useGprof',
167
'Build with profiling information (-pg).',
169
commandOptions.Add('Word64',
170
'Build for 64bit computer',
172
commandOptions.Add('Lib64',
173
'Build for lib64 rather than lib',
175
if getPlatform() == 'win32':
176
commandOptions.Add('dynamicCsoundLibrary',
177
'Set to 0 to build static Csound library instead of csound.dll',
180
commandOptions.Add('dynamicCsoundLibrary',
181
'Build dynamic Csound library instead of libcsound.a',
183
commandOptions.Add('buildStkOpcodes',
184
"Build opcodes encapsulating Perry Cook's Synthesis Toolkit in C++ instruments and effects",
186
commandOptions.Add('install',
187
'Enables the Install targets',
189
commandOptions.Add('buildPDClass',
190
"build csoundapi~ PD class (needs m_pd.h in the standard places)",
192
commandOptions.Add('useCoreAudio',
193
"Set to 1 to use CoreAudio for real-time audio input and output.",
195
commandOptions.Add('useAltivec',
196
"On OSX use the gcc AltiVec optmisation flags",
198
commandOptions.Add('buildDSSI',
199
"Build DSSI/LADSPA host opcodes",
201
commandOptions.Add('buildUtilities',
202
"Build stand-alone executables for utilities that can also be used with -U",
204
commandOptions.Add('buildTclcsound',
205
"Build Tclcsound frontend (cstclsh, cswish and tclcsound dynamic module). Requires Tcl/Tk headers and libs",
207
commandOptions.Add('buildWinsound',
208
"Build Winsound frontend. Requires FLTK headers and libs",
210
commandOptions.Add('buildVirtual',
211
"Build Virtual MIDI keyboard. Requires FLTK 1.1.7 or later headers and libs",
213
commandOptions.Add('buildInterfaces',
214
"Build C++ interface library.",
216
commandOptions.Add('buildLuaWrapper',
217
'Set to 1 to build Lua wrapper for the C++ interface library (needs buildInterfaces).',
219
commandOptions.Add('buildPythonWrapper',
220
'Set to 1 to build Python wrapper for the C++ interface library (needs buildInterfaces).',
222
commandOptions.Add('buildJavaWrapper',
223
'Set to 1 to build Java wrapper for the C++ interface library (needs buildInterfaces).',
225
commandOptions.Add('buildOSXGUI',
226
'On OSX, set to 1 to build the basic GUI frontend',
228
commandOptions.Add('buildCSEditor',
229
'Set to 1 to build the Csound syntax highlighting text editor. Requires FLTK headers and libs',
231
commandOptions.Add('withICL',
232
'On Windows, set to 1 to build with the Intel C++ Compiler (also requires Microsoft Visual C++), or set to 0 to build with MinGW',
234
commandOptions.Add('withMSVC',
235
'On Windows, set to 1 to build with Microsoft Visual C++, or set to 0 to build with MinGW',
237
commandOptions.Add('withSunStudio',
238
'On Solaris, set to 1 to build with Sun Studio, or set to 0 to build with gcc',
240
commandOptions.Add('buildNewParser',
241
'Enable building new parser (requires Flex/Bison)',
243
commandOptions.Add('NewParserDebug',
244
'Enable tracing of new parser',
246
commandOptions.Add('buildMultiCore',
247
'Enable building for multicore sytem (requires new parser)',
249
commandOptions.Add('buildvst4cs',
250
'Set to 1 to build vst4cs plugins (requires Steinberg VST headers)',
252
if getPlatform() == 'win32':
253
commandOptions.Add('useGettext',
254
'Set to 1 to use the GBU internationalisation/localisation scheme',
257
commandOptions.Add('useGettext',
258
'Set to 0 for none and 1 for GNU internationalisation/localisation scheme',
260
commandOptions.Add('buildImageOpcodes',
261
'Set to 0 to avoid building image opcodes',
263
commandOptions.Add('useOpenMP',
264
'Set to 1 to use OpenMP for parallel performance',
266
commandOptions.Add('tclversion',
269
commandOptions.Add('includeMP3',
270
'Set to 1 if using mpadec',
272
commandOptions.Add('includeWii',
273
'Set to 1 if using libwiimote',
275
commandOptions.Add('includeP5Glove',
276
'Set to 1 if using P5 Glove',
278
commandOptions.Add('buildBeats',
279
'Set to 1 if building beats score language',
281
commandOptions.Add('buildcatalog',
282
'Set to 1 if building opcode/library catalogue',
284
commandOptions.Add('includeSerial',
285
'Set to 1 if compiling serial code',
287
# Define the common part of the build environment.
288
# This section also sets up customized options for third-party libraries, which
289
# should take priority over default options.
291
commonEnvironment = Environment(ENV = os.environ)
292
commandOptions.Update(commonEnvironment)
295
if getPlatform() == 'win32' and commonEnvironment['withICL'] == '1':
300
def compilerMicrosoft():
301
if getPlatform() == 'win32' and commonEnvironment['withMSVC'] == '1':
307
if getPlatform() == 'sunos' and commonEnvironment['withSunStudio'] == '1':
313
if not compilerIntel() and not compilerMicrosoft() and not compilerSun():
318
optionsFilename = 'custom.py'
321
Tool('icl')(commonEnvironment)
322
optionsFilename = 'custom-msvc.py'
323
elif compilerMicrosoft():
324
optionsFilename = 'custom-msvc.py'
325
elif getPlatform() == 'win32':
326
# On Windows, to exclude MSVC tools,
327
# we have to force MinGW tools and then re-create
328
# the environment from scratch.
329
commonEnvironment = Environment(ENV = os.environ, tools = ['mingw', 'swig', 'javac', 'jar'])
330
commandOptions.Update(commonEnvironment)
331
#Tool('mingw')(commonEnvironment)
332
optionsFilename = 'custom-mingw.py'
334
Help(commandOptions.GenerateHelpText(commonEnvironment))
336
if commonEnvironment['custom']:
337
optionsFilename = commonEnvironment['custom']
339
Requires(optionsFilename, commonEnvironment)
341
print "Using options from '%s.'" % optionsFilename
343
fileOptions = Options(optionsFilename)
344
fileOptions.Add('customCPPPATH', 'List of custom CPPPATH variables')
345
fileOptions.Add('customCCFLAGS')
346
fileOptions.Add('customCXXFLAGS')
347
fileOptions.Add('customLIBS')
348
fileOptions.Add('customLIBPATH')
349
fileOptions.Add('customSHLINKFLAGS')
350
fileOptions.Add('customSWIGFLAGS')
351
fileOptions.Update(commonEnvironment)
353
customCPPPATH = commonEnvironment['customCPPPATH']
354
commonEnvironment.Prepend(CPPPATH = customCPPPATH)
355
customCCFLAGS = commonEnvironment['customCCFLAGS']
356
commonEnvironment.Prepend(CCFLAGS = customCCFLAGS)
357
customCXXFLAGS = commonEnvironment['customCXXFLAGS']
358
commonEnvironment.Prepend(CXXFLAGS = customCXXFLAGS)
359
customLIBS = commonEnvironment['customLIBS']
360
commonEnvironment.Prepend(LIBS = customLIBS)
361
customLIBPATH = commonEnvironment['customLIBPATH']
362
commonEnvironment.Prepend(LIBPATH = customLIBPATH)
363
customSHLINKFLAGS = commonEnvironment['customSHLINKFLAGS']
364
commonEnvironment.Prepend(SHLINKFLAGS = customSHLINKFLAGS)
365
customSWIGFLAGS = commonEnvironment['customSWIGFLAGS']
366
commonEnvironment.Prepend(SWIGFLAGS = customSWIGFLAGS)
368
# Define options for different platforms.
369
if getPlatform() != 'win32' and getPlatform() != 'sunos':
370
print "Build platform is '" + getPlatform() + "'."
371
elif getPlatform() == 'sunos':
373
print "Build platform is Sun Studio."
375
print "Build platform is '" + getPlatform() + "'."
377
if compilerMicrosoft():
378
print "Build platform is Microsoft Visual C++ (MSVC)."
379
elif compilerIntel():
380
print "Build platform is the Intel C++ Compiler (ICL)."
382
print "Build platform is MinGW/MSYS"
384
print "SCons tools on this platform: ", commonEnvironment['TOOLS']
386
commonEnvironment.Prepend(CPPPATH = ['.', './H'])
387
if commonEnvironment['useLrint'] != '0':
388
commonEnvironment.Prepend(CCFLAGS = ['-DUSE_LRINT'])
390
cf = Configure(commonEnvironment)
391
if commonEnvironment['useGettext'] == '1':
392
if cf.CheckHeader("libintl.h"):
393
print "CONFIGURATION DECISION: Using GNU gettext scheme"
394
commonEnvironment.Prepend(CCFLAGS = ['-DGNU_GETTEXT'])
395
if getPlatform() == "win32":
396
commonEnvironment.Append(LIBS=['intl'])
397
if getPlatform() == "darwin":
398
commonEnvironment.Append(LIBS=['intl'])
399
if getPlatform() == "sunos":
400
commonEnvironment.Append(LIBS=['intl'])
402
print "CONFIGURATION DECISION: No localisation"
404
commonEnvironment = cf.Finish()
407
commonEnvironment.Prepend(CCFLAGS = ['-Wno-format'])
408
commonEnvironment.Prepend(CXXFLAGS = ['-Wno-format'])
410
if commonEnvironment['gcc4opt'] == 'atom':
411
commonEnvironment.Prepend(CCFLAGS = Split('-mtune=prescott -O2 -fomit-frame-pointer'))
412
elif commonEnvironment['gcc3opt'] != '0' or commonEnvironment['gcc4opt'] != '0':
413
commonEnvironment.Prepend(CCFLAGS = ['-ffast-math'])
414
if commonEnvironment['gcc4opt'] != '0':
415
commonEnvironment.Prepend(CCFLAGS = ['-ftree-vectorize'])
416
cpuType = commonEnvironment['gcc4opt']
418
cpuType = commonEnvironment['gcc3opt']
419
if getPlatform() == 'darwin':
420
if cpuType == 'universal':
421
commonEnvironment.Prepend(CCFLAGS = Split('-O3 -arch i386 -arch ppc '))
422
commonEnvironment.Prepend(CXXFLAGS = Split('-O3 -arch i386 -arch ppc '))
423
commonEnvironment.Prepend(LINKFLAGS = Split('-arch i386 -arch ppc '))
424
elif cpuType == 'universalX86':
425
commonEnvironment.Prepend(CCFLAGS = Split('-O3 -arch i386 -arch x86_64 '))
426
commonEnvironment.Prepend(CXXFLAGS = Split('-O3 -arch i386 -arch x86_64 '))
427
commonEnvironment.Prepend(LINKFLAGS = Split('-arch i386 -arch x86_64 '))
429
commonEnvironment.Prepend(CCFLAGS = Split('-O3 -arch %s' % cpuType))
430
commonEnvironment.Prepend(CXXFLAGS = Split('-O3 -arch %s' % cpuType))
432
commonEnvironment.Prepend(CCFLAGS = Split('-O3 -mtune=%s' % (cpuType)))
435
if commonEnvironment['buildRelease'] != '0':
436
if compilerMicrosoft():
437
commonEnvironment.Append(CCFLAGS = Split('/O2'))
438
elif compilerIntel():
439
commonEnvironment.Append(CCFLAGS = Split('/O3'))
441
if commonEnvironment['noDebug'] == '0':
443
commonEnvironment.Append(CCFLAGS = ['-g'])
445
if commonEnvironment['useGprof'] == '1':
446
commonEnvironment.Append(CCFLAGS = ['-pg'])
447
commonEnvironment.Append(CXXFLAGS = ['-pg'])
448
commonEnvironment.Append(LINKFLAGS = ['-pg'])
449
commonEnvironment.Append(SHLINKFLAGS = ['-pg'])
450
elif commonEnvironment['gcc3opt'] != 0 or commonEnvironment['gcc4opt'] != '0':
451
if not compilerSun() and commonEnvironment['gcc4opt'] != 'atom':
452
commonEnvironment.Append(CCFLAGS = ['-fomit-frame-pointer'])
453
commonEnvironment.Append(CCFLAGS = ['-freorder-blocks'])
455
if getPlatform() == 'win32' and compilerGNU():
456
commonEnvironment.Prepend(CCFLAGS = Split('-fexceptions -shared-libgcc'))
457
commonEnvironment.Prepend(CXXFLAGS = Split('-fexceptions -shared-libgcc'))
458
commonEnvironment.Prepend(LINKFLAGS = Split('-fexceptions -shared-libgcc'))
459
commonEnvironment.Prepend(SHLINKFLAGS = Split('-fexceptions -shared-libgcc'))
461
commonEnvironment.Prepend(LIBPATH = ['.', '#.'])
463
if commonEnvironment['buildRelease'] == '0':
464
commonEnvironment.Prepend(CPPFLAGS = ['-DBETA'])
466
if commonEnvironment['Lib64'] == '1':
467
if getPlatform() == 'sunos':
468
commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/lib/64', '/usr/lib/64'])
470
commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/usr/local/lib64'])
472
commonEnvironment.Prepend(LIBPATH = ['.', '#.', '/usr/local/lib'])
474
if commonEnvironment['Word64'] == '1':
476
commonEnvironment.Append(CCFLAGS = ['-xcode=pic32'])
478
commonEnvironment.Append(CCFLAGS = ['-fPIC'])
481
if commonEnvironment['useDouble'] == '0':
482
print 'CONFIGURATION DECISION: Using single-precision floating point for audio samples.'
484
print 'CONFIGURATION DECISION: Using double-precision floating point for audio samples.'
485
commonEnvironment.Append(CPPFLAGS = ['-DUSE_DOUBLE'])
487
# Define different build environments for different types of targets.
489
if getPlatform() == 'linux':
490
commonEnvironment.Append(CCFLAGS = "-DLINUX")
491
commonEnvironment.Append(CPPFLAGS = ['-DHAVE_SOCKETS'])
492
commonEnvironment.Append(CPPPATH = '/usr/local/include')
493
commonEnvironment.Append(CPPPATH = '/usr/include')
494
commonEnvironment.Append(CPPPATH = '/usr/include')
495
commonEnvironment.Append(CPPPATH = '/usr/X11R6/include')
496
commonEnvironment.Append(CCFLAGS = "-DPIPES")
497
commonEnvironment.Append(LINKFLAGS = ['-Wl,-Bdynamic'])
498
elif getPlatform() == 'sunos':
499
commonEnvironment.Append(CCFLAGS = "-D_SOLARIS")
500
commonEnvironment.Append(CPPPATH = '/usr/local/include')
501
commonEnvironment.Append(CPPPATH = '/usr/include')
502
commonEnvironment.Append(CPPPATH = '/usr/jdk/instances/jdk1.5.0/include')
504
commonEnvironment.Append(CCFLAGS = "-DPIPES")
505
commonEnvironment.Append(LINKFLAGS = ['-Wl,-Bdynamic'])
506
elif getPlatform() == 'darwin':
507
commonEnvironment.Append(CCFLAGS = "-DMACOSX")
508
commonEnvironment.Append(CPPPATH = '/usr/local/include')
509
commonEnvironment.Append(CCFLAGS = "-DPIPES")
510
if commonEnvironment['useAltivec'] == '1':
511
print 'CONFIGURATION DECISION: Using Altivec optimisation'
512
commonEnvironment.Append(CCFLAGS = "-faltivec")
513
elif getPlatform() == 'win32':
514
commonEnvironment.Append(CCFLAGS = '-D_WIN32')
515
commonEnvironment.Append(CCFLAGS = '-DWIN32')
516
commonEnvironment.Append(CCFLAGS = '-DPIPES')
517
commonEnvironment.Append(CCFLAGS = '-DOS_IS_WIN32')
518
commonEnvironment.Append(CXXFLAGS = '-D_WIN32')
519
commonEnvironment.Append(CXXFLAGS = '-DWIN32')
520
commonEnvironment.Append(CXXFLAGS = '-DPIPES')
521
commonEnvironment.Append(CXXFLAGS = '-DOS_IS_WIN32')
522
commonEnvironment.Append(CXXFLAGS = '-DFL_DLL')
524
commonEnvironment.Prepend(CCFLAGS = "-Wall")
525
commonEnvironment.Append(CPPPATH = '/usr/local/include')
526
commonEnvironment.Append(CPPPATH = '/usr/include')
527
commonEnvironment.Append(SHLINKFLAGS = Split(' -mno-cygwin -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc'))
528
commonEnvironment.Append(LINKFLAGS = Split(' -mno-cygwin -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc'))
530
commonEnvironment.Append(CCFLAGS = '/DMSVC')
531
commonEnvironment.Append(CXXFLAGS = '/EHsc')
532
commonEnvironment.Append(CCFLAGS = '/D_CRT_SECURE_NO_DEPRECATE')
533
commonEnvironment.Append(CCFLAGS = '/MD')
534
commonEnvironment.Append(CCFLAGS = '/W2')
535
commonEnvironment.Append(CCFLAGS = '/wd4251')
536
commonEnvironment.Append(CCFLAGS = '/wd4996')
537
commonEnvironment.Append(CCFLAGS = '/MP')
538
commonEnvironment.Append(CCFLAGS = '/GR')
539
commonEnvironment.Append(CCFLAGS = '/G7')
540
commonEnvironment.Append(CCFLAGS = '/D_SCL_SECURE_NO_DEPRECATE')
541
commonEnvironment.Prepend(CCFLAGS = Split('''/Zi /D_NDEBUG /DNDEBUG'''))
542
commonEnvironment.Prepend(LINKFLAGS = Split('''/INCREMENTAL:NO /OPT:REF /OPT:ICF /DEBUG'''))
543
commonEnvironment.Prepend(SHLINKFLAGS = Split('''/INCREMENTAL:NO /OPT:REF /OPT:ICF /DEBUG'''))
544
# With Visual C++ it is now necessary to embed the manifest into the target.
545
commonEnvironment['LINKCOM'] = [commonEnvironment['LINKCOM'],
546
'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1']
547
commonEnvironment['SHLINKCOM'] = [commonEnvironment['SHLINKCOM'],
548
'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;2']
549
if compilerMicrosoft():
550
commonEnvironment.Append(CCFLAGS = '/arch:sse')
552
print 'Generating code optimized for Intel Core 2 Duo and Pentium 4 that will run on other processors also.'
553
commonEnvironment.Append(CCFLAGS = Split('/O3 /QaxTP'))
555
if getPlatform() == 'linux':
556
path1 = '/usr/include/python%s' % commonEnvironment['pythonVersion']
557
path2 = '/usr/local/include/python%s' % commonEnvironment['pythonVersion']
558
pythonIncludePath = [path1, path2]
559
path1 = '/usr/include/tcl%s' % commonEnvironment['tclversion']
560
path2 = '/usr/include/tk%s' % commonEnvironment['tclversion']
561
tclIncludePath = [path1, path2]
563
if commonEnvironment['Lib64'] == '1':
564
tmp = '/usr/lib64/python%s/config' % commonEnvironment['pythonVersion']
565
pythonLibraryPath = ['/usr/local/lib64', '/usr/lib64', tmp]
567
tmp = '/usr/lib/python%s/config' % commonEnvironment['pythonVersion']
568
pythonLibraryPath = ['/usr/local/lib', '/usr/lib', tmp]
569
pythonLibs = ['python%s' % commonEnvironment['pythonVersion']]
570
elif getPlatform() == 'sunos':
571
path1 = '/usr/include/python%s' % commonEnvironment['pythonVersion']
572
path2 = '/usr/local/include/python%s' % commonEnvironment['pythonVersion']
573
pythonIncludePath = [path1, path2]
575
if commonEnvironment['Lib64'] == '1':
576
pythonLibraryPath = ['/usr/local/lib/64', '/usr/lib/64']
578
pythonLibraryPath = ['/usr/local/lib', '/usr/lib']
579
pythonLibs = ['python%s' % commonEnvironment['pythonVersion']]
581
elif getPlatform() == 'darwin':
582
# find Mac OS X major version
583
fout = os.popen("uname -r")
584
kernelstr = fout.readline()
586
OSXvers = int(kernelstr[:kernelstr.find('.')]) - 4
587
print "Mac OS X version 10.%d" % OSXvers
588
# dictionary mapping OS X version to Apple Python version
589
# ex. 4:3 maps OS X 10.4 to Python 2.3
590
# Note that OS X 10.2 did not ship with a Python framework
591
# and 10.0 and 10.1 shipped with no Python at all
592
OSXSystemPythonVersions = { 0:0, 1:0, 2:2, 3:3, 4:3, 5:5, 6:6, 7:7 }
593
sysPyVers = OSXSystemPythonVersions[OSXvers]
595
print "Apple Python version is 2.%d" % sysPyVers
596
# vers = (int(sys.hexversion) >> 24, (int(sys.hexversion) >> 16) & 255)
597
vers = sys.version_info
598
pvers = "%s.%s" % (vers[0], vers[1])
599
# This logic is not quite right on OS X 10.2 and earlier
600
# or if the MacPython version equals the expected Apple Python version
601
if vers[1] == sysPyVers:
602
print "Current Python version is %s, using Apple Python Framework" % pvers
603
pyBasePath = '/System/Library/Frameworks/Python.framework'
605
print "Current Python version is %s, using MacPython Framework" % pvers
606
pyBasePath = '/Library/Frameworks/Python.framework'
607
if commonEnvironment['pythonVersion'] != pvers:
608
commonEnvironment['pythonVersion'] = pvers
609
print "WARNING python version used is " + pvers
610
pythonIncludePath = ['%s/Headers' % pyBasePath]
611
pythonLinkFlags = [ '-F' + pyBasePath, '-framework', 'python']
612
path1 = '%s/Versions/Current/lib' % pyBasePath
613
path2 = '%s/python%s/config' % (path1, commonEnvironment['pythonVersion'])
614
pythonLibraryPath = [path1, path2]
617
elif getPlatform() == 'win32':
618
pythonIncludePath = []
620
pythonLibraryPath = []
622
pythonLibs = ['python%s' % commonEnvironment['pythonVersion'].replace('.', '')]
624
pythonIncludePath = []
626
pythonLibaryPath = []
631
# Check for prerequisites.
632
# We check only for headers; checking for libs may fail
633
# even if they are present, due to secondary dependencies.
636
'int foobar(void)\n{\nreturn (int) SF_FORMAT_SD2;\n}',
637
'int foobar(SF_INSTRUMENT *p)\n{\nreturn (int) p->loop_count;\n}',
638
'int foobar(void)\n{\nreturn (int) SFC_GET_SIGNAL_MAX;\n}'
641
def CheckSndFile1011(context):
642
context.Message('Checking for libsndfile version 1.0.11 or later... ')
643
testProgram = '\n#include <sndfile.h>\n\n' + libsndfileTests[0] + '\n\n'
644
result = context.TryCompile(testProgram, '.c')
645
context.Result(result)
648
def CheckSndFile1013(context):
649
context.Message('Checking for libsndfile version 1.0.13 or later... ')
650
testProgram = '\n#include <sndfile.h>\n\n' + libsndfileTests[1] + '\n\n'
651
result = context.TryCompile(testProgram, '.c')
652
context.Result(result)
655
def CheckSndFile1016(context):
656
context.Message('Checking for libsndfile version 1.0.16 or later... ')
657
testProgram = '\n#include <sndfile.h>\n\n' + libsndfileTests[2] + '\n\n'
658
result = context.TryCompile(testProgram, '.c')
659
context.Result(result)
662
def CheckGcc4(context):
663
# We need gcc4 if we want -fvisibility=hidden
664
context.Message('Checking for gcc version 4 or later... ')
665
testProgram = '''int main() {
669
#else /* GCC < 4.0 */
674
result = context.TryCompile(testProgram, '.c' )
675
context.Result(result)
678
configure = commonEnvironment.Configure(custom_tests = {
679
'CheckSndFile1011' : CheckSndFile1011,
680
'CheckSndFile1013' : CheckSndFile1013,
681
'CheckSndFile1016' : CheckSndFile1016,
682
'CheckGcc4' : CheckGcc4
685
if not configure.CheckHeader("stdio.h", language = "C"):
686
print " *** Failed to compile a simple test program. The compiler is"
687
print " *** possibly not set up correctly, or is used with invalid flags."
688
print " *** Check config.log to find out more about the error."
690
if not configure.CheckLibWithHeader("sndfile", "sndfile.h", language = "C"):
691
print "The sndfile library is required to build Csound 5."
693
if not configure.CheckLibWithHeader("pthread", "pthread.h", language = "C"):
694
print "The pthread library is required to build Csound 5."
697
# Support for GEN49 (load MP3 file)
698
if commonEnvironment['includeMP3'] == '1' : ### and configure.CheckHeader("mp3dec.h", language = "C") :
700
commonEnvironment.Append(CPPFLAGS = ['-DINC_MP3'])
701
print 'CONFIGURATION DECISION: Building with MP3 support'
704
print 'CONFIGURATION DECISION: No MP3 support'
706
if commonEnvironment['includeWii'] == '1' and configure.CheckLibWithHeader('wiiuse', "wiiuse.h", language = "C") :
708
print 'CONFIGURATION DECISION: Building with Wiimote support'
711
print 'CONFIGURATION DECISION: No Wiimote support'
713
if commonEnvironment['includeP5Glove'] == '1' :
715
print 'CONFIGURATION DECISION: Building with P5 Glove support'
718
print 'CONFIGURATION DECISION: No P5 Glove support'
720
if commonEnvironment['includeSerial'] == '1' :
722
print 'CONFIGURATION DECISION: Building with Serial code support'
725
print 'CONFIGURATION DECISION: No Serial code support'
728
#pthreadSpinlockFound = configure.CheckLibWithHeader('pthread', 'pthread.h', 'C', 'pthread_spin_lock(0);')
729
if getPlatform() != 'darwin': # pthreadSpinlockFound:
730
commonEnvironment.Append(CPPFLAGS = ['-DHAVE_PTHREAD_SPIN_LOCK'])
731
pthreadBarrierFound = configure.CheckLibWithHeader('pthread', 'pthread.h', 'C', 'pthread_barrier_init(0, 0, 0);')
732
if pthreadBarrierFound:
733
commonEnvironment.Append(CPPFLAGS = ['-DHAVE_PTHREAD_BARRIER_INIT'])
734
openMpFound = configure.CheckLibWithHeader('gomp', 'omp.h', 'C++', 'int n = omp_get_num_threads();')
735
if openMpFound and pthreadBarrierFound and commonEnvironment['useOpenMP'] == '1':
736
print 'CONFIGURATION DECISION: Using OpenMP.'
737
commonEnvironment.Append(CFLAGS = ['-fopenmp'])
738
commonEnvironment.Append(CXXFLAGS = ['-fopenmp'])
739
commonEnvironment.Append(CPPFLAGS = ['-DUSE_OPENMP'])
744
if platform.machine()[:5] == 'sparc':
745
# CSound FTBFS in SPARC if __sync_lock_test_and_set is used
746
syncLockTestAndSetFound = False
748
syncLockTestAndSetFound = configure.CheckLibWithHeader('m', 'stdint.h', 'C', '__sync_lock_test_and_set((int32_t *)0, 0);')
749
if syncLockTestAndSetFound:
750
commonEnvironment.Append(CPPFLAGS = ['-DHAVE_SYNC_LOCK_TEST_AND_SET'])
751
print 'found sync lock'
752
vstSdkFound = configure.CheckHeader("frontends/CsoundVST/vstsdk2.4/public.sdk/source/vst2.x/audioeffectx.h", language = "C++")
753
portaudioFound = configure.CheckHeader("portaudio.h", language = "C")
754
#portmidiFound = configure.CheckHeader("portmidi.h", language = "C")
755
portmidiFound = configure.CheckHeader("portmidi.h", language = "C")
756
fltkFound = configure.CheckHeader("FL/Fl.H", language = "C++")
758
fltk117Found = configure.CheckHeader("FL/Fl_Spinner.H", language = "C++")
761
boostFound = configure.CheckHeader("boost/any.hpp", language = "C++")
762
gmmFound = configure.CheckHeader("gmm/gmm.h", language = "C++")
763
alsaFound = configure.CheckLibWithHeader("asound", "alsa/asoundlib.h", language = "C")
764
oscFound = configure.CheckLibWithHeader("lo", "lo/lo.h", language = "C")
765
musicXmlFound = configure.CheckLibWithHeader('musicxml2', 'xmlfile.h', 'C++', 'MusicXML2::SXMLFile f = MusicXML2::TXMLFile::create();', autoadd=0)
767
commonEnvironment.Append(CPPFLAGS = ['-DHAVE_MUSICXML2'])
769
jackFound = configure.CheckHeader("jack/jack.h", language = "C")
770
pulseaudioFound = configure.CheckHeader("pulse/simple.h", language = "C")
771
systemStkFound = configure.CheckHeader("Stk.h", language = "C++")
772
stkFound = configure.CheckHeader("Opcodes/stk/include/Stk.h", language = "C++")
773
pdhfound = configure.CheckHeader("m_pd.h", language = "C")
774
tclhfound = configure.CheckHeader("tcl.h", language = "C")
776
for i in tclIncludePath:
778
tclhfound = tclhfound or configure.CheckHeader(tmp, language = "C")
779
zlibhfound = configure.CheckHeader("zlib.h", language = "C")
780
midiPluginSdkFound = configure.CheckHeader("funknown.h", language = "C++")
781
luaFound = configure.CheckHeader("lua.h", language = "C")
782
#print 'LUA: %s' % (['no', 'yes'][int(luaFound)])
783
swigFound = 'swig' in commonEnvironment['TOOLS']
784
print 'Checking for SWIG... %s' % (['no', 'yes'][int(swigFound)])
785
print "Python Version: " + commonEnvironment['pythonVersion']
786
pythonFound = configure.CheckHeader("Python.h", language = "C")
788
for i in pythonIncludePath:
789
tmp = '%s/Python.h' % i
790
pythonFound = pythonFound or configure.CheckHeader(tmp, language = "C")
791
if getPlatform() == 'darwin':
792
tmp = "/System/Library/Frameworks/JavaVM.framework/Headers/jni.h"
793
javaFound = configure.CheckHeader(tmp, language = "C++")
795
javaFound = configure.CheckHeader("jni.h", language = "C++")
796
if getPlatform() == 'linux' and not javaFound:
797
if commonEnvironment['buildInterfaces'] != '0':
798
if commonEnvironment['buildJavaWrapper'] != '0':
800
if commonEnvironment['Lib64'] == '1':
802
for i in ['java', 'jvm/java', 'jvm/java-1.5.0']:
803
javaIncludePath = '%s/%s/include' % (baseDir, i)
804
tmp = '%s/linux/jni_md.h' % javaIncludePath
805
if configure.CheckHeader(tmp, language = "C++"):
809
commonEnvironment.Append(CPPPATH = [javaIncludePath])
810
commonEnvironment.Append(CPPPATH = [javaIncludePath + '/linux'])
812
if getPlatform() == 'win32':
813
commonEnvironment['ENV']['PATH'] = os.environ['PATH']
814
commonEnvironment['SYSTEMROOT'] = os.environ['SYSTEMROOT']
816
if (commonEnvironment['useFLTK'] == '1' and fltkFound):
817
commonEnvironment.Prepend(CPPFLAGS = ['-DHAVE_FLTK'])
820
commonEnvironment.Prepend(CPPFLAGS = ['-DHAVE_VST_SDK'])
823
# Define macros that configure and config.h used to define.
825
['io.h', '-DHAVE_IO_H' ],
826
['fcntl.h', '-DHAVE_FCNTL_H' ],
827
['unistd.h', '-DHAVE_UNISTD_H' ],
828
['stdint.h', '-DHAVE_STDINT_H' ],
829
['sys/time.h', '-DHAVE_SYS_TIME_H' ],
830
['sys/types.h', '-DHAVE_SYS_TYPES_H'],
831
['termios.h', '-DHAVE_TERMIOS_H' ],
832
['values.h', '-DHAVE_VALUES_H' ]]
834
for h in headerMacroCheck:
835
if configure.CheckHeader(h[0], language = "C"):
836
commonEnvironment.Append(CPPFLAGS = [h[1]])
838
if getPlatform() == 'win32':
839
if configure.CheckHeader("winsock.h", language = "C"):
840
commonEnvironment.Append(CPPFLAGS = ['-DHAVE_SOCKETS'])
841
elif configure.CheckHeader("sys/socket.h", language = "C"):
842
commonEnvironment.Append(CPPFLAGS = ['-DHAVE_SOCKETS'])
844
if getPlatform() == 'darwin':
845
commonEnvironment.Append(CPPFLAGS = ['-DHAVE_DIRENT_H'])
846
elif configure.CheckHeader("dirent.h", language = "C"):
847
commonEnvironment.Append(CPPFLAGS = ['-DHAVE_DIRENT_H'])
849
if configure.CheckSndFile1016():
850
commonEnvironment.Prepend(CPPFLAGS = ['-DHAVE_LIBSNDFILE=1016'])
851
elif configure.CheckSndFile1013():
852
commonEnvironment.Prepend(CPPFLAGS = ['-DHAVE_LIBSNDFILE=1013'])
853
elif configure.CheckSndFile1011():
854
commonEnvironment.Prepend(CPPFLAGS = ['-DHAVE_LIBSNDFILE=1011'])
856
commonEnvironment.Prepend(CPPFLAGS = ['-DHAVE_LIBSNDFILE=1000'])
860
# library version is CS_VERSION.CS_APIVERSION
861
csoundLibraryVersion = '5.2'
862
csoundLibraryName = 'csound'
863
if commonEnvironment['useDouble'] != '0':
864
csoundLibraryName += '64'
865
elif getPlatform() == 'win32':
866
csoundLibraryName += '32'
867
# flags for linking with the Csound library
868
libCsoundLinkFlags = commonEnvironment['LINKFLAGS']
869
if getPlatform() == 'sunos':
870
libCsoundLibs = ['sndfile', 'socket', 'rt', 'nsl']
872
libCsoundLibs = ['sndfile']
874
buildOSXFramework = 0
875
if getPlatform() == 'darwin':
876
if commonEnvironment['dynamicCsoundLibrary'] != '0':
877
buildOSXFramework = 1
878
CsoundLib_OSX = 'CsoundLib'
879
# comment the next two lines out to disable building a separate
880
# framework (CsoundLib64) for double precision
881
if commonEnvironment['useDouble'] != '0':
882
CsoundLib_OSX += '64'
883
OSXFrameworkBaseDir = '%s.framework' % CsoundLib_OSX
884
tmp = OSXFrameworkBaseDir + '/Versions/%s'
885
OSXFrameworkCurrentVersion = tmp % csoundLibraryVersion
887
csoundLibraryEnvironment = commonEnvironment.Clone()
889
if commonEnvironment['buildMultiCore'] != '0':
890
csoundLibraryEnvironment.Append(CPPFLAGS = ['-DPARCS'])
892
if commonEnvironment['buildNewParser'] != '0':
893
if commonEnvironment['buildMultiCore'] != '0':
894
csoundLibraryEnvironment.Append(CPPFLAGS = ['-DPARCS'])
895
if getPlatform() == "win32":
896
Tool('lex')(csoundLibraryEnvironment)
897
Tool('yacc')(csoundLibraryEnvironment)
898
print 'CONFIGURATION DECISION: Building with new parser enabled'
899
reportflag='--report=itemset'
900
csoundLibraryEnvironment.Append(YACCFLAGS = ['-d', reportflag, '-p','csound_orc'])
901
csoundLibraryEnvironment.Append(LEXFLAGS = ['-Pcsound_orc'])
902
csoundLibraryEnvironment.Append(CPPFLAGS = ['-DENABLE_NEW_PARSER'])
903
csoundLibraryEnvironment.Append(CPPPATH = ['Engine'])
904
yaccBuild = csoundLibraryEnvironment.CFile(target = 'Engine/csound_orcparse.c',
905
source = 'Engine/csound_orc.y')
906
lexBuild = csoundLibraryEnvironment.CFile(target = 'Engine/csound_orclex.c',
907
source = 'Engine/csound_orc.l')
908
if commonEnvironment['NewParserDebug'] != '0':
909
print 'CONFIGURATION DECISION: Building with new parser debugging'
910
csoundLibraryEnvironment.Append(CPPFLAGS = ['-DPARSER_DEBUG=1'])
911
else: print 'CONFIGURATION DECISION: Not building with new parser debugging'
913
print 'CONFIGURATION DECISION: Not building with new parser'
915
csoundLibraryEnvironment.Append(CPPFLAGS = ['-D__BUILDING_LIBCSOUND'])
916
if commonEnvironment['buildRelease'] != '0':
917
csoundLibraryEnvironment.Append(CPPFLAGS = ['-D_CSOUND_RELEASE_'])
918
if getPlatform() == 'linux':
919
if commonEnvironment['Lib64'] == '0':
920
tmp = '%s/lib/csound/plugins' % commonEnvironment['prefix']
922
tmp = '%s/lib64/csound/plugins' % commonEnvironment['prefix']
923
if commonEnvironment['useDouble'] != '0':
925
tmp += '-' + csoundLibraryVersion
926
s = '-DCS_DEFAULT_PLUGINDIR=\\"%s\\"' % tmp
927
csoundLibraryEnvironment.Append(CPPFLAGS = [s])
928
elif buildOSXFramework != 0:
929
tmp = '/Library/Frameworks/%s' % OSXFrameworkCurrentVersion
930
tmp += '/Resources/Opcodes'
931
if commonEnvironment['useDouble'] != '0':
933
s = '-DCS_DEFAULT_PLUGINDIR=\\"%s\\"' % tmp
934
csoundLibraryEnvironment.Append(CPPFLAGS = [s])
935
csoundDynamicLibraryEnvironment = csoundLibraryEnvironment.Clone()
936
csoundDynamicLibraryEnvironment.Append(LIBS = ['sndfile'])
937
if getPlatform() == 'win32':
938
# These are the Windows system call libraries.
940
csoundWindowsLibraries = Split('''
976
csoundWindowsLibraries = Split('''
977
kernel32 gdi32 wsock32 ole32 uuid winmm user32.lib ws2_32.lib
978
comctl32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib
979
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
980
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
981
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
982
odbc32.lib odbccp32.lib pthread.lib
984
if commonEnvironment['bufferoverflowu'] != '0':
985
csoundWindowsLibraries.append('bufferoverflowu')
986
csoundDynamicLibraryEnvironment.Append(LIBS = csoundWindowsLibraries)
988
csoundDynamicLibraryEnvironment.Append(SHLINKFLAGS = ['-module'])
989
elif getPlatform() == 'linux' or getPlatform() == 'sunos' or getPlatform() == 'darwin':
990
csoundDynamicLibraryEnvironment.Append(LIBS = ['dl', 'm', 'pthread'])
992
csoundDynamicLibraryEnvironment.Append(LIBS = ['mpadec'])
993
csoundInterfacesEnvironment = csoundDynamicLibraryEnvironment.Clone()
995
if buildOSXFramework:
996
csoundFrameworkEnvironment = csoundDynamicLibraryEnvironment.Clone()
997
# create directory structure for the framework
998
if commonEnvironment['buildNewParser'] != '0':
999
csoundFrameworkEnvironment.Append(LINKFLAGS=["-Wl,-single_module"])
1000
tmp = [OSXFrameworkBaseDir]
1001
tmp += ['%s/Versions' % OSXFrameworkBaseDir]
1002
tmp += [OSXFrameworkCurrentVersion]
1003
tmp += ['%s/Headers' % OSXFrameworkCurrentVersion]
1004
tmp += ['%s/Resources' % OSXFrameworkCurrentVersion]
1005
if commonEnvironment['useDouble'] == '0':
1006
tmp += ['%s/Resources/Opcodes' % OSXFrameworkCurrentVersion]
1008
tmp += ['%s/Resources/Opcodes64' % OSXFrameworkCurrentVersion]
1014
# set up symbolic links
1015
tmp = [['/Versions/Current', csoundLibraryVersion]]
1016
tmp += [['/' + CsoundLib_OSX, 'Versions/Current/' + CsoundLib_OSX]]
1017
tmp += [['/Headers', 'Versions/Current/Headers']]
1018
tmp += [['/Resources', 'Versions/Current/Resources']]
1021
os.remove('%s/%s' % (OSXFrameworkBaseDir, i[0]))
1024
os.symlink(i[1], '%s/%s' % (OSXFrameworkBaseDir, i[0]))
1026
def MacOSX_InstallHeader(headerName):
1027
if not buildOSXFramework:
1029
baseName = headerName[(headerName.rfind('/') + 1):]
1030
targetName = '%s/Headers/%s' % (OSXFrameworkCurrentVersion, baseName)
1031
# to set USE_DOUBLE in installed headers
1032
cmd = 'cp -f %s %s' % (headerName, targetName)
1033
if commonEnvironment['useDouble'] != '0':
1034
if baseName == 'float-version.h':
1035
cmd = 'cp -f %s %s' % ('H/float-version-double.h', targetName)
1036
csoundFrameworkEnvironment.Command(targetName, headerName, cmd)
1038
def MacOSX_InstallPlugin(fileName):
1039
if buildOSXFramework:
1040
print "COPYINNG plugin"
1041
pluginDir = '%s/Resources/Opcodes' % OSXFrameworkCurrentVersion
1042
if commonEnvironment['useDouble'] != '0':
1044
cmd = 'cp -f %s %s/' % (fileName, pluginDir)
1045
csoundFrameworkEnvironment.Command('%s/%s' % (pluginDir, fileName),
1048
def makePlugin(env, pluginName, srcs):
1049
pluginLib = env.SharedLibrary(pluginName, srcs)
1050
pluginLibraries.append(pluginLib)
1051
MacOSX_InstallPlugin('lib' + pluginName + '.dylib')
1054
libCsoundSources = Split('''
1118
Top/cscore_internal.c
1131
newParserSources = Split('''
1132
Engine/csound_orclex.c
1133
Engine/csound_orcparse.c
1134
Engine/csound_orc_semantics.c
1135
Engine/csound_orc_expressions.c
1136
Engine/csound_orc_optimize.c
1137
Engine/csound_orc_compile.c
1139
Engine/new_orc_parser.c
1142
MultiCoreSources = Split('''
1143
Engine/cs_par_base.c
1144
Engine/cs_par_orc_semantic_analysis.c
1145
Engine/cs_par_dispatch.c
1148
if commonEnvironment['buildMultiCore'] != '0':
1149
libCsoundSources += MultiCoreSources
1151
if commonEnvironment['buildNewParser'] != '0' or commonEnvironment['buildMultiCore'] != '0':
1152
libCsoundSources += newParserSources
1154
csoundLibraryEnvironment.Append(CCFLAGS='-fPIC')
1155
if commonEnvironment['dynamicCsoundLibrary'] == '1':
1156
print 'CONFIGURATION DECISION: Building dynamic Csound library'
1157
if getPlatform() == 'linux' or getPlatform() == 'sunos':
1158
libName = 'lib' + csoundLibraryName + '.so'
1159
libName2 = libName + '.' + csoundLibraryVersion
1160
os.spawnvp(os.P_WAIT, 'rm', ['rm', '-f', libName])
1161
os.symlink(libName2, libName)
1162
tmp = csoundDynamicLibraryEnvironment['SHLINKFLAGS']
1164
tmp = tmp + ['-soname=%s' % libName2]
1166
tmp = tmp + ['-Wl,-soname=%s' % libName2]
1167
cflags = csoundDynamicLibraryEnvironment['CCFLAGS']
1168
if configure.CheckGcc4():
1169
cflags += ['-fvisibility=hidden']
1170
csoundLibrary = csoundDynamicLibraryEnvironment.SharedLibrary(
1171
libName2, libCsoundSources,
1172
SHLINKFLAGS = tmp, SHLIBPREFIX = '', SHLIBSUFFIX = '',
1174
elif getPlatform() == 'darwin':
1175
libName = CsoundLib_OSX
1176
libVersion = csoundLibraryVersion
1177
csoundFrameworkEnvironment.Append(SHLINKFLAGS = Split('''
1178
-Xlinker -compatibility_version -Xlinker %s
1180
csoundFrameworkEnvironment.Append(SHLINKFLAGS = Split('''
1181
-Xlinker -current_version -Xlinker %s
1183
csoundFrameworkEnvironment.Append(SHLINKFLAGS = Split('''
1184
-install_name /Library/Frameworks/%s/%s
1185
''' % (OSXFrameworkCurrentVersion, libName)))
1186
csoundLibraryFile = csoundFrameworkEnvironment.SharedLibrary(
1187
libName, libCsoundSources, SHLIBPREFIX = '', SHLIBSUFFIX = '')
1188
csoundFrameworkEnvironment.Command(
1189
'%s/%s' % (OSXFrameworkCurrentVersion, libName),
1191
'cp -f %s %s/' % (libName, OSXFrameworkCurrentVersion))
1193
MacOSX_InstallHeader(i)
1194
csoundLibrary = csoundFrameworkEnvironment.Command(
1195
'CsoundLib_install',
1197
'rm -r /Library/Frameworks/%s; cp -R %s /Library/Frameworks/' % (OSXFrameworkBaseDir, OSXFrameworkBaseDir))
1198
libCsoundLinkFlags += ['-F.', '-framework', libName, '-lsndfile']
1200
elif getPlatform() == 'win32':
1201
csoundLibrary = csoundDynamicLibraryEnvironment.SharedLibrary(
1202
csoundLibraryName, libCsoundSources,
1203
SHLIBSUFFIX = '.dll.%s' % csoundLibraryVersion)
1205
csoundLibrary = csoundDynamicLibraryEnvironment.SharedLibrary(
1206
csoundLibraryName, libCsoundSources)
1208
print 'CONFIGURATION DECISION: Building static Csound library'
1209
csoundLibraryEnvironment.Append(CCFLAGS='-fPIC')
1210
csoundLibrary = csoundLibraryEnvironment.Library(
1211
csoundLibraryName, libCsoundSources)
1212
if getPlatform() == 'linux' or getPlatform() == 'sunos':
1213
# We need the library before sndfile in case we are building a static
1214
# libcsound and passing -Wl,-as-needed
1215
libCsoundLibs.insert(0,csoundLibrary)
1216
elif getPlatform() == 'win32' or (getPlatform() == 'darwin' and commonEnvironment['dynamicCsoundLibrary']=='0'):
1217
libCsoundLibs.append(csoundLibraryName)
1218
libs.append(csoundLibrary)
1220
pluginEnvironment = commonEnvironment.Clone()
1221
pluginEnvironment.Append(LIBS = Split('sndfile'))
1223
pluginEnvironment.Append(LIBS = ['mpadec'])
1225
if getPlatform() == 'darwin':
1226
pluginEnvironment.Append(LINKFLAGS = Split('''
1227
-framework CoreMidi -framework CoreFoundation -framework CoreServices -framework CoreAudio
1229
# pluginEnvironment.Append(LINKFLAGS = ['-dynamiclib'])
1230
pluginEnvironment['SHLIBSUFFIX'] = '.dylib'
1231
# pluginEnvironment.Prepend(CXXFLAGS = "-fno-rtti")
1233
#############################################################################
1235
# Build csound command line front end
1236
#############################################################################
1238
csoundProgramEnvironment = commonEnvironment.Clone()
1239
csoundProgramEnvironment.Append(LINKFLAGS = libCsoundLinkFlags)
1240
csoundProgramEnvironment.Append(LIBS = libCsoundLibs)
1243
#############################################################################
1245
# DEFINE TARGETS AND SOURCES
1247
#############################################################################
1249
if getPlatform() == 'win32':
1250
PYDLL = r'%s\%s' % (os.environ['SystemRoot'], pythonLibs[0])
1251
if getPlatform() == 'win32' and pythonLibs[0] < 'python24' and compilerGNU():
1252
pythonImportLibrary = csoundInterfacesEnvironment.Command(
1253
'/usr/local/lib/lib%s.a' % (pythonLibs[0]),
1255
['pexports %s > %s.def' % (PYDLL, pythonLibs[0]),
1256
'dlltool --input-def %s.def --dllname %s.dll --output-lib /usr/local/lib/lib%s.a' % (pythonLibs[0], PYDLL, pythonLibs[0])])
1258
def fixCFlagsForSwig(env):
1259
if '-pedantic' in env['CCFLAGS']:
1260
env['CCFLAGS'].remove('-pedantic')
1261
if '-pedantic' in env['CXXFLAGS']:
1262
env['CXXFLAGS'].remove('-pedantic')
1264
# work around non-ANSI type punning in SWIG generated wrapper files
1265
#if(getPlatform != 'darwin'):
1266
#env['CCFLAGS'].append('-fno-strict-aliasing')
1267
#env['CXXFLAGS'].append('-fno-strict-aliasing')
1269
def makePythonModule(env, targetName, sources):
1270
if getPlatform() == 'darwin':
1271
env.Prepend(LINKFLAGS = ['-bundle'])
1272
pyModule_ = env.Program('_%s.so' % targetName, sources)
1274
if getPlatform() == 'linux' or getPlatform() == 'sunos':
1275
pyModule_ = env.SharedLibrary('%s' % targetName, sources, SHLIBPREFIX="_", SHLIBSUFFIX = '.so')
1277
pyModule_ = env.SharedLibrary('_%s' % targetName, sources, SHLIBSUFFIX = '.pyd')
1278
if getPlatform() == 'win32' and pythonLibs[0] < 'python24':
1279
Depends(pyModule_, pythonImportLibrary)
1280
print "PYTHON MODULE %s..." % targetName
1281
pythonModules.append(pyModule_)
1282
pythonModules.append('%s.py' % targetName)
1285
def makeLuaModule(env, targetName, srcs):
1286
if getPlatform() == 'darwin':
1287
env.Prepend(LINKFLAGS = ['-bundle'])
1288
luaModule_ = env.Program('%s.so' % targetName, srcs)
1290
if getPlatform() == 'linux' or getPlatform() == 'sunos':
1291
luaModule_ = env.SharedLibrary('%s' % targetName, srcs, SHLIBPREFIX="", SHLIBSUFFIX = '.so')
1293
luaModule_ = env.SharedLibrary('%s' % targetName, srcs, SHLIBSUFFIX = '.dll')
1294
print "LUA MODULE %s..." % targetName
1297
# libcsnd.so is used by all wrapper libraries.
1299
if not (commonEnvironment['buildInterfaces'] == '1'):
1300
print 'CONFIGURATION DECISION: Not building Csound C++ interface library.'
1302
print 'CONFIGURATION DECISION: Building Csound C++ interface library.'
1303
csoundInterfacesEnvironment.Append(CPPPATH = ['interfaces'])
1305
csoundInterfacesEnvironment.Prepend(LIBS = 'musicxml2')
1306
csoundInterfacesSources = []
1307
headers += ['interfaces/csPerfThread.hpp']
1308
for i in Split('CppSound CsoundFile Soundfile csPerfThread cs_glue filebuilding'):
1309
csoundInterfacesSources.append(csoundInterfacesEnvironment.SharedObject('interfaces/%s.cpp' % i))
1310
if commonEnvironment['dynamicCsoundLibrary'] == '1' or getPlatform() == 'win32':
1311
csoundInterfacesEnvironment.Append(LINKFLAGS = libCsoundLinkFlags)
1312
csoundInterfacesEnvironment.Prepend(LIBS = libCsoundLibs)
1314
for i in libCsoundSources:
1315
csoundInterfacesSources.append(csoundInterfacesEnvironment.SharedObject(i))
1316
if getPlatform() == 'win32' and compilerGNU():
1317
csoundInterfacesEnvironment.Append(SHLINKFLAGS = '-Wl,--add-stdcall-alias')
1318
elif getPlatform() == 'linux':
1319
csoundInterfacesEnvironment.Prepend(LIBS = ['util'])
1320
if compilerGNU() and getPlatform() != 'win32':
1321
csoundInterfacesEnvironment.Prepend(LIBS = ['stdc++'])
1322
if getPlatform() == 'darwin':
1323
if commonEnvironment['dynamicCsoundLibrary'] == '1':
1324
ilibName = "lib_csnd.dylib"
1325
ilibVersion = csoundLibraryVersion
1326
csoundInterfacesEnvironment.Append(SHLINKFLAGS = Split(
1327
'''-Xlinker -compatibility_version
1328
-Xlinker %s''' % ilibVersion))
1329
csoundInterfacesEnvironment.Append(SHLINKFLAGS = Split(
1330
'''-Xlinker -current_version -Xlinker %s''' % ilibVersion))
1331
tmp = '''-install_name
1332
/Library/Frameworks/%s/%s'''
1333
csoundInterfacesEnvironment.Append(SHLINKFLAGS = Split(
1334
tmp % (OSXFrameworkCurrentVersion,ilibName)))
1335
csnd = csoundInterfacesEnvironment.SharedLibrary(
1336
'_csnd', csoundInterfacesSources)
1337
try: os.symlink('lib_csnd.dylib', 'libcsnd.dylib')
1340
csnd = csoundInterfacesEnvironment.Library('csnd', csoundInterfacesSources)
1341
elif getPlatform() == 'linux':
1342
csoundInterfacesEnvironment.Append(LINKFLAGS = ['-Wl,-rpath-link,interfaces'])
1344
soname = name + '.' + csoundLibraryVersion
1345
# This works because scons chdirs while reading SConscripts
1346
# When building stuff scons doesn't chdir by default!
1347
try : os.symlink(soname, '%s' % name)
1349
Clean(soname, name) #Delete symlink on clean
1350
linkflags = csoundInterfacesEnvironment['SHLINKFLAGS']
1351
soflag = [ '-Wl,-soname=%s' % soname ]
1353
csnd = csoundInterfacesEnvironment.SharedLibrary(
1354
soname, csoundInterfacesSources,
1355
SHLINKFLAGS = linkflags+soflag+extraflag,
1356
SHLIBPREFIX = '', SHLIBSUFFIX = '')
1358
csnd = csoundInterfacesEnvironment.SharedLibrary('csnd', csoundInterfacesSources)
1359
Depends(csnd, csoundLibrary)
1362
# Common stuff for SWIG for all wrappers.
1364
csoundWrapperEnvironment = csoundInterfacesEnvironment.Clone()
1365
#csoundWrapperEnvironment.Append(LIBS = [csnd])
1366
csoundWrapperEnvironment.Append(SWIGFLAGS = Split('''-c++ -includeall -verbose '''))
1367
fixCFlagsForSwig(csoundWrapperEnvironment)
1368
csoundWrapperEnvironment.Append(CPPFLAGS = ['-D__BUILDING_CSOUND_INTERFACES'])
1369
for option in csoundWrapperEnvironment['CCFLAGS']:
1370
if string.find(option, '-D') == 0:
1371
csoundWrapperEnvironment.Append(SWIGFLAGS = [option])
1372
for option in csoundWrapperEnvironment['CPPFLAGS']:
1373
if string.find(option, '-D') == 0:
1374
csoundWrapperEnvironment.Append(SWIGFLAGS = [option])
1375
for option in csoundWrapperEnvironment['CPPPATH']:
1376
option = '-I' + option
1377
csoundWrapperEnvironment.Append(SWIGFLAGS = [option])
1378
swigflags = csoundWrapperEnvironment['SWIGFLAGS']
1380
if not (luaFound and commonEnvironment['buildLuaWrapper'] != '0'):
1381
print 'CONFIGURATION DECISION: Not building Lua wrapper to Csound C++ interface library.'
1383
print 'CONFIGURATION DECISION: Building Lua wrapper to Csound C++ interface library.'
1384
luaWrapperEnvironment = csoundWrapperEnvironment.Clone()
1385
if getPlatform() != 'win32':
1386
csoundWrapperEnvironment.Append(CPPPATH=['/usr/include/lua5.1'])
1387
csoundLuaInterface = luaWrapperEnvironment.SharedObject(
1388
'interfaces/lua_interface.i',
1389
SWIGFLAGS = [swigflags, '-module', 'luaCsnd', '-lua', '-outdir', '.'])
1390
if getPlatform() == 'win32':
1391
luaWrapperEnvironment.Prepend(LIBS = ['csnd','lua51'])
1393
luaWrapperEnvironment.Prepend(LIBS = ['csnd'])
1394
luaWrapper = makeLuaModule(luaWrapperEnvironment, 'luaCsnd', [csoundLuaInterface])
1395
Depends(luaWrapper, csoundLuaInterface)
1397
if not (javaFound and commonEnvironment['buildJavaWrapper'] != '0'):
1398
print 'CONFIGURATION DECISION: Not building Java wrapper to Csound C++ interface library.'
1400
print 'CONFIGURATION DECISION: Building Java wrapper to Csound C++ interface library.'
1401
javaWrapperEnvironment = csoundWrapperEnvironment.Clone()
1402
javaWrapperEnvironment.Prepend(LIBS = ['csnd'])
1403
if getPlatform() == 'darwin':
1404
javaWrapperEnvironment.Append(CPPPATH =
1405
['/System/Library/Frameworks/JavaVM.framework/Headers'])
1406
if getPlatform() == 'linux' or getPlatform() == 'darwin':
1407
# ugly hack to work around bug that requires running scons twice
1408
tmp = [javaWrapperEnvironment['SWIG']]
1411
tmp += ['-java', '-package', 'csnd']
1412
tmp += ['-o', 'interfaces/java_interface_wrap.cc']
1413
tmp += ['interfaces/java_interface.i']
1414
if os.spawnvp(os.P_WAIT, tmp[0], tmp) != 0:
1416
javaWrapperSources = [javaWrapperEnvironment.SharedObject(
1417
'interfaces/java_interface_wrap.cc')]
1419
javaWrapperSources = [javaWrapperEnvironment.SharedObject(
1420
'interfaces/java_interface.i',
1421
SWIGFLAGS = [swigflags, '-java', '-package', 'csnd'])]
1422
if getPlatform() == 'darwin':
1423
javaWrapperEnvironment.Prepend(LINKFLAGS = ['-bundle'])
1424
javaWrapperEnvironment.Append(LINKFLAGS =
1425
['-framework', 'JavaVM', '-Wl'])
1426
javaWrapper = javaWrapperEnvironment.Program(
1427
'lib_jcsound.jnilib', javaWrapperSources)
1429
javaWrapper = javaWrapperEnvironment.SharedLibrary(
1430
'_jcsound', javaWrapperSources)
1431
Depends(javaWrapper, csoundLibrary)
1432
libs.append(javaWrapper)
1433
jcsnd = javaWrapperEnvironment.Java(
1434
target = './interfaces', source = './interfaces',
1435
JAVACFLAGS = ['-source', '1.4', '-target', '1.4'])
1437
os.mkdir('interfaces/csnd', 0755)
1440
jcsndJar = javaWrapperEnvironment.Jar(
1441
'csnd.jar', ['interfaces/csnd'], JARCHDIR = 'interfaces')
1442
Depends(jcsndJar, jcsnd)
1443
libs.append(jcsndJar)
1444
# Please do not remove these two variables, needed to get things to build on Windows...
1445
pythonWrapper = None
1446
if not (pythonFound and commonEnvironment['buildPythonWrapper'] != '0'):
1447
print 'CONFIGURATION DECISION: Not building Python wrapper to Csound C++ interface library.'
1449
print 'CONFIGURATION DECISION: Building Python wrapper to Csound C++ interface library.'
1450
pythonWrapperEnvironment = csoundWrapperEnvironment.Clone()
1451
pythonWrapperEnvironment.Prepend(LIBS = Split('csnd'))
1452
if getPlatform() == 'linux':
1453
os.spawnvp(os.P_WAIT, 'rm', ['rm', '-f', '_csnd.so'])
1454
# os.symlink('lib_csnd.so', '_csnd.so')
1455
pythonWrapperEnvironment.Append(LINKFLAGS = ['-Wl,-rpath-link,.'])
1456
if getPlatform() == 'darwin':
1457
if commonEnvironment['dynamicCsoundLibrary'] == '1':
1458
ilibName = "lib_csnd.dylib"
1459
ilibVersion = csoundLibraryVersion
1460
pythonWrapperEnvironment.Append(SHLINKFLAGS = Split('''-Xlinker -compatibility_version -Xlinker %s''' % ilibVersion))
1461
pythonWrapperEnvironment.Append(SHLINKFLAGS = Split('''-Xlinker -current_version -Xlinker %s''' % ilibVersion))
1462
pythonWrapperEnvironment.Append(SHLINKFLAGS = Split('''-install_name /Library/Frameworks/%s/%s''' % (OSXFrameworkCurrentVersion, ilibName)))
1463
pythonWrapperEnvironment.Append(CPPPATH = pythonIncludePath)
1464
pythonWrapperEnvironment.Append(LINKFLAGS = ['-framework','python'])
1465
#pythonWrapper = pythonWrapperEnvironment.SharedLibrary('_csnd', pythonWrapperSources)
1466
pyVersToken = '-DPYTHON_24_or_newer'
1467
csoundPythonInterface = pythonWrapperEnvironment.SharedObject(
1468
'interfaces/python_interface.i',
1469
SWIGFLAGS = [swigflags, '-python', '-outdir', '.', pyVersToken])
1470
pythonWrapperEnvironment.Clean('.', 'interfaces/python_interface_wrap.h')
1471
pythonWrapperEnvironment.Command('interfaces install', csoundPythonInterface, "cp lib_csnd.dylib /Library/Frameworks/%s/lib_csnd.dylib" % (OSXFrameworkCurrentVersion))
1472
try: os.symlink('lib_csnd.dylib', 'libcsnd.dylib')
1473
except: print "link exists..."
1475
pythonWrapperEnvironment.Append(LINKFLAGS = pythonLinkFlags)
1476
if getPlatform() != 'darwin':
1477
pythonWrapperEnvironment.Prepend(LIBPATH = pythonLibraryPath)
1478
pythonWrapperEnvironment.Prepend(LIBS = pythonLibs)
1479
pythonWrapperEnvironment.Append(CPPPATH = pythonIncludePath)
1480
fixCFlagsForSwig(pythonWrapperEnvironment)
1481
pyVersToken = '-DPYTHON_24_or_newer'
1482
csoundPythonInterface = pythonWrapperEnvironment.SharedObject(
1483
'interfaces/python_interface.i',
1484
SWIGFLAGS = [swigflags, '-python', '-outdir', '.', pyVersToken])
1485
pythonWrapperEnvironment.Clean('.', 'interfaces/python_interface_wrap.h')
1486
if getPlatform() == 'win32' and pythonLibs[0] < 'python24' and compilerGNU():
1487
Depends(csoundPythonInterface, pythonImportLibrary)
1488
pythonWrapper = makePythonModule(pythonWrapperEnvironment, 'csnd', [csoundPythonInterface])
1489
pythonModules.append('csnd.py')
1490
Depends(pythonWrapper, csnd)
1492
if commonEnvironment['generatePdf'] == '0':
1493
print 'CONFIGURATION DECISION: Not generating Csound API PDF documentation.'
1495
print 'CONFIGURATION DECISION: Generating Csound API PDF documentation.'
1496
refmanTex = commonEnvironment.Command('doc/latex/refman.tex', 'Doxyfile', ['doxygen $SOURCE'])
1497
Depends(refmanTex, csoundLibrary)
1498
csoundPdf = commonEnvironment.Command('refman.pdf', 'doc/latex/refman.tex', ['pdflatex --include-directory=doc/latex --interaction=nonstopmode --job-name=CsoundAPI $SOURCE'])
1499
Depends(csoundPdf, refmanTex)
1501
#############################################################################
1504
#############################################################################
1506
makePlugin(pluginEnvironment, 'stdopcod', Split('''
1507
Opcodes/ambicode.c Opcodes/bbcut.c Opcodes/biquad.c
1508
Opcodes/butter.c Opcodes/clfilt.c Opcodes/cross2.c
1509
Opcodes/dam.c Opcodes/dcblockr.c Opcodes/filter.c
1510
Opcodes/flanger.c Opcodes/follow.c Opcodes/fout.c
1511
Opcodes/freeverb.c Opcodes/ftconv.c Opcodes/ftgen.c
1512
Opcodes/gab/gab.c Opcodes/gab/vectorial.c Opcodes/grain.c
1513
Opcodes/locsig.c Opcodes/lowpassr.c Opcodes/metro.c
1514
Opcodes/midiops2.c Opcodes/midiops3.c Opcodes/newfils.c
1515
Opcodes/nlfilt.c Opcodes/oscbnk.c Opcodes/pluck.c
1516
Opcodes/repluck.c Opcodes/reverbsc.c Opcodes/seqtime.c
1517
Opcodes/sndloop.c Opcodes/sndwarp.c Opcodes/space.c
1518
Opcodes/spat3d.c Opcodes/syncgrain.c Opcodes/ugens7.c
1519
Opcodes/ugens9.c Opcodes/ugensa.c Opcodes/uggab.c
1520
Opcodes/ugmoss.c Opcodes/ugnorman.c Opcodes/ugsc.c
1521
Opcodes/wave-terrain.c Opcodes/stdopcod.c
1524
if (getPlatform() == 'linux' or getPlatform() == 'darwin'):
1525
makePlugin(pluginEnvironment, 'control', ['Opcodes/control.c'])
1526
if getPlatform() == 'linux':
1527
makePlugin(pluginEnvironment, 'urandom', ['Opcodes/urandom.c'])
1528
makePlugin(pluginEnvironment, 'modmatrix', ['Opcodes/modmatrix.c'])
1529
makePlugin(pluginEnvironment, 'eqfil', ['Opcodes/eqfil.c'])
1530
makePlugin(pluginEnvironment, 'pvsbuffer', ['Opcodes/pvsbuffer.c'])
1531
makePlugin(pluginEnvironment, 'scoreline', ['Opcodes/scoreline.c'])
1532
makePlugin(pluginEnvironment, 'ftest', ['Opcodes/ftest.c'])
1533
makePlugin(pluginEnvironment, 'mixer', ['Opcodes/mixer.cpp'])
1534
makePlugin(pluginEnvironment, 'signalflowgraph', ['Opcodes/signalflowgraph.cpp'])
1535
makePlugin(pluginEnvironment, 'modal4',
1536
['Opcodes/modal4.c', 'Opcodes/physutil.c'])
1537
makePlugin(pluginEnvironment, 'physmod', Split('''
1538
Opcodes/physmod.c Opcodes/physutil.c Opcodes/mandolin.c Opcodes/singwave.c
1539
Opcodes/fm4op.c Opcodes/moog1.c Opcodes/shaker.c Opcodes/bowedbar.c
1541
makePlugin(pluginEnvironment, 'pitch',
1542
['Opcodes/pitch.c', 'Opcodes/pitch0.c', 'Opcodes/spectra.c'])
1543
makePlugin(pluginEnvironment, 'ambicode1', ['Opcodes/ambicode1.c'])
1545
makePlugin(pluginEnvironment, 'mp3in', ['Opcodes/mp3in.c'])
1546
##commonEnvironment.Append(LINKFLAGS = ['-Wl,-as-needed'])
1548
WiiEnvironment = pluginEnvironment.Clone()
1549
makePlugin(WiiEnvironment, 'wiimote', ['Opcodes/wiimote.c'])
1551
P5GEnvironment = pluginEnvironment.Clone()
1552
makePlugin(P5GEnvironment, 'p5g', ['Opcodes/p5glove.c'])
1554
SerEnvironment = pluginEnvironment.Clone()
1555
makePlugin(SerEnvironment, 'serial', ['Opcodes/serial.c'])
1557
sfontEnvironment = pluginEnvironment.Clone()
1559
if getPlatform() != 'darwin':
1560
sfontEnvironment.Append(CCFLAGS = ['-fno-strict-aliasing'])
1561
if sys.byteorder == 'big':
1562
sfontEnvironment.Append(CCFLAGS = ['-DWORDS_BIGENDIAN'])
1563
makePlugin(sfontEnvironment, 'sfont', ['Opcodes/sfont.c'])
1564
makePlugin(pluginEnvironment, 'babo', ['Opcodes/babo.c'])
1565
makePlugin(pluginEnvironment, 'barmodel', ['Opcodes/bilbar.c'])
1566
makePlugin(pluginEnvironment, 'compress', ['Opcodes/compress.c'])
1567
makePlugin(pluginEnvironment, 'grain4', ['Opcodes/grain4.c'])
1568
makePlugin(pluginEnvironment, 'hrtferX', ['Opcodes/hrtferX.c'])
1569
makePlugin(pluginEnvironment, 'loscilx', ['Opcodes/loscilx.c'])
1570
makePlugin(pluginEnvironment, 'minmax', ['Opcodes/minmax.c'])
1571
makePlugin(pluginEnvironment, 'cs_pan2', ['Opcodes/pan2.c'])
1572
makePlugin(pluginEnvironment, 'tabfns', ['Opcodes/tabvars.c'])
1573
makePlugin(pluginEnvironment, 'phisem', ['Opcodes/phisem.c'])
1574
makePlugin(pluginEnvironment, 'pvoc', Split('''
1575
Opcodes/dsputil.c Opcodes/pvadd.c Opcodes/pvinterp.c Opcodes/pvocext.c
1576
Opcodes/pvread.c Opcodes/ugens8.c Opcodes/vpvoc.c Opcodes/pvoc.c
1578
makePlugin(pluginEnvironment, 'cs_pvs_ops', Split('''
1579
Opcodes/ifd.c Opcodes/partials.c Opcodes/psynth.c Opcodes/pvsbasic.c
1580
Opcodes/pvscent.c Opcodes/pvsdemix.c Opcodes/pvs_ops.c Opcodes/pvsband.c
1582
makePlugin(pluginEnvironment, 'stackops', ['Opcodes/stackops.c'])
1583
makePlugin(pluginEnvironment, 'vbap',
1584
['Opcodes/vbap.c', 'Opcodes/vbap_eight.c', 'Opcodes/vbap_four.c',
1585
'Opcodes/vbap_sixteen.c', 'Opcodes/vbap_zak.c'])
1586
makePlugin(pluginEnvironment, 'vaops', ['Opcodes/vaops.c'])
1587
makePlugin(pluginEnvironment, 'ugakbari', ['Opcodes/ugakbari.c'])
1588
makePlugin(pluginEnvironment, 'harmon', ['Opcodes/harmon.c'])
1589
makePlugin(pluginEnvironment, 'ampmidid', ['Opcodes/ampmidid.cpp'])
1590
makePlugin(pluginEnvironment, 'cs_date', ['Opcodes/date.c'])
1591
makePlugin(pluginEnvironment, 'system_call', ['Opcodes/system_call.c'])
1592
makePlugin(pluginEnvironment, 'ptrack', ['Opcodes/pitchtrack.c'])
1593
makePlugin(pluginEnvironment, 'mutexops', ['Opcodes/mutexops.cpp'])
1594
makePlugin(pluginEnvironment, 'partikkel', ['Opcodes/partikkel.c'])
1595
makePlugin(pluginEnvironment, 'shape', ['Opcodes/shape.c'])
1596
makePlugin(pluginEnvironment, 'doppler', ['Opcodes/doppler.cpp'])
1597
makePlugin(pluginEnvironment, 'tabsum', ['Opcodes/tabsum.c'])
1598
makePlugin(pluginEnvironment, 'crossfm', ['Opcodes/crossfm.c'])
1599
makePlugin(pluginEnvironment, 'pvlock', ['Opcodes/pvlock.c'])
1600
makePlugin(pluginEnvironment, 'fareyseq', ['Opcodes/fareyseq.c'])
1601
makePlugin(pluginEnvironment, 'fareygen', ['Opcodes/fareygen.c'])
1602
#oggEnvironment = pluginEnvironment.Clone()
1603
#makePlugin(oggEnvironment, 'ogg', ['Opcodes/ogg.c'])
1604
#oggEnvironment.Append(LIBS=['vorbisfile'])
1605
makePlugin(pluginEnvironment, 'vosim', ['Opcodes/Vosim.c'])
1606
if getPlatform() == 'linux':
1607
makePlugin(pluginEnvironment, 'cpumeter', ['Opcodes/cpumeter.c'])
1609
if commonEnvironment['buildImageOpcodes'] == '1':
1610
if getPlatform() == 'win32':
1611
if configure.CheckLibWithHeader("fltk_png", "png.h", language="C") and zlibhfound:
1612
print 'CONFIGURATION DECISION: Building image opcodes'
1613
pluginEnvironment.Append(LIBS= Split(''' fltk_png fltk_z '''))
1614
makePlugin(pluginEnvironment, 'image', ['Opcodes/imageOpcodes.c'])
1616
if configure.CheckLibWithHeader("png", "png.h", language="C") and zlibhfound:
1617
print 'CONFIGURATION DECISION: Building image opcodes'
1618
pluginEnvironment.Append(LIBS= Split(''' png z '''))
1619
makePlugin(pluginEnvironment, 'image', ['Opcodes/imageOpcodes.c'])
1621
print 'CONFIGURATION DECISION: Not building image opcodes'
1622
makePlugin(pluginEnvironment, 'gabnew', Split('''
1623
Opcodes/gab/tabmorph.c Opcodes/gab/hvs.c
1624
Opcodes/gab/sliderTable.c
1625
Opcodes/gab/newgabopc.c'''))
1626
hrtfnewEnvironment = pluginEnvironment.Clone()
1627
if sys.byteorder == 'big':
1628
hrtfnewEnvironment.Append(CCFLAGS = ['-DWORDS_BIGENDIAN'])
1629
makePlugin(hrtfnewEnvironment, 'hrtfnew', 'Opcodes/hrtfopcodes.c')
1630
if jackFound and commonEnvironment['useJack'] == '1':
1631
jpluginEnvironment = pluginEnvironment.Clone()
1632
if getPlatform() == 'linux':
1633
jpluginEnvironment.Append(LIBS = ['jack', 'asound', 'pthread'])
1634
elif getPlatform() == 'win32':
1635
jpluginEnvironment.Append(LIBS = ['jackdmp'])
1636
elif getPlatform() == 'darwin':
1637
jpluginEnvironment.Append(LIBS = ['pthread'])
1638
jpluginEnvironment.Append(LINKFLAGS = ['-framework', 'Jackmp'])
1639
makePlugin(jpluginEnvironment, 'jackTransport', 'Opcodes/jackTransport.c')
1640
makePlugin(jpluginEnvironment, 'jacko', 'Opcodes/jacko.cpp')
1642
makePlugin(pluginEnvironment, 'chua', 'Opcodes/chua/ChuaOscillator.cpp')
1643
if gmmFound and commonEnvironment['useDouble'] != '0':
1644
makePlugin(pluginEnvironment, 'linear_algebra', 'Opcodes/linear_algebra.cpp')
1645
print 'CONFIGURATION DECISION: Building linear algebra opcodes.'
1647
print 'CONFIGURATION DECISION: Not building linear algebra opcodes.'
1649
#############################################################################
1651
# Plugins with External Dependencies
1652
#############################################################################
1656
vstEnvironment = commonEnvironment.Clone()
1657
vstEnvironment.Append(CXXFLAGS = '-DVST_FORCE_DEPRECATED=0')
1658
guiProgramEnvironment = commonEnvironment.Clone()
1660
fltkConfigFlags = 'fltk-config --use-images --cflags --cxxflags'
1661
if getPlatform() != 'darwin':
1662
fltkConfigFlags += ' --ldflags'
1663
if ((commonEnvironment['buildCsoundVST'] == '1') and boostFound and fltkFound):
1665
if vstEnvironment.ParseConfig(fltkConfigFlags):
1666
print 'Parsed fltk-config.'
1668
print 'Could not parse fltk-config.'
1670
print 'Exception when attempting to parse fltk-config.'
1671
if getPlatform() == 'darwin':
1672
vstEnvironment.Append(LIBS = ['fltk', 'fltk_images']) # png z jpeg are not on OSX at the mo
1673
if getPlatform() == 'win32':
1675
vstEnvironment.Append(LINKFLAGS = "--subsystem:windows")
1676
guiProgramEnvironment.Append(LINKFLAGS = "--subsystem:windows")
1677
#vstEnvironment.Append(LIBS = ['stdc++', 'supc++'])
1678
#guiProgramEnvironment.Append(LIBS = ['stdc++', 'supc++'])
1680
csoundProgramEnvironment.Append(LINKFLAGS = ["/IMPLIB:dummy.lib"])
1681
csoundProgramEnvironment.Append(LIBS = csoundWindowsLibraries)
1682
vstEnvironment.Append(LIBS = csoundWindowsLibraries)
1683
guiProgramEnvironment.Append(LIBS = csoundWindowsLibraries)
1685
if getPlatform() == 'linux':
1686
csoundProgramEnvironment.Append(LIBS = ['dl'])
1687
vstEnvironment.Append(LIBS = ['dl'])
1688
guiProgramEnvironment.Append(LIBS = ['dl'])
1689
csoundProgramEnvironment.Append(LIBS = ['pthread', 'm'])
1691
csoundProgramEnvironment.Append(LIBS = ['mpadec'])
1693
WiiEnvironment.Append(LIBS = ['wiiuse', 'bluetooth'])
1695
P5GEnvironment.Append(LIBS = ['p5glove'])
1696
vstEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
1697
guiProgramEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
1698
if getPlatform() == 'darwin':
1699
csoundProgramEnvironment.Append(LINKFLAGS = Split('''-framework Carbon -framework CoreAudio -framework CoreMidi'''))
1701
if (not (commonEnvironment['useFLTK'] == '1' and fltkFound)):
1702
print 'CONFIGURATION DECISION: Not building with FLTK graphs and widgets.'
1704
widgetsEnvironment = pluginEnvironment.Clone()
1705
if (commonEnvironment['buildvst4cs'] == '1'):
1706
widgetsEnvironment.Append(CCFLAGS = ['-DCS_VSTHOST'])
1707
if (commonEnvironment['noFLTKThreads'] == '1'):
1708
widgetsEnvironment.Append(CCFLAGS = ['-DNO_FLTK_THREADS'])
1709
if getPlatform() == 'linux' or (getPlatform() == 'sunos' and compilerGNU()):
1710
## dont do this widgetsEnvironment.Append(CCFLAGS = ['-DCS_VSTHOST'])
1711
widgetsEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
1712
widgetsEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
1714
widgetsEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
1715
widgetsEnvironment.Append(LIBS = ['pthread', 'm'])
1716
elif getPlatform() == 'win32':
1718
widgetsEnvironment.Append(CPPFLAGS = Split('-DWIN32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -DFL_DLL -DFL_LIBRARY'))
1719
widgetsEnvironment.Append(LIBS = Split('fltk_images fltk_png fltk_jpeg fltk_z fltk'))
1720
# widgetsEnvironment.Append(LIBS = Split('mgwfltknox_images-1.3 mgwfltknox-1.3 mgwfltknox_forms-1.3'))
1722
widgetsEnvironment.Append(LIBS = Split('fltkimages fltkpng fltkz fltkjpeg fltk'))
1723
widgetsEnvironment.Append(LIBS = csoundWindowsLibraries)
1724
elif getPlatform() == 'darwin':
1725
widgetsEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
1726
makePlugin(widgetsEnvironment, 'widgets',
1727
['InOut/FL_graph.cpp', 'InOut/winFLTK.c', 'InOut/widgets.cpp'])
1729
if commonEnvironment['buildVirtual'] == '0' or not fltk117Found:
1730
print "CONFIGURATION DECISION: Not building Virtual Keyboard plugin. (FLTK 1.1.7+ required)"
1732
print "CONFIGURATION DECISION: Building Virtual Keyboard plugin."
1733
widgetsEnvironment.Append(CPPPATH = ['./InOut', './InOut/virtual_keyboard'])
1734
makePlugin(widgetsEnvironment, 'virtual',
1735
['InOut/virtual_keyboard/FLTKKeyboard.cpp',
1736
'InOut/virtual_keyboard/FLTKKeyboardWindow.cpp',
1737
'InOut/virtual_keyboard/FLTKKeyboardWidget.cpp',
1738
'InOut/virtual_keyboard/virtual_keyboard.cpp',
1739
'InOut/virtual_keyboard/Bank.cpp',
1740
'InOut/virtual_keyboard/KeyboardMapping.cpp',
1741
'InOut/virtual_keyboard/Program.cpp',
1742
'InOut/virtual_keyboard/SliderBank.cpp',
1743
'InOut/virtual_keyboard/SliderData.cpp'])
1745
# REAL TIME AUDIO AND MIDI
1747
if commonEnvironment['useCoreAudio'] == '1' and getPlatform() == 'darwin':
1748
print "CONFIGURATION DECISION: Building CoreAudio plugin."
1749
coreaudioEnvironment = pluginEnvironment.Clone()
1750
coreaudioEnvironment.Append(CCFLAGS = ['-I/System/Library/Frameworks/CoreAudio.framework/Headers'])
1751
makePlugin(coreaudioEnvironment, 'rtcoreaudio', ['InOut/rtcoreaudio.c'])
1753
print "CONFIGURATION DECISION: Not building CoreAudio plugin."
1755
if not (commonEnvironment['useALSA'] == '1' and alsaFound):
1756
print "CONFIGURATION DECISION: Not building ALSA plugin."
1758
print "CONFIGURATION DECISION: Building ALSA plugin."
1759
alsaEnvironment = pluginEnvironment.Clone()
1760
alsaEnvironment.Append(LIBS = ['asound', 'pthread'])
1761
makePlugin(alsaEnvironment, 'rtalsa', ['InOut/rtalsa.c'])
1763
if pulseaudioFound and (getPlatform() == 'linux' or getPlatform() == 'sunos'):
1764
print "CONFIGURATION DECISION: Building PulseAudio plugin"
1765
pulseaudioEnv = pluginEnvironment.Clone()
1766
pulseaudioEnv.Append(LIBS = ['pulse-simple'])
1767
makePlugin(pulseaudioEnv, 'rtpulse', ['InOut/rtpulse.c'])
1769
if getPlatform() == 'win32':
1770
winmmEnvironment = pluginEnvironment.Clone()
1771
winmmEnvironment.Append(LIBS = ['winmm', 'gdi32', 'kernel32'])
1772
makePlugin(winmmEnvironment, 'rtwinmm', ['InOut/rtwinmm.c'])
1774
if not (commonEnvironment['usePortAudio'] == '1' and portaudioFound):
1775
print "CONFIGURATION DECISION: Not building PortAudio module."
1777
print "CONFIGURATION DECISION: Building PortAudio module."
1778
portaudioEnvironment = pluginEnvironment.Clone()
1779
if getPlatform() == 'win32':
1780
portaudioEnvironment.Append(LIBS = ['portaudio'])
1782
portaudioEnvironment.Append(LIBS = ['portaudio'])
1783
if (getPlatform() == 'linux'):
1784
if (commonEnvironment['useJack']=='1' and jackFound):
1785
print "Adding Jack library for PortAudio"
1786
portaudioEnvironment.Append(LIBS = ['jack'])
1787
portaudioEnvironment.Append(LIBS = ['asound', 'pthread'])
1788
makePlugin(portaudioEnvironment, 'rtpa', ['InOut/rtpa.c'])
1789
elif getPlatform() == 'win32':
1790
portaudioEnvironment.Append(LIBS = ['winmm', 'dsound'])
1791
portaudioEnvironment.Append(LIBS = csoundWindowsLibraries)
1792
makePlugin(portaudioEnvironment, 'rtpa', ['InOut/rtpa.cpp'])
1794
makePlugin(portaudioEnvironment, 'rtpa', ['InOut/rtpa.c'])
1796
if not (commonEnvironment['useJack'] == '1' and jackFound):
1797
print "CONFIGURATION DECISION: Not building JACK plugin."
1799
print "CONFIGURATION DECISION: Building JACK plugin."
1800
jackEnvironment = pluginEnvironment.Clone()
1801
if getPlatform() == 'linux':
1802
jackEnvironment.Append(LIBS = ['jack', 'asound', 'pthread'])
1803
elif getPlatform() == 'win32':
1804
jackEnvironment.Append(LIBS = ['jackdmp'])
1806
jackEnvironment.Append(LIBS = ['pthread', 'jack'])
1807
makePlugin(jackEnvironment, 'rtjack', ['InOut/rtjack.c'])
1809
if commonEnvironment['usePortMIDI'] == '1' and portmidiFound:
1810
print 'CONFIGURATION DECISION: Building with PortMIDI.'
1811
portMidiEnvironment = pluginEnvironment.Clone()
1812
portMidiEnvironment.Append(LIBS = ['portmidi'])
1813
if getPlatform() != 'darwin' and getPlatform() != 'win32':
1814
portMidiEnvironment.Append(LIBS = ['porttime'])
1815
if getPlatform() == 'win32':
1816
portMidiEnvironment.Append(LIBS = csoundWindowsLibraries)
1817
if getPlatform() == 'linux' and alsaFound:
1818
portMidiEnvironment.Append(LIBS = ['asound'])
1819
makePlugin(portMidiEnvironment, 'pmidi', ['InOut/pmidi.c'])
1821
print 'CONFIGURATION DECISION: Not building with PortMIDI.'
1825
if not (commonEnvironment['useOSC'] == '1' and oscFound):
1826
print "CONFIGURATION DECISION: Not building OSC plugin."
1828
print "CONFIGURATION DECISION: Building OSC plugin."
1829
oscEnvironment = pluginEnvironment.Clone()
1830
oscEnvironment.Append(LIBS = ['lo', 'pthread'])
1831
if getPlatform() == 'win32':
1832
oscEnvironment.Append(LIBS = csoundWindowsLibraries)
1834
oscEnvironment.Append(SHLINKFLAGS = ['-Wl,--enable-stdcall-fixup'])
1835
makePlugin(oscEnvironment, 'osc', ['Opcodes/OSC.c'])
1839
if commonEnvironment['useUDP'] == '0':
1840
print "CONFIGURATION DECISION: Not building UDP plugins."
1842
print "CONFIGURATION DECISION: Building UDP plugins."
1843
udpEnvironment = pluginEnvironment.Clone()
1844
udpEnvironment.Append(LIBS = ['pthread'])
1845
makePlugin(udpEnvironment, 'udprecv', ['Opcodes/sockrecv.c'])
1846
makePlugin(udpEnvironment, 'udpsend', ['Opcodes/socksend.c'])
1850
# FLUIDSYNTH OPCODES
1852
if not configure.CheckHeader("fluidsynth.h", language = "C"):
1853
print "CONFIGURATION DECISION: Not building fluid opcodes."
1855
print "CONFIGURATION DECISION: Building fluid opcodes."
1856
fluidEnvironment = pluginEnvironment.Clone()
1857
if getPlatform() == 'win32':
1859
fluidEnvironment.Append(LIBS = ['fluidsynth'])
1861
fluidEnvironment.Append(LIBS = ['fluidsynth'])
1862
fluidEnvironment.Append(CPPFLAGS = ['-DFLUIDSYNTH_NOT_A_DLL'])
1863
fluidEnvironment.Append(LIBS = ['winmm', 'dsound'])
1864
fluidEnvironment.Append(LIBS = csoundWindowsLibraries)
1865
elif getPlatform() == 'linux' or getPlatform() == 'darwin':
1866
fluidEnvironment.Append(LIBS = ['fluidsynth'])
1867
fluidEnvironment.Append(LIBS = ['pthread'])
1868
makePlugin(fluidEnvironment, 'fluidOpcodes',
1869
['Opcodes/fluidOpcodes/fluidOpcodes.cpp'])
1873
if (commonEnvironment['buildvst4cs'] != '1'):
1874
print "CONFIGURATION DECISION: Not building vst4cs opcodes."
1876
print "CONFIGURATION DECISION: Building vst4cs opcodes."
1877
if (getPlatform() == 'win32'or getPlatform() == 'linux') and fltkFound:
1878
vst4Environment = vstEnvironment.Clone()
1879
vst4Environment.Append(CPPFLAGS = ['-DCS_VSTHOST'])
1880
vst4Environment.Append(CPPPATH = ['frontends/CsoundVST'])
1882
if getPlatform() == 'win32':
1883
vst4Environment.Append(LIBS = Split('fltk_images fltk_png fltk_jpeg fltk_z fltk'))
1885
vst4Environment.Append(LIBS = Split('fltk_images png z jpeg fltk'))
1886
vst4Environment.Append(LIBS = ['stdc++'])
1887
if getPlatform() == 'win32':
1888
vst4Environment.Append(LIBS = csoundWindowsLibraries)
1889
makePlugin(vst4Environment, 'vst4cs', Split('''
1890
Opcodes/vst4cs/src/vst4cs.cpp
1891
Opcodes/vst4cs/src/fxbank.cpp
1892
Opcodes/vst4cs/src/vsthost.cpp
1894
elif getPlatform() == 'darwin' and fltkFound:
1895
vst4Environment = vstEnvironment.Clone()
1896
vst4Environment.Append(LIBS = ['fltk'])
1897
vst4Environment.Append(LIBS = ['stdc++'])
1898
vst4Environment.Append(LINKFLAGS=['-framework', 'carbon', '-framework',
1899
'ApplicationServices'])
1900
vst4Environment.Append(CPPPATH = ['frontends/CsoundVST'])
1901
vst4Environment.Append(CPPFLAGS = ['-DCS_VSTHOST'])
1902
makePlugin(vst4Environment, 'vst4cs', Split('''
1903
Opcodes/vst4cs/src/vst4cs.cpp Opcodes/vst4cs/src/fxbank.cpp
1904
Opcodes/vst4cs/src/vsthost.cpp
1909
if (commonEnvironment['buildDSSI'] == '1' and (getPlatform() == 'linux' or getPlatform() == 'darwin') and configure.CheckHeader("ladspa.h", language = "C")) and configure.CheckHeader("dssi.h", language = "C"):
1910
print "CONFIGURATION DECISION: Building DSSI plugin host opcodes."
1911
dssiEnvironment = pluginEnvironment.Clone()
1912
dssiEnvironment.Append(LIBS = ['dl'])
1913
makePlugin(dssiEnvironment, 'dssi4cs',
1914
['Opcodes/dssi4cs/src/load.c', 'Opcodes/dssi4cs/src/dssi4cs.c'])
1916
print "CONFIGURATION DECISION: Not building DSSI plugin host opcodes."
1919
if not (commonEnvironment['buildLoris'] == '1' and configure.CheckHeader("Opcodes/Loris/src/loris.h") and configure.CheckHeader("fftw3.h")):
1920
print "CONFIGURATION DECISION: Not building Loris Python extension and Csound opcodes."
1922
print "CONFIGURATION DECISION: Building Loris Python extension and Csound opcodes."
1923
# For Loris, we build only the loris Python extension module and
1924
# the Csound opcodes (modified for Csound 5).
1925
# It is assumed that you have copied all contents of the Loris
1926
# distribution into the csound5/Opcodes/Loris directory, e.g.
1927
# csound5/Opcodes/Loris/src/*, etc.
1928
lorisEnvironment = pluginEnvironment.Clone()
1929
lorisEnvironment.Append(CCFLAGS = '-DHAVE_FFTW3_H')
1930
if commonEnvironment['buildRelease'] == '0':
1931
lorisEnvironment.Append(CCFLAGS = '-DDEBUG_LORISGENS')
1932
if getPlatform() == 'win32':
1933
lorisEnvironment.Append(CCFLAGS = '-D_MSC_VER')
1935
if getPlatform() != 'win32':
1936
lorisEnvironment.Prepend(LIBS = ['stdc++'])
1937
lorisEnvironment.Append(CCFLAGS = Split('''
1938
-Wno-comment -Wno-unknown-pragmas -Wno-sign-compare
1940
lorisEnvironment.Append(CPPPATH = Split('''
1941
Opcodes/Loris Opcodes/Loris/src ./
1943
lorisSources = glob.glob('Opcodes/Loris/src/*.[Cc]')
1944
if 'Opcodes/Loris/src/lorisgens.C' in lorisSources:
1945
lorisSources.remove('Opcodes/Loris/src/lorisgens.C')
1946
lorisLibrarySources = []
1947
for i in lorisSources:
1948
lorisLibrarySources += lorisEnvironment.SharedObject(i)
1949
lorisLibrary = lorisEnvironment.StaticLibrary(
1950
'lorisbase', lorisLibrarySources)
1951
lorisEnvironment.Prepend(LIBS = ['lorisbase', 'fftw3'])
1952
# The following file has been patched for Csound 5
1953
# and you should update it from Csound 5 CVS.
1954
lorisOpcodes = makePlugin(lorisEnvironment, 'loris',
1955
['Opcodes/Loris/lorisgens5.C'])
1956
Depends(lorisOpcodes, lorisLibrary)
1957
lorisPythonEnvironment = lorisEnvironment.Clone()
1958
fixCFlagsForSwig(lorisPythonEnvironment)
1959
lorisPythonEnvironment.Append(CPPPATH = pythonIncludePath)
1960
lorisPythonEnvironment.Append(LINKFLAGS = pythonLinkFlags)
1961
lorisPythonEnvironment.Append(LIBPATH = pythonLibraryPath)
1962
if getPlatform() != 'darwin':
1963
lorisPythonEnvironment.Prepend(LIBS = pythonLibs)
1964
lorisPythonEnvironment.Append(SWIGPATH = ['./'])
1965
lorisPythonEnvironment.Prepend(SWIGFLAGS = Split('''
1966
-module loris -c++ -includeall -verbose -outdir . -python
1967
-DHAVE_FFTW3_H -I./Opcodes/Loris/src -I.
1969
lorisPythonWrapper = lorisPythonEnvironment.SharedObject(
1970
'Opcodes/Loris/scripting/loris.i')
1971
lorisPythonEnvironment['SHLIBPREFIX'] = ''
1972
lorisPythonModule = makePythonModule(lorisPythonEnvironment,
1973
'loris', lorisPythonWrapper)
1974
Depends(lorisPythonModule, lorisLibrary)
1978
if not (commonEnvironment['buildStkOpcodes'] == '1' and (stkFound or systemStkFound)):
1979
print 'CONFIGURATION DECISION: Not building STK opcodes.'
1981
print 'CONFIGURATION DECISION: Building STK opcodes.'
1982
# For the STK opcodes, the STK distribution include, src, and rawwaves
1983
# directories should be copied thusly:
1984
# csound5/Opcodes/stk/include
1985
# csound5/Opcodes/stk/src
1986
# csound5/Opcodes/stk/rawwaves
1987
# Then, the following sources (and any other future I/O or OS dependent
1988
# sources) should be ignored:
1989
# Or use the system library
1990
stkEnvironment = pluginEnvironment.Clone()
1992
stkEnvironment.Append(LIBS = 'stk')
1994
if getPlatform() == 'win32':
1995
stkEnvironment.Append(CCFLAGS = '-D__OS_WINDOWS__')
1996
stkEnvironment.Append(CCFLAGS = '-D__STK_REALTIME__')
1997
elif getPlatform() == 'linux':
1998
stkEnvironment.Append(CCFLAGS = '-D__OS_LINUX__')
1999
stkEnvironment.Append(CCFLAGS = '-D__LINUX_ALSA__')
2000
stkEnvironment.Append(CCFLAGS = '-D__STK_REALTIME__')
2001
elif getPlatform() == 'darwin':
2002
stkEnvironment.Append(CCFLAGS = '-D__OS_MACOSX__')
2003
if sys.byteorder == 'big':
2004
stkEnvironment.Append(CCFLAGS = '-D__BIG_ENDIAN__')
2006
stkEnvironment.Append(CCFLAGS = '-D__LITTLE_ENDIAN__')
2007
stkEnvironment.Prepend(CPPPATH = Split('''
2008
Opcodes/stk/include Opcodes/stk/src ./ ./../include
2010
stkSources_ = glob.glob('Opcodes/stk/src/*.cpp')
2012
for source in stkSources_:
2013
stkSources.append(source.replace('\\', '/'))
2014
for removeMe in removeSources:
2015
stkSources.remove(removeMe)
2016
stkLibrarySources = []
2017
for i in stkSources:
2018
stkLibrarySources += stkEnvironment.SharedObject(i)
2019
stkLibrary = stkEnvironment.StaticLibrary('stk_base', stkLibrarySources)
2020
stkEnvironment.Prepend(LIBS = ['stk_base'])
2021
if compilerGNU() and getPlatform() != 'win32':
2022
stkEnvironment.Append(LIBS = ['stdc++'])
2023
if getPlatform() == 'win32':
2024
stkEnvironment.Append(LIBS = csoundWindowsLibraries)
2025
elif getPlatform() == 'linux' or getPlatform() == 'darwin' or getPlatform() == 'sunos':
2026
stkEnvironment.Append(LIBS = ['pthread'])
2027
# This is the one that actually defines the opcodes.
2028
# They are straight wrappers, as simple as possible.
2029
stk = makePlugin(stkEnvironment, 'stkopcodes', ['Opcodes/stk/stkOpcodes.cpp'])
2033
if not (pythonFound and commonEnvironment['buildPythonOpcodes'] != '0'):
2034
print "CONFIGURATION DECISION: Not building Python opcodes."
2036
print "CONFIGURATION DECISION: Building Python opcodes."
2037
pyEnvironment = pluginEnvironment.Clone()
2038
if getPlatform() != 'darwin':
2039
pyEnvironment.Append(CPPPATH = pythonIncludePath)
2040
pyEnvironment.Append(LIBPATH = pythonLibraryPath)
2042
pyEnvironment.Append(CPPPATH = "/System/Library/Frameworks/Python.framework/Headers")
2044
pyEnvironment.Append(LINKFLAGS = pythonLinkFlags)
2045
pyEnvironment.Append(LIBS = pythonLibs)
2046
if getPlatform() == 'linux':
2047
pyEnvironment.Append(LIBS = ['util', 'dl', 'm'])
2048
elif getPlatform() == 'darwin' or getPlatform() == 'sunos':
2049
pyEnvironment.Append(LIBS = ['dl', 'm'])
2050
elif getPlatform() == 'win32':
2051
pyEnvironment['ENV']['PATH'] = os.environ['PATH']
2052
pyEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
2053
pythonOpcodes = makePlugin(pyEnvironment, 'py',
2054
['Opcodes/py/pythonopcodes.c'])
2055
if getPlatform() == 'win32' and pythonLibs[0] < 'python24':
2056
Depends(pythonOpcodes, pythonImportLibrary)
2060
if not (commonEnvironment['buildLuaOpcodes'] != '0'):
2061
print "CONFIGURATION DECISION: Not building Lua opcodes."
2063
print "CONFIGURATION DECISION: Building Lua opcodes."
2064
luaEnvironment = pluginEnvironment.Clone()
2066
if getPlatform() == 'linux':
2068
luaEnvironment.Append(LIBS = ['lua5.1'])
2069
luaEnvironment.Append(LIBS = ['util', 'dl', 'm'])
2070
elif getPlatform() == 'win32':
2072
luaEnvironment.Append(LIBS = ['lua51'])
2073
luaEnvironment['ENV']['PATH'] = os.environ['PATH']
2074
luaEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
2075
elif getPlatform() == 'darwin':
2076
luaEnvironment.Append(LIBS = 'luajit-51')
2077
luaEnvironment.Append(CPPPATH = '/usr/local/include/luajit-2.0')
2078
luaEnvironment.Append(CPPFLAGS = '-fopenmp')
2079
luaOpcodes = makePlugin(luaEnvironment, 'LuaCsound',
2080
['Opcodes/LuaCsound.cpp'])
2082
#############################################################################
2085
stdutilSources = Split('''
2086
util/atsa.c util/cvanal.c util/dnoise.c
2087
util/envext.c util/xtrct.c util/het_export.c
2088
util/het_import.c util/hetro.c util/lpanal.c
2089
util/lpc_export.c util/lpc_import.c util/mixer.c
2090
util/pvanal.c util/pvlook.c util/scale.c
2091
util/sndinfo.c util/srconv.c util/pv_export.c
2095
stdutilSources += pluginEnvironment.SharedObject('util/sdif', 'SDIF/sdif.c')
2097
makePlugin(pluginEnvironment, 'stdutil', stdutilSources)
2099
if (commonEnvironment['buildUtilities'] != '0'):
2101
['atsa', 'util/atsa_main.c' ],
2102
['cvanal', 'util/cvl_main.c' ],
2103
['dnoise', 'util/dnoise_main.c' ],
2104
['envext', 'util/env_main.c' ],
2105
['extractor', 'util/xtrc_main.c' ],
2106
['het_export', 'util/hetx_main.c' ],
2107
['het_import', 'util/heti_main.c' ],
2108
['hetro', 'util/het_main.c' ],
2109
['lpanal', 'util/lpc_main.c' ],
2110
['lpc_export', 'util/lpcx_main.c' ],
2111
['lpc_import', 'util/lpci_main.c' ],
2112
['mixer', 'util/mixer_main.c' ],
2113
['pvanal', 'util/pvc_main.c' ],
2114
['pvlook', 'util/pvl_main.c' ],
2115
['pv_export', 'util/pvx_main.c' ],
2116
['pv_import', 'util/pvi_main.c' ],
2117
['scale', 'util/scale_main.c' ],
2118
['sndinfo', 'util/sndinfo_main.c' ],
2119
['srconv', 'util/srconv_main.c' ]]
2121
executables.append(csoundProgramEnvironment.Program(i[0], i[1]))
2123
executables.append(csoundProgramEnvironment.Program('scsort',
2124
['util1/sortex/smain.c']))
2125
executables.append(csoundProgramEnvironment.Program('extract',
2126
['util1/sortex/xmain.c']))
2128
executables.append(commonEnvironment.Program('cs',
2129
['util1/csd_util/cs.c']))
2130
executables.append(commonEnvironment.Program('csb64enc',
2131
['util1/csd_util/base64.c', 'util1/csd_util/csb64enc.c']))
2132
executables.append(commonEnvironment.Program('makecsd',
2133
['util1/csd_util/base64.c', 'util1/csd_util/makecsd.c']))
2134
executables.append(commonEnvironment.Program('scot',
2135
['util1/scot/scot_main.c', 'util1/scot/scot.c']))
2136
#executables.append(csoundProgramEnvironment.Program('cscore',
2137
# ['util1/cscore/cscore_main.c']))
2138
executables.append(commonEnvironment.Program('sdif2ad',
2139
['SDIF/sdif2adsyn.c', 'SDIF/sdif.c', 'SDIF/sdif-mem.c']))
2141
for i in executables:
2142
Depends(i, csoundLibrary)
2144
#############################################################################
2147
#############################################################################
2149
def addOSXResourceFork(env, baseName, dirName):
2150
if getPlatform() == 'darwin':
2152
fileName = dirName + '/' + baseName
2155
env.Command(('%s/resources' % fileName).replace('/', '_'), fileName,
2156
"/Developer/Tools/Rez -i APPL -o $SOURCE cs5.r")
2158
csoundProgramSources = ['frontends/csound/csound_main.c']
2159
if getPlatform() == 'linux':
2160
csoundProgramSources = ['frontends/csound/sched.c'] + csoundProgramSources
2161
csoundProgram = csoundProgramEnvironment.Program('csound', csoundProgramSources)
2162
executables.append(csoundProgram)
2163
Depends(csoundProgram, csoundLibrary)
2165
def fluidTarget(env, dirName, baseName, objFiles):
2166
flFile = dirName + '/' + baseName + '.fl'
2167
cppFile = dirName + '/' + baseName + '.cpp'
2168
hppFile = dirName + '/' + baseName + '.hpp'
2169
env.Command([cppFile, hppFile], flFile,
2170
'fluid -c -o %s -h %s %s' % (cppFile, hppFile, flFile))
2175
# Build Csound5gui (FLTK frontend)
2177
if not (commonEnvironment['buildCsound5GUI'] != '0' and fltk117Found):
2178
print 'CONFIGURATION DECISION: Not building FLTK CSOUND5GUI frontend.'
2180
print 'CONFIGURATION DECISION: Building FLTK GUI CSOUND5GUI frontend.'
2181
csound5GUIEnvironment = csoundProgramEnvironment.Clone()
2182
csound5GUIEnvironment.Append(CPPPATH = ['./interfaces'])
2184
csound5GUIEnvironment.Append(LIBS = ['jack'])
2185
csound5GUIEnvironment.Prepend(CPPFLAGS = ['-DHAVE_JACK'])
2186
if getPlatform() == 'linux' or (getPlatform() == 'sunos' and compilerGNU()):
2187
csound5GUIEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
2188
csound5GUIEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
2190
csound5GUIEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
2191
csound5GUIEnvironment.Append(LIBS = ['pthread', 'm'])
2192
elif getPlatform() == 'win32':
2194
#csound5GUIEnvironment.Append(LIBS = ['stdc++', 'supc++'])
2195
csound5GUIEnvironment.Prepend(LINKFLAGS = Split('''
2196
-mwindows -Wl,--enable-runtime-pseudo-reloc
2198
csound5GUIEnvironment.Append(LIBS = Split('fltk_images fltk_png fltk_jpeg fltk_z fltk'))
2200
csound5GUIEnvironment.Append(LIBS = Split('fltkimages fltkpng fltkz fltkjpeg fltk'))
2201
csound5GUIEnvironment.Append(LIBS = csoundWindowsLibraries)
2202
elif getPlatform() == 'darwin':
2203
csound5GUIEnvironment.Prepend(CXXFLAGS = "-fno-rtti")
2204
csound5GUIEnvironment.Append(LIBS = Split('''
2205
fltk stdc++ pthread m
2207
csound5GUIEnvironment.Append(LINKFLAGS = Split('''
2208
-framework Carbon -framework ApplicationServices
2210
csound5GUISources = Split('''
2211
frontends/fltk_gui/ConfigFile.cpp
2212
frontends/fltk_gui/CsoundCopyrightInfo.cpp
2213
frontends/fltk_gui/CsoundGlobalSettings.cpp
2214
frontends/fltk_gui/CsoundGUIConsole.cpp
2215
frontends/fltk_gui/CsoundGUIMain.cpp
2216
frontends/fltk_gui/CsoundPerformance.cpp
2217
frontends/fltk_gui/CsoundPerformanceSettings.cpp
2218
frontends/fltk_gui/CsoundUtility.cpp
2219
frontends/fltk_gui/CsoundEditor.cpp
2220
frontends/fltk_gui/Fl_Native_File_Chooser.cxx
2221
frontends/fltk_gui/main.cpp
2223
csound5GUIFluidSources = Split('''
2224
CsoundAboutWindow_FLTK
2225
CsoundGlobalSettingsPanel_FLTK
2226
CsoundGUIConsole_FLTK
2228
CsoundPerformanceSettingsPanel_FLTK
2229
CsoundUtilitiesWindow_FLTK
2231
csound5GUIObjectFiles = []
2232
csound5GUIFluidObjectFiles = []
2233
for i in csound5GUISources:
2234
csound5GUIObjectFiles += csound5GUIEnvironment.Object(i)
2235
csound5GUIObjectFiles += csound5GUIEnvironment.Object(
2236
'frontends/fltk_gui/csPerfThread', 'interfaces/csPerfThread.cpp')
2237
for i in csound5GUIFluidSources:
2238
csound5GUIFluidObjectFiles += csound5GUIEnvironment.Object(
2239
fluidTarget(csound5GUIEnvironment, 'frontends/fltk_gui', i,
2240
csound5GUIObjectFiles))
2241
csound5GUIObjectFiles += csound5GUIFluidObjectFiles
2242
csound5GUI = csound5GUIEnvironment.Program('csound5gui',
2243
csound5GUIObjectFiles)
2244
Depends(csound5GUI, csoundLibrary)
2245
executables.append(csound5GUI)
2246
if getPlatform() == 'darwin':
2247
appDir = 'frontends/fltk_gui/Csound5GUI.app/Contents/MacOS'
2248
addOSXResourceFork(csound5GUIEnvironment, 'csound5gui', '')
2249
csound5GUIEnvironment.Command(
2250
'%s/csound5gui' % appDir, 'csound5gui', "cp $SOURCE %s/" % appDir)
2251
addOSXResourceFork(csound5GUIEnvironment, 'csound5gui', appDir)
2255
if not ((commonEnvironment['buildCSEditor'] == '1') and fltkFound):
2256
print 'CONFIGURATION DECISION: Not building Csound Text Editor.'
2258
csEditorEnvironment = commonEnvironment.Clone()
2259
if getPlatform() == 'linux':
2260
csEditorEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
2261
csEditorEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
2262
csEditor = csEditorEnvironment.Program( 'cseditor', 'frontends/cseditor/cseditor.cxx')
2263
executables.append(csEditor)
2264
elif getPlatform() == 'win32':
2266
#csEditorEnvironment.Append(LIBS = ['stdc++', 'supc++'])
2267
csEditorEnvironment.Prepend(LINKFLAGS = Split('''-mwindows -Wl,--enable-runtime-pseudo-reloc'''))
2268
csEditorEnvironment.Append(LIBS = Split('fltk_images fltk_png fltk_z fltk_jpeg fltk'))
2270
csEditorEnvironment.Append(LIBS = Split('fltkimages fltkpng fltkz fltkjpeg fltk'))
2271
csEditorEnvironment.Append(LIBS = csoundWindowsLibraries)
2272
csEditor = csEditorEnvironment.Program('cseditor', ['frontends/cseditor/cseditor.cxx'])
2273
executables.append(csEditor)
2274
elif getPlatform() == 'darwin':
2275
csEditorEnvironment.Prepend(CXXFLAGS = "-fno-rtti")
2276
csEditorEnvironment.Append(LIBS = Split('''
2277
fltk stdc++ pthread m
2279
csEditorEnvironment.Append(LINKFLAGS = Split('''
2280
-framework Carbon -framework ApplicationServices
2282
csEditor = csEditorEnvironment.Command('cseditor', 'frontends/cseditor/cseditor.cxx', "fltk-config --compile frontends/cseditor/cseditor.cxx")
2283
executables.append(csEditor)
2287
if not ((commonEnvironment['buildCsoundAC'] == '1') and fltkFound and boostFound and fltkFound):
2288
print 'CONFIGURATION DECISION: Not building CsoundAC extension module for Csound with algorithmic composition.'
2290
print 'CONFIGURATION DECISION: Building CsoundAC extension module for Csound with algorithmic composition.'
2291
acEnvironment = vstEnvironment.Clone()
2292
if getPlatform() == 'linux':
2293
acEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
2294
headers += glob.glob('frontends/CsoundAC/*.hpp')
2295
acEnvironment.Prepend(CPPPATH = ['frontends/CsoundAC', 'interfaces'])
2296
acEnvironment.Append(CPPPATH = pythonIncludePath)
2297
acEnvironment.Append(LINKFLAGS = pythonLinkFlags)
2298
acEnvironment.Append(LIBPATH = pythonLibraryPath)
2299
if getPlatform() != 'darwin':
2300
acEnvironment.Prepend(LIBS = pythonLibs)
2302
acEnvironment.Prepend(LIBS = 'musicxml2')
2303
if getPlatform() != 'win32':
2304
acEnvironment.Prepend(LIBS = csnd)
2306
acEnvironment.Prepend(LIBS = 'csnd')
2307
acEnvironment.Append(LINKFLAGS = libCsoundLinkFlags)
2308
if not getPlatform() == 'darwin' or commonEnvironment['dynamicCsoundLibrary']== '0':
2309
acEnvironment.Prepend(LIBS = libCsoundLibs)
2311
acEnvironment.Prepend(LINKFLAGS = ['-F.', '-framework', 'CsoundLib'])
2312
acEnvironment.Append(SWIGFLAGS = Split('-c++ -includeall -verbose -outdir .'))
2313
# csoundAC uses fltk_images, but -Wl,-as-needed willl wrongly discard it
2314
flag = '-Wl,-as-needed'
2315
if flag in acEnvironment['SHLINKFLAGS']:
2316
acEnvironment['SHLINKFLAGS'].remove(flag)
2317
if flag in acEnvironment['LINKFLAGS']:
2318
acEnvironment['LINKFLAGS'].remove(flag)
2319
if getPlatform() == 'linux':
2320
acEnvironment.Append(LIBS = ['util', 'dl', 'm'])
2321
acEnvironment.Append(LINKFLAGS = ['-Wl,-rpath-link,.'])
2322
acEnvironment.Append(LIBS = ['fltk_images'])
2323
guiProgramEnvironment.Prepend(LINKFLAGS = ['-Wl,-rpath-link,.'])
2324
elif getPlatform() == 'darwin':
2325
acEnvironment.Append(LIBS = ['fltk'])
2326
acEnvironment.Append(LIBS = ['dl', 'm', 'fltk_images', 'png', 'jpeg'])
2327
acEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
2328
acEnvironment.Append(SHLINKFLAGS = '--add-stdcall-alias')
2329
acEnvironment['SHLIBSUFFIX'] = '.dylib'
2330
elif getPlatform() == 'win32':
2331
acEnvironment.Prepend(CCFLAGS = Split('-D__Windows__ -D__BuildLib__'))
2333
acEnvironment.Prepend(LIBS = Split('fltk fltk_images fltk_png fltk_jpeg fltk_z'))
2335
acEnvironment.Prepend(LIBS = Split('fltk fltkimages fltkpng fltkjpeg fltkz'))
2336
for option in acEnvironment['CCFLAGS']:
2337
if string.find(option, '-D') == 0:
2338
acEnvironment.Append(SWIGFLAGS = [option])
2339
for option in acEnvironment['CPPFLAGS']:
2340
if string.find(option, '-D') == 0:
2341
acEnvironment.Append(SWIGFLAGS = [option])
2342
for option in acEnvironment['CPPPATH']:
2343
option = '-I' + option
2344
acEnvironment.Append(SWIGFLAGS = [option])
2345
print 'PATH =', commonEnvironment['ENV']['PATH']
2346
csoundAcSources = Split('''
2347
frontends/CsoundAC/Cell.cpp
2348
frontends/CsoundAC/ChordLindenmayer.cpp
2349
frontends/CsoundAC/Composition.cpp
2350
frontends/CsoundAC/Conversions.cpp
2351
frontends/CsoundAC/Counterpoint.cpp
2352
frontends/CsoundAC/CounterpointNode.cpp
2353
frontends/CsoundAC/Event.cpp
2354
frontends/CsoundAC/Hocket.cpp
2355
frontends/CsoundAC/ImageToScore.cpp
2356
frontends/CsoundAC/Lindenmayer.cpp
2357
frontends/CsoundAC/MCRM.cpp
2358
frontends/CsoundAC/Midifile.cpp
2359
frontends/CsoundAC/MusicModel.cpp
2360
frontends/CsoundAC/Node.cpp
2361
frontends/CsoundAC/Random.cpp
2362
frontends/CsoundAC/Rescale.cpp
2363
frontends/CsoundAC/Score.cpp
2364
frontends/CsoundAC/ScoreModel.cpp
2365
frontends/CsoundAC/ScoreNode.cpp
2366
frontends/CsoundAC/Sequence.cpp
2367
frontends/CsoundAC/Shell.cpp
2368
frontends/CsoundAC/Soundfile.cpp
2369
frontends/CsoundAC/StrangeAttractor.cpp
2370
frontends/CsoundAC/System.cpp
2371
frontends/CsoundAC/Voicelead.cpp
2372
frontends/CsoundAC/VoiceleadingNode.cpp
2374
swigflags = acEnvironment['SWIGFLAGS']
2375
acWrapperEnvironment = csoundWrapperEnvironment.Clone()
2376
fixCFlagsForSwig(acWrapperEnvironment)
2377
if commonEnvironment['dynamicCsoundLibrary'] == '1':
2378
if getPlatform() == 'linux':
2379
os.spawnvp(os.P_WAIT, 'rm', ['rm', '-f', 'libCsoundAC.so'])
2380
os.symlink('libCsoundAC.so.%s' % csoundLibraryVersion,
2382
linkflags = acEnvironment['SHLINKFLAGS'] + \
2383
[ '-Wl,-soname=libCsoundAC.so.%s' % csoundLibraryVersion ]
2384
csoundac = acEnvironment.SharedLibrary(
2385
'libCsoundAC.so.%s' % csoundLibraryVersion, csoundAcSources,
2386
SHLIBPREFIX = '', SHLIBSUFFIX = '', SHLINKFLAGS = linkflags )
2388
csoundac = acEnvironment.Library('CsoundAC', csoundAcSources)
2390
csoundac = acEnvironment.Library('CsoundAC', csoundAcSources)
2391
libs.append(csoundac)
2392
Depends(csoundac, csnd)
2393
pythonWrapperEnvironment = csoundWrapperEnvironment.Clone()
2394
pythonWrapperEnvironment.Prepend(LIBS = Split('csnd'))
2395
pythonCsoundACWrapperEnvironment = pythonWrapperEnvironment.Clone()
2396
if getPlatform() == 'darwin':
2397
pythonCsoundACWrapperEnvironment.Prepend(LIBS = ['CsoundAC'])
2398
pythonCsoundACWrapperEnvironment.Prepend(LIBS = ['fltk_images', 'fltk'])
2399
pythonCsoundACWrapperEnvironment.Append(LINKFLAGS = pythonLinkFlags)
2400
pythonCsoundACWrapperEnvironment.Prepend(LIBPATH = pythonLibraryPath)
2401
pythonCsoundACWrapperEnvironment.Prepend(LIBS = pythonLibs)
2402
pythonCsoundACWrapperEnvironment.Append(CPPPATH = pythonIncludePath)
2404
pythonCsoundACWrapperEnvironment.Append(LINKFLAGS = pythonLinkFlags)
2405
pythonCsoundACWrapperEnvironment.Prepend(LIBPATH = pythonLibraryPath)
2406
pythonCsoundACWrapperEnvironment.Prepend(LIBS = pythonLibs)
2407
pythonCsoundACWrapperEnvironment.Append(CPPPATH = pythonIncludePath)
2408
pythonCsoundACWrapperEnvironment.Prepend(LIBS = ['CsoundAC', 'csnd', 'fltk_images'])
2409
csoundAcPythonWrapper = pythonCsoundACWrapperEnvironment.SharedObject(
2410
'frontends/CsoundAC/CsoundAC.i', SWIGFLAGS = [swigflags, Split('-python')])
2411
pythonCsoundACWrapperEnvironment.Clean('.', 'frontends/CsoundAC/CsoundAC_wrap.h')
2412
csoundAcPythonModule = makePythonModule(pythonCsoundACWrapperEnvironment, 'CsoundAC',
2413
csoundAcPythonWrapper)
2414
if getPlatform() == 'win32' and pythonLibs[0] < 'python24' and compilerGNU():
2415
Depends(csoundAcPythonModule, pythonImportLibrary)
2416
pythonModules.append('CsoundAC.py')
2417
Depends(csoundAcPythonModule, pythonWrapper)
2418
Depends(csoundAcPythonModule, csoundac)
2419
Depends(csoundAcPythonModule, csnd)
2421
luaCsoundACWrapperEnvironment = acWrapperEnvironment.Clone()
2422
if getPlatform() == 'win32':
2423
luaCsoundACWrapperEnvironment.Prepend(LIBS = Split('luaCsnd lua51 CsoundAC csnd fltk_images'))
2425
luaCsoundACWrapperEnvironment.Prepend(LIBS = [luaWrapper])
2426
luaCsoundACWrapperEnvironment.Prepend(LIBS = Split('CsoundAC csnd fltk_images'))
2427
luaCsoundACWrapper = luaCsoundACWrapperEnvironment.SharedObject(
2428
'frontends/CsoundAC/luaCsoundAC.i', SWIGFLAGS = [swigflags, Split('-lua ')])
2429
luaCsoundACWrapperEnvironment.Clean('.', 'frontends/CsoundAC/luaCsoundAC_wrap.h')
2430
CsoundAclModule = makeLuaModule(luaCsoundACWrapperEnvironment, 'luaCsoundAC', [luaCsoundACWrapper])
2431
Depends(CsoundAclModule, luaCsoundACWrapper)
2432
Depends(CsoundAclModule, luaWrapper)
2433
Depends(CsoundAclModule, csoundac)
2434
Depends(CsoundAclModule, csnd)
2439
if not ((commonEnvironment['buildCsoundVST'] == '1') and boostFound and fltkFound):
2440
print 'CONFIGURATION DECISION: Not building CsoundVST plugin and standalone.'
2442
print 'CONFIGURATION DECISION: Building CsoundVST plugin and standalone.'
2443
headers += glob.glob('frontends/CsoundVST/*.h')
2444
headers += glob.glob('frontends/CsoundVST/*.hpp')
2445
vstEnvironment.Prepend(CPPPATH = ['interfaces', 'frontends/CsoundVST'])
2446
guiProgramEnvironment.Append(CPPPATH = ['frontends/CsoundVST', 'interfaces'])
2447
vstEnvironment.Prepend(LIBS = ['csnd'])
2448
vstEnvironment.Append(LINKFLAGS = libCsoundLinkFlags)
2449
vstEnvironment.Append(LIBS = libCsoundLibs)
2450
if getPlatform() == 'linux':
2451
vstEnvironment.Append(LIBS = ['util', 'dl', 'm'])
2452
vstEnvironment.Append(LINKFLAGS = ['-Wl,-rpath-link,.'])
2453
guiProgramEnvironment.Prepend(LINKFLAGS = ['-Wl,-rpath-link,.'])
2454
elif getPlatform() == 'darwin':
2455
vstEnvironment.Append(LIBS = ['dl', 'm'])
2456
# vstEnvironment.Append(CXXFLAGS = ['-fabi-version=0']) # if gcc3.2-3
2457
vstEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
2458
vstEnvironment.Append(SHLINKFLAGS = '--add-stdcall-alias')
2459
vstEnvironment['SHLIBSUFFIX'] = '.dylib'
2460
elif getPlatform() == 'win32':
2462
vstEnvironment['ENV']['PATH'] = os.environ['PATH']
2463
vstEnvironment.Append(SHLINKFLAGS = Split('-Wl,--add-stdcall-alias --no-export-all-symbols'))
2464
vstEnvironment.Append(CCFLAGS = ['-DNDEBUG'])
2465
guiProgramEnvironment.Prepend(LINKFLAGS = Split('''
2466
-mwindows -Wl,--enable-runtime-pseudo-reloc
2468
vstEnvironment.Prepend(LINKFLAGS = ['-Wl,--enable-runtime-pseudo-reloc'])
2469
guiProgramEnvironment.Append(LINKFLAGS = '-mwindows')
2470
vstEnvironment.Append(LIBS = Split('fltk fltk_images fltk_png fltk_jpeg fltk_z'))
2472
vstEnvironment.Append(LIBS = Split('csound64 csnd fltk fltkimages fltkpng fltkjpeg fltkz'))
2473
print 'PATH =', commonEnvironment['ENV']['PATH']
2474
csoundVstSources = Split('''
2475
frontends/CsoundVST/vstsdk2.4/public.sdk/source/vst2.x/audioeffect.cpp
2476
frontends/CsoundVST/vstsdk2.4/public.sdk/source/vst2.x/audioeffectx.cpp
2477
frontends/CsoundVST/vstsdk2.4/public.sdk/source/vst2.x/vstplugmain.cpp
2478
frontends/CsoundVST/CsoundVST.cpp
2479
frontends/CsoundVST/CsoundVstFltk.cpp
2480
frontends/CsoundVST/CsoundVSTMain.cpp
2481
frontends/CsoundVST/CsoundVstUi.cpp
2483
if getPlatform() == 'win32':
2484
vstEnvironment.Append(LIBS = csoundWindowsLibraries)
2486
vstEnvironment.Append(SHLINKFLAGS = ['-module'])
2487
vstEnvironment['ENV']['PATH'] = os.environ['PATH']
2488
csoundVstSources.append('frontends/CsoundVST/_CsoundVST.def')
2489
csoundvst = vstEnvironment.SharedLibrary('CsoundVST', csoundVstSources)
2490
libs.append(csoundvst)
2491
Depends(csoundvst, csnd)
2492
Depends(csoundvst, csoundLibrary)
2493
guiProgramEnvironment.Append(LINKFLAGS = libCsoundLinkFlags)
2494
if commonEnvironment['useDouble'] != '0':
2495
csoundvstGui = guiProgramEnvironment.Program(
2496
'CsoundVSTShell', ['frontends/CsoundVST/csoundvst_main.cpp'],
2497
LIBS = Split('csound64 csnd CsoundVST'))
2499
csoundvstGui = guiProgramEnvironment.Program(
2500
'CsoundVSTShell', ['frontends/CsoundVST/csoundvst_main.cpp'],
2501
LIBS = Split('csound32 csnd CsoundVST'))
2502
executables.append(csoundvstGui)
2503
Depends(csoundvstGui, csoundvst)
2505
# Build csoundapi~ (pd class)
2507
print commonEnvironment['buildPDClass'], pdhfound
2508
if commonEnvironment['buildPDClass'] == '1' and pdhfound:
2509
print "CONFIGURATION DECISION: Building PD csoundapi~ class"
2510
pdClassEnvironment = commonEnvironment.Clone()
2511
pdClassEnvironment.Append(LINKFLAGS = libCsoundLinkFlags)
2512
pdClassEnvironment.Append(LIBS = libCsoundLibs)
2513
if getPlatform() == 'darwin':
2514
pdClassEnvironment.Append(LINKFLAGS = Split('''
2515
-bundle -flat_namespace -undefined suppress
2516
-framework Carbon -framework ApplicationServices
2518
pdClass = pdClassEnvironment.Program(
2519
'csoundapi~.pd_darwin',
2520
'frontends/csoundapi_tilde/csoundapi_tilde.c')
2521
elif getPlatform() == 'linux':
2522
pdClass = pdClassEnvironment.SharedLibrary(
2523
'csoundapi~.pd_linux',
2524
'frontends/csoundapi_tilde/csoundapi_tilde.c',
2525
SHLIBPREFIX = '', SHLIBSUFFIX = '')
2526
elif getPlatform() == 'win32':
2527
pdClassEnvironment.Append(LIBS = ['pd'])
2528
pdClassEnvironment.Append(LIBS = csoundWindowsLibraries)
2529
pdClassEnvironment.Append(SHLINKFLAGS = ['-module'])
2530
pdClassEnvironment['ENV']['PATH'] = os.environ['PATH']
2531
pdClass = pdClassEnvironment.SharedLibrary(
2532
'csoundapi~', 'frontends/csoundapi_tilde/csoundapi_tilde.c')
2533
Depends(pdClass, csoundLibrary)
2534
libs.append(pdClass)
2538
if commonEnvironment['buildTclcsound'] == '1' and tclhfound:
2539
print "CONFIGURATION DECISION: Building Tclcsound frontend"
2540
csTclEnvironment = commonEnvironment.Clone()
2541
csTclEnvironment.Append(LINKFLAGS = libCsoundLinkFlags)
2542
csTclEnvironment.Append(LIBS = libCsoundLibs)
2544
csTclEnvironment.Append(LIBS = ['mpadec'])
2545
if getPlatform() == 'darwin':
2546
csTclEnvironment.Append(CCFLAGS = Split('''
2547
-I/Library/Frameworks/Tcl.framework/Headers
2548
-I/Library/Frameworks/Tk.framework/Headers
2549
-I/System/Library/Frameworks/Tcl.framework/Headers
2550
-I/System/Library/Frameworks/Tk.framework/Headers
2552
csTclEnvironment.Append(LINKFLAGS = Split('''
2553
-framework tk -framework tcl
2555
elif getPlatform() == 'linux':
2556
csTclEnvironment.Append(CPPPATH = tclIncludePath)
2557
lib1 = 'tcl%s' % commonEnvironment['tclversion']
2558
lib2 = 'tk%s' % commonEnvironment['tclversion']
2559
csTclEnvironment.Append(LIBS = [lib1, lib2, 'dl', 'pthread'])
2560
elif getPlatform() == 'win32':
2561
lib1 = 'tcl%s' % commonEnvironment['tclversion']
2562
lib2 = 'tk%s' % commonEnvironment['tclversion']
2563
csTclEnvironment.Append(LIBS = [lib1, lib2])
2564
csTclEnvironment.Append(LIBS = csoundWindowsLibraries)
2565
csTclEnvironment.Append(SHLINKFLAGS = ['-module'])
2566
csTclCmdObj = csTclEnvironment.SharedObject(
2567
'frontends/tclcsound/commands.c')
2568
csTcl = csTclEnvironment.Program(
2569
'cstclsh', ['frontends/tclcsound/main_tclsh.c', csTclCmdObj])
2570
csTk = csTclEnvironment.Program(
2571
'cswish', ['frontends/tclcsound/main_wish.c', csTclCmdObj])
2572
Tclcsoundlib = csTclEnvironment.SharedLibrary(
2573
'tclcsound', ['frontends/tclcsound/tclcsound.c', csTclCmdObj],
2575
if getPlatform() == 'darwin':
2576
csTclEnvironment.Command('cswish_resources', 'cswish',
2577
"/Developer/Tools/Rez -i APPL -o cswish frontends/tclcsound/cswish.r")
2578
#if commonEnvironment['dynamicCsoundLibrary'] == '1':
2579
# if commonEnvironment['useDouble'] == '0':
2580
# tcloc = 'CsoundLib.framework/Resources/TclTk/'
2582
# tcloc = 'CsoundLib64.framework/Resources/TclTk/'
2583
# csTclEnvironment.Command('tclcsound_install', 'tclcsound.dylib',
2584
# 'mkdir ' + tcloc + ';cp -R tclcsound.dylib ' + tcloc)
2586
Depends(csTcl, csoundLibrary)
2587
Depends(csTk, csoundLibrary)
2588
Depends(Tclcsoundlib, csoundLibrary)
2589
executables.append(csTcl)
2590
executables.append(csTk)
2591
libs.append(Tclcsoundlib)
2593
os.mkdir('tclcsound', 0755)
2596
# if getPlatform() == 'darwin':
2597
# csTclEnvironment.Command('tclcsound/pkgIndex.tcl', 'tclcsound.dylib','cp tclcsound.dylib tclcsound; tclsh pkgbuild.tcl')
2598
# elif getPlatform() == 'linux':
2599
# csTclEnvironment.Command('tclcsound/pkgIndex.tcl', 'tclcsound.so','cp tclcsound.so tclcsound; tclsh pkgbuild.tcl')
2600
# elif getPlatform() == 'win32':
2601
# csTclEnvironment.Command('tclcsound/tclcsound.dll', 'tclcsound.dll','cp tclcsound.dll tclcsound')
2602
# csTclEnvironment.Command('tclcsound/pkgIndex.tcl', 'tclcsound/tclcsound.dll','tclsh84 pkgbuild.tcl')
2605
print "CONFIGURATION DECISION: Not building Tclcsound"
2607
# Build Winsound FLTK frontend
2609
if commonEnvironment['buildWinsound'] == '1' and fltkFound:
2610
print "CONFIGURATION DECISION: Building Winsound frontend"
2611
# should these be installed ?
2612
# headers += glob.glob('frontends/winsound/*.h')
2613
csWinEnvironment = commonEnvironment.Clone()
2614
csWinEnvironment.Append(LINKFLAGS = libCsoundLinkFlags)
2615
csWinEnvironment.Append(LIBS = libCsoundLibs)
2617
csWinEnvironment.Append(LIBS = ['mpadec'])
2619
# if (commonEnvironment['noFLTKThreads'] == '1'):
2620
# csWinEnvironment.Append(CCFLAGS = ['-DNO_FLTK_THREADS'])
2621
if getPlatform() == 'linux':
2622
csWinEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
2623
csWinEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
2624
elif getPlatform() == 'win32':
2626
csWinEnvironment.Append(LIBS = Split('fltk_images fltk_png fltk_jpeg fltk_z fltk'))
2627
#csWinEnvironment.Append(LIBS = ['stdc++', 'supc++'])
2628
csWinEnvironment.Prepend(LINKFLAGS = Split('''
2629
-mwindows -Wl,--enable-runtime-pseudo-reloc
2632
csWinEnvironment.Append(LIBS = Split('fltkimages fltkpng fltkz fltkjpeg fltk'))
2633
csWinEnvironment.Append(LIBS = csoundWindowsLibraries)
2634
elif getPlatform() == 'darwin':
2635
csWinEnvironment.Append(CXXFLAGS = ['-fno-rtti'])
2636
csWinEnvironment.Append(LIBS = ['fltk', 'stdc++', 'pthread', 'm'])
2637
csWinEnvironment.Append(LINKFLAGS = Split('''
2638
-framework Carbon -framework CoreAudio -framework CoreMidi
2639
-framework ApplicationServices
2641
appDir = 'frontends/winsound/Winsound.app/Contents/MacOS'
2642
addOSXResourceFork(csWinEnvironment, 'winsound', '')
2643
csWinEnvironment.Command(
2644
'%s/winsound' % appDir, 'winsound', "cp $SOURCE %s/" % appDir)
2645
addOSXResourceFork(csWinEnvironment, 'winsound', appDir)
2646
winsoundFL = 'frontends/winsound/winsound.fl'
2647
winsoundSrc = 'frontends/winsound/winsound.cxx'
2648
winsoundHdr = 'frontends/winsound/winsound.h'
2649
csWinEnvironment.Command(
2650
[winsoundSrc, winsoundHdr], winsoundFL,
2651
'fluid -c -o %s -h %s %s' % (winsoundSrc, winsoundHdr, winsoundFL))
2652
winsoundMain = csWinEnvironment.Object('frontends/winsound/main.cxx')
2653
Depends(winsoundMain, winsoundSrc)
2654
winsound5 = csWinEnvironment.Program(
2655
'winsound', [winsoundMain, winsoundSrc])
2656
Depends(winsound5, csoundLibrary)
2657
executables.append(winsound5)
2659
print "CONFIGURATION DECISION: Not building Winsound"
2661
if (getPlatform() == 'darwin' and commonEnvironment['buildOSXGUI'] == '1'):
2662
print "CONFIGURATION DECISION: building OSX GUI frontend"
2663
csOSXGUIEnvironment = commonEnvironment.Clone()
2664
OSXGUI = csOSXGUIEnvironment.Command(
2665
'''frontends/OSX/build/Csound 5.app/Contents/MacOS/Csound 5''',
2666
'frontends/OSX/main.c',
2667
"cd frontends/OSX; xcodebuild -buildstyle Deployment")
2668
Depends(OSXGUI, csoundLibrary)
2670
print "CONFIGURATION DECISION: Not building OSX GUI frontend"
2673
print "CONFIGURATION DEFAULT: Building csLadspa."
2674
csLadspaEnv = commonEnvironment.Clone()
2675
csLadspaEnv.Append(LINKFLAGS = libCsoundLinkFlags)
2676
csLadspaEnv.Append(LIBS=libCsoundLibs)
2677
csLadspaEnv.Append(CCFLAGS='-I./frontends/csladspa')
2678
if getPlatform() == "darwin":
2679
if commonEnvironment['dynamicCsoundLibrary'] != '0':
2680
csLadspaEnv.Append(LINKFLAGS=Split('''-bundle -undefined suppress -flat_namespace'''))
2682
csLadspaEnv.Append(LINKFLAGS="-bundle")
2683
csladspa = csLadspaEnv.Program('csladspa.so', 'frontends/csladspa/csladspa.cpp' )
2685
csladspa = csLadspaEnv.SharedLibrary('csladspa', 'frontends/csladspa/csladspa.cpp')
2686
Depends(csladspa, csoundLibrary)
2687
libs.append(csladspa)
2689
# Build beats (score generator)
2691
if not (commonEnvironment['buildBeats'] != '0'):
2692
print 'CONFIGURATION DECISION: Not building beats score frontend.'
2694
print "CONFIGURATION DECISION: Building beats score frontend"
2695
csBeatsEnvironment = Environment(ENV = os.environ)
2696
csBeatsEnvironment.Append(LINKFLAGS = ['-lm'])
2697
csBeatsEnvironment.Append(YACCFLAGS = ['-d'])
2698
#csBeatsEnvironment.Append(LEXFLAGS = ['-Pbeats'])
2699
byb = csBeatsEnvironment.CFile(target = 'frontends/beats/beats.tab.c',
2700
source = 'frontends/beats/beats.y')
2701
blb = csBeatsEnvironment.CFile(target = 'frontends/beats/lex.yy.c',
2702
source = 'frontends/beats/beats.l')
2703
bb = csBeatsEnvironment.Program('csbeats',
2704
['frontends/beats/main.c',
2705
'frontends/beats/lex.yy.c',
2706
'frontends/beats/beats.tab.c'])
2707
executables.append(bb)
2709
if not (commonEnvironment['buildcatalog'] != '0'):
2710
print 'CONFIGURATION DECISION: Not building catalog builder.'
2712
print "CONFIGURATION DECISION: Building catalog builder"
2713
catEnvironment = Environment(ENV = os.environ)
2714
catEnvironment.Append(LINKFLAGS = ['-ldl'])
2715
bb = catEnvironment.Program('mkdb', ['mkdb.c'])
2716
executables.append(bb)
2719
if (commonEnvironment['generateTags']=='0') or (getPlatform() != 'darwin' and getPlatform() != 'linux'):
2720
print "CONFIGURATION DECISION: Not calling TAGS"
2722
print "CONFIGURATION DECISION: Calling TAGS"
2723
allSources = string.join(glob.glob('*/*.h*'))
2724
allSources = allSources + ' ' + string.join(glob.glob('*/*.c'))
2725
allSources = allSources + ' ' + string.join(glob.glob('*/*.cpp'))
2726
allSources = allSources + ' ' + string.join(glob.glob('*/*.hpp'))
2727
allSources = allSources + ' ' + string.join(glob.glob('*/*/*.c'))
2728
allSources = allSources + ' ' + string.join(glob.glob('*/*/*.cpp'))
2729
allSources = allSources + ' ' + string.join(glob.glob('*/*/*.h'))
2730
allSources = allSources + ' ' + string.join(glob.glob('*/*/*.hpp'))
2731
tags = commonEnvironment.Command('TAGS', Split(allSources), 'etags $SOURCES')
2732
Depends(tags, csoundLibrary)
2734
def gettextTarget(env, baseName, target):
2735
gtFile = 'po/' + baseName + '.po'
2736
ttFile = 'po/' + target + '/LC_MESSAGES/csound5.mo'
2737
env.Command(ttFile, gtFile,
2738
'msgfmt -o %s %s' % (ttFile, gtFile))
2741
if commonEnvironment['useGettext'] == '1':
2742
csound5GettextEnvironment = csoundProgramEnvironment.Clone()
2743
gettextTarget(csound5GettextEnvironment, 'french', 'fr')
2744
gettextTarget(csound5GettextEnvironment, 'american', 'en_US')
2745
gettextTarget(csound5GettextEnvironment, 'csound', 'en_GB')
2746
gettextTarget(csound5GettextEnvironment, 'es_CO', 'es_CO')
2747
## The following are incomplete
2748
gettextTarget(csound5GettextEnvironment, 'german', 'de')
2749
gettextTarget(csound5GettextEnvironment, 'italian', 'it')
2750
gettextTarget(csound5GettextEnvironment, 'romanian', 'ro')
2751
gettextTarget(csound5GettextEnvironment, 'russian', 'ru')
2755
INSTDIR = commonEnvironment['instdir']
2756
PREFIX = INSTDIR + commonEnvironment['prefix']
2758
BIN_DIR = PREFIX + "/bin"
2759
INCLUDE_DIR = PREFIX + "/include/csound"
2761
if (commonEnvironment['Lib64'] == '1'):
2762
LIB_DIR = PREFIX + "/lib64"
2763
PYTHON_DIR = '%s/lib64' % sys.prefix
2765
LIB_DIR = PREFIX + "/lib"
2766
PYTHON_DIR = '%s/lib' % sys.prefix
2767
PYTHON_DIR += '/python%s/site-packages' % commonEnvironment['pythonVersion']
2770
if i[:sys.prefix.__len__()] == sys.prefix and i[-13:] == 'site-packages':
2773
if commonEnvironment['useDouble'] == '0':
2774
PLUGIN_DIR = LIB_DIR + "/csound/plugins"
2776
PLUGIN_DIR = LIB_DIR + "/csound/plugins64"
2777
if getPlatform() == 'linux':
2778
PLUGIN_DIR += '-' + csoundLibraryVersion
2780
if commonEnvironment['install'] == '1':
2781
installExecutables = Alias('install-executables',
2782
Install(BIN_DIR, executables))
2783
installOpcodes = Alias('install-opcodes',
2784
Install(PLUGIN_DIR, pluginLibraries))
2785
installHeaders = Alias('install-headers',
2786
Install(INCLUDE_DIR, headers))
2787
installLibs = Alias('install-libs',
2788
Install(LIB_DIR, libs))
2789
installPythonModules = Alias('install-py',
2790
Install(PYTHON_DIR, pythonModules))
2791
Alias('install', [installExecutables, installOpcodes, installLibs, installHeaders, installPythonModules])
2793
if getPlatform() == 'darwin' and commonEnvironment['useFLTK'] == '1':
2794
print "CONFIGURATION DECISION: Adding resource fork for csound"
2795
addOSXResourceFork(commonEnvironment, 'csound', '')
2797
###Code to create pkconfig files
2798
#env = Environment(tools=['default', 'scanreplace'], toolpath=['tools'])
2799
#env['prefix'] = '/usr/local'
2800
#env.ScanReplace('csound5.pc.in')