Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13911/src
Added Files:
Tag: devel_0_38
SConscript
Log Message:
scons build system
--- NEW FILE: SConscript ---
Import("env")
pdenv = env.Copy()
######################################################################
#
# general configuration
opt = Options(['options.cache', 'custom.py'])
opt.AddOptions(
BoolOption('debug', 'Build with debugging symbols', False),
BoolOption('nosimd', 'Build without simd instructions', False),
BoolOption('threadedsf', 'Build with threaded soundfiler', False),
BoolOption('atomic', 'Build with atomic operations', True),
BoolOption('newhash', 'Build with 16 bit symbol hash table', True),
BoolOption('lockfree', 'Build with lock-free fifos', True),
BoolOption('pdlib', 'Build with pdlib', False),
('optimize', 'Optimize for specific architecture', None),
('prefix', 'install prefix', '/usr/local')
)
opt.Update(pdenv)
opt.Save('options.cache',pdenv)
Help(opt.GenerateHelpText(pdenv))
######################################################################
#
# general configuration
prefix = pdenv['prefix']
sources = Split("""d_arithmetic.c
d_array.c
d_ctl.c
d_dac.c
d_delay.c
d_fft.c
d_fftroutine.c
d_filter.c
d_global.c
d_math.c
d_mayer_fft.c
d_misc.c
d_osc.c
d_resample.c
d_soundfile.c
d_ugen.c
g_all_guis.c
g_array.c
g_bang.c
g_canvas.c
g_editor.c
g_graph.c
g_guiconnect.c
g_hdial.c
g_hslider.c
g_io.c
g_mycanvas.c
g_numbox.c
g_readwrite.c
g_rtext.c
g_scalar.c
g_template.c
g_text.c
g_toggle.c
g_traversal.c
g_vdial.c
g_vslider.c
g_vumeter.c
m_atom.c
m_binbuf.c
m_class.c
m_conf.c
m_fifo.c
m_glob.c
m_memory.c
m_obj.c
m_pd.c
m_sched.c
m_simd.c
s_audio.c
s_file.c
s_inter.c
s_loader.c
s_main.c
s_midi.c
s_path.c
s_print.c
x_acoustics.c
x_arithmetic.c
x_connective.c
x_gui.c
x_interface.c
x_midi.c
x_misc.c
x_net.c
x_qlist.c
x_time.c""")
defs = []
######################################################################
#
# configure the build
conf = pdenv.Configure()
if not conf.CheckLib('m','sin'):
Exit(1)
if not conf.CheckLib('tcl'):
Exit(1)
if not conf.CheckLib('tk'):
Exit(1)
if not conf.CheckLib('X11', 'XCreateWindow'):
Exit(1)
if not conf.CheckLib('pthread', 'pthread_create'):
Exit(1)
if conf.CheckLib('dl', 'dlopen'):
defs.append('DL_OPEN')
jack = conf.CheckLib('jack','jack_activate')
alsa = conf.CheckLib('asound','snd_pcm_info')
portaudio = conf.CheckLib('portaudio','Pa_Initialize')
env=conf.Finish()
if pdenv['atomic']:
defs.append('ATOMIC')
if pdenv['nosimd']:
defs.append('DONTUSESIMD')
if pdenv['threadedsf']:
defs.append('THREADED_SF')
defs.append('GARRAY_THREAD_LOCK')
if pdenv['newhash']:
defs.append('NEWHASH')
if pdenv['lockfree']:
defs.append('LOCKFREE')
pdenv.Append(CPPDEFINES=defs)
######################################################################
#
# cross-platform configuration
pa_sources = Split("""s_audio_pa.c
s_audio_pablio.c
s_audio_paring.c""")
pm_sources = Split("s_midi_pm.c")
simd_sse_vc_sources = Split("m_simd_sse_vc.c")
simd_sse_gcc_sources = Split("m_simd_sse_gcc.c")
simd_ve_gcc_sources = Split("m_simd_ve_gcc.c")
if portaudio:
sources.append(pa_sources)
pdenv.Append(CPPDEFINES=Split("USEAPI_PA PA19"))
pdenv.Append(CPPPATH=Split("../portaudio ../portaudio/pablio"))
pdenv.Append(CPPPATH=".")
pdenv.Append(LIBPATH=".")
######################################################################
#
# windows configuration
windows_sources = Split("""s_audio_mmio.c
s_audio_asio.cpp
s_midi_mmio.c""")
windows_defs = Split("MSW USEAPI_ASIO")
if pdenv['PLATFORM'] == 'win32':
sources.append(windows_sources + simd_sse_vc_sources)
pdenv.Append(CPPDEFINES=windows_defs)
pdenv['pdlib'] = True ## split pd to pd.exe and pd.dll
######################################################################
#
# linux configuration
jack_sources = Split("s_audio_jack.c")
alsa_sources = Split("""s_audio_alsamm.c
s_audio_alsa.c""")
oss_sources = Split("s_audio_oss.c")
linux_defs = Split("UNISTD UNIX USEAPI_OSS")
linux_defs.append('INSTALL_PREFIX=\\\"%s\\\"' % prefix)
linux_libs = []
if alsa:
midi_sources = Split("s_midi_alsa.c")
else:
midi_sources = Split("s_midi_oss.c")
linux_sources = oss_sources + midi_sources
if not pdenv['nosimd']:
linux_sources.append(simd_sse_gcc_sources)
if alsa:
linux_sources.append(alsa_sources)
linux_defs.append("USEAPI_ALSA")
linux_libs.append('asound')
if jack:
linux_sources.append(jack_sources)
linux_defs.append("USEAPI_JACK")
linux_libs.append('jack')
if pdenv['PLATFORM'] == 'posix':
sources.append(linux_sources)
pdenv.Append(CPPDEFINES=linux_defs)
pdenv.Append(LIBS=linux_libs)
######################################################################
#
# osx configuration
osx_sources = pa_sources + pm_sources + simd_ve_gcc_sources
osx_defs = Split("UNIX")
if pdenv['PLATFORM'] == 'osx':
sources.append(osx_sources)
pdenv.Append(CPPDEFINES=osx_defs)
######################################################################
#
# sgi configuration
sgi_sources = Split("s_audio_sgi.c s_midi_sgi.c")
#todo: how to determine sgi?
######################################################################
#
# compiler options
flags = ''
if pdenv['debug']:
if ['msvc'] in pdenv['TOOLS']:
pass # how to switch on debugging on msvc?
else:
flags += " -g"
else:
if ['msvc'] in pdenv['TOOLS']:
pass # how to switch on optimizing on msvc?
else:
flags += " -O3"
if pdenv['optimize']:
if ['msvc'] in pdenv['TOOLS']:
pass # is there any machine optmizisation on msvc?
else:
flags += " -march=" + pdenv['optimize']
if not pdenv['nosimd']:
flags += " -mfpmath=sse -mmmx -msse -msse2"
pdenv.Append(CCFLAGS=flags)
pdenv.Append(CXXFLAGS=flags)
######################################################################
#
# binaries
pdwatchdog = pdenv.Program('pd-watchdog', "s_watchdog.c")
pdsend = pdenv.Program('pdsend', "u_pdsend.c")
pdreceive = pdenv.Program('pdreceive', "u_pdreceive.c")
pdgui = pdenv.Program('pd-gui', Split("t_main.c t_tkcmd.c"))
if pdenv['pdlib']:
pdlib = pdenv.SharedLibrary('pd', sources)
pdenv.Append(LIBS=pdlib)
pd = pdenv.Program('pd', 's_entry.c')
Default(pdwatchdog, pdsend, pdreceive, pdgui, pd, pdstarter)
else:
pd = pdenv.Program('pd', ['s_entry.c', sources],
LINKFLAGS="-Wl,-export-dynamic")
Default(pdwatchdog, pdsend, pdreceive, pdgui, pd)
######################################################################
#
# installing stuff
if pdenv['PLATFORM'] == 'posix':
pdenv.Install(prefix+'/bin', pdsend)
pdenv.Install(prefix+'/bin', pdreceive)
pdenv.Install(prefix+'/bin', pd)
pdenv.Install(prefix+'/lib/pd/bin', pdgui)
pdenv.Install(prefix+'/lib/pd/bin', pdwatchdog)
if pdenv['pdlib']:
pdenv.Install(prefix+'/lib', pdlib)
pdenv.Alias('install', prefix)