Unverified Commit aaaeeea8 authored by Karl Linden's avatar Karl Linden
Browse files

Refactor duplicated code into toplevel wscript.

parent 089bc063
#! /usr/bin/env python
# encoding: utf-8
def create_jack_driver_obj(bld, **kw):
driver = bld(
features = ['c', 'cxx', 'cxxshlib', 'cshlib'],
defines = ['HAVE_CONFIG_H', 'SERVER_SIDE'],
includes = ['../linux',
'../posix',
'../common',
'../common/jack',
'../dbus',
'../'],
install_path = '${ADDON_DIR}/',
**kw)
driver.env['cxxshlib_PATTERN'] = 'jack_%s.so'
return driver
def build(bld):
if bld.env['BUILD_JACKD'] == True:
jackd = bld(
features = ['cxx', 'cxxprogram'],
defines = ['HAVE_CONFIG_H','SERVER_SIDE'],
includes = ['../linux',
'../posix',
'../common/jack',
'../common',
'../dbus',
'../'],
target = 'jackd',
source = ['../common/Jackdmp.cpp'],
use = ['serverlib', 'DL', 'PTHREAD', 'RT', 'M', 'STDC++'])
if bld.env['IS_LINUX'] and bld.env['BUILD_JACKDBUS']:
jackd.source += ['../dbus/reserve.c', '../dbus/audio_reserve.c']
jackd.use += ['DBUS-1']
create_jack_driver_obj(
bld,
target = 'dummy',
source = '../common/JackDummyDriver.cpp')
alsa_driver_src = [
'alsa/JackAlsaDriver.cpp',
'alsa/alsa_rawmidi.c',
'alsa/alsa_seqmidi.c',
'alsa/alsa_midi_jackmp.cpp',
'../common/memops.c',
'alsa/generic_hw.c',
'alsa/hdsp.c',
'alsa/alsa_driver.c',
'alsa/hammerfall.c',
'alsa/ice1712.c'
]
alsarawmidi_driver_src = ['alsarawmidi/JackALSARawMidiDriver.cpp',
'alsarawmidi/JackALSARawMidiInputPort.cpp',
'alsarawmidi/JackALSARawMidiOutputPort.cpp',
'alsarawmidi/JackALSARawMidiPort.cpp',
'alsarawmidi/JackALSARawMidiReceiveQueue.cpp',
'alsarawmidi/JackALSARawMidiSendQueue.cpp',
'alsarawmidi/JackALSARawMidiUtil.cpp'
]
ffado_driver_src = ['firewire/JackFFADODriver.cpp',
'firewire/JackFFADOMidiInputPort.cpp',
'firewire/JackFFADOMidiOutputPort.cpp',
'firewire/JackFFADOMidiReceiveQueue.cpp',
'firewire/JackFFADOMidiSendQueue.cpp'
]
iio_driver_src = ['iio/JackIIODriver.cpp']
if bld.env['BUILD_DRIVER_ALSA']:
create_jack_driver_obj(
bld,
target = 'alsa',
source = alsa_driver_src,
use = ['ALSA'])
create_jack_driver_obj(
bld,
target = 'alsarawmidi',
source = alsarawmidi_driver_src,
use = ['ALSA'])
if bld.env['BUILD_DRIVER_FREEBOB']:
create_jack_driver_obj(
bld,
target = 'freebob',
source = 'freebob/JackFreebobDriver.cpp',
use = ['LIBFREEBOB'])
if bld.env['BUILD_DRIVER_FFADO']:
create_jack_driver_obj(
bld,
target = 'firewire',
source = ffado_driver_src,
use = ['LIBFFADO'])
if bld.env['BUILD_DRIVER_IIO']:
create_jack_driver_obj(
bld,
target = 'iio',
source = iio_driver_src,
use = ['GTKIOSTREAM', 'EIGEN3'])
create_jack_driver_obj(
bld,
target = 'net',
source = '../common/JackNetDriver.cpp')
create_jack_driver_obj(
bld,
target = 'loopback',
source = '../common/JackLoopbackDriver.cpp')
create_jack_driver_obj(
bld,
target = 'netone',
source = ['../common/JackNetOneDriver.cpp',
'../common/netjack.c',
'../common/netjack_packet.c'],
use = ['SAMPLERATE', 'CELT'])
create_jack_driver_obj(
bld,
target = 'proxy',
source = '../common/JackProxyDriver.cpp')
#! /usr/bin/env python
# encoding: utf-8
def create_jack_driver_obj(bld, target, sources, uselib = None):
driver = bld.new_task_gen('cxx', 'shlib')
driver.features.append('cc')
driver.env['shlib_PATTERN'] = 'jack_%s.so'
driver.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
driver.includes = ['.', '../macosx', '../posix', '../common', '../common/jack']
driver.target = target
driver.source = sources
driver.install_path = '${ADDON_DIR}/'
driver.uselib_local = 'serverlib'
if uselib:
driver.uselib = uselib
return driver
def create_jack_audio_driver_obj(bld, target, sources, uselib = None):
driver = bld.new_task_gen('cxx', 'shlib')
driver.features.append('cc')
driver.env['shlib_PATTERN'] = 'jack_%s.so'
driver.defines = 'HAVE_CONFIG_H'
driver.includes = ['.', '../macosx', '../posix', '../common', '../common/jack']
driver.target = target
driver.source = sources
driver.install_path = '${ADDON_DIR}/'
driver.uselib_local = 'serverlib'
driver.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreServices -framework AudioUnit")
if uselib:
driver.uselib = uselib
return driver
def create_jack_midi_driver_obj(bld, target, sources, uselib = None):
driver = bld.new_task_gen('cxx', 'shlib')
driver.features.append('cc')
driver.env['shlib_PATTERN'] = 'jack_%s.so'
driver.defines = 'HAVE_CONFIG_H'
driver.includes = ['.', '../macosx', '../posix', '../common', '../common/jack']
driver.target = target
driver.source = sources
driver.install_path = '${ADDON_DIR}/'
driver.uselib_local = 'serverlib'
driver.env.append_value("LINKFLAGS", "-framework CoreMIDI -framework CoreServices -framework AudioUnit")
if uselib:
driver.uselib = uselib
return driver
def build(bld):
if bld.env['BUILD_JACKD'] == True:
jackd = bld.new_task_gen('cxx', 'program')
jackd.includes = ['.', '../macosx', '../posix', '../common', '../common/jack']
jackd.defines = 'HAVE_CONFIG_H'
jackd.source = ['../common/Jackdmp.cpp']
jackd.uselib = 'PTHREAD DL'
jackd.uselib_local = 'serverlib'
jackd.env.append_value("LINKFLAGS", "-framework CoreFoundation")
jackd.target = 'jackd'
create_jack_driver_obj(bld, 'dummy', '../common/JackDummyDriver.cpp')
create_jack_driver_obj(bld, 'loopback', '../common/JackLoopbackDriver.cpp')
create_jack_audio_driver_obj(bld, 'coreaudio', 'coreaudio/JackCoreAudioDriver.cpp')
create_jack_midi_driver_obj(
bld,
'coremidi',
['coremidi/JackCoreMidiInputPort.cpp',
'coremidi/JackCoreMidiOutputPort.cpp',
'coremidi/JackCoreMidiPhysicalInputPort.cpp',
'coremidi/JackCoreMidiPhysicalOutputPort.cpp',
'coremidi/JackCoreMidiVirtualInputPort.cpp',
'coremidi/JackCoreMidiVirtualOutputPort.cpp',
'coremidi/JackCoreMidiPort.cpp',
'coremidi/JackCoreMidiUtil.cpp',
'coremidi/JackCoreMidiDriver.cpp'])
portaudio_src = [
'../windows/JackPortAudioDriver.cpp',
'../windows/JackPortAudioDevices.cpp',
]
#create_jack_audio_driver_obj(bld, 'portaudio', portaudio_src)
create_jack_driver_obj(bld, 'net', '../common/JackNetDriver.cpp')
create_jack_driver_obj(bld, 'netone', [ '../common/JackNetOneDriver.cpp',
'../common/netjack.c',
'../common/netjack_packet.c' ], "SAMPLERATE CELT" )
create_jack_driver_obj(bld, 'proxy', '../common/JackProxyDriver.cpp')
#! /usr/bin/env python
# encoding: utf-8
def create_jack_driver_obj(bld, target, sources, uselib = None):
driver = bld.new_task_gen('cxx', 'shlib')
driver.features.append('cc')
driver.env['shlib_PATTERN'] = 'jack_%s.so'
#driver.env.append_unique('CXXFLAGS', '-march=i686 -msse3 -ffast-math')
#driver.env.append_unique('CFLAGS', '-march=i686 -msse3 -ffast-math')
driver.defines = 'HAVE_CONFIG_H'
driver.includes = ['.', '..','../posix', '../common', '../common/jack']
driver.target = target
driver.source = sources
driver.install_path = '${ADDON_DIR}/'
driver.uselib_local = 'serverlib'
if uselib:
driver.uselib = uselib
return driver
def build(bld):
jackd = bld.new_task_gen('cxx', 'program')
jackd.includes = ['.','..', '../posix', '../common/jack', '../common']
jackd.defines = 'HAVE_CONFIG_H'
jackd.source = ['../common/Jackdmp.cpp']
jackd.uselib = 'PTHREAD DL'
jackd.uselib_local = 'serverlib'
jackd.target = 'jackd'
create_jack_driver_obj(bld, 'oss', ['oss/JackOSSDriver.cpp', '../common/memops.c'])
create_jack_driver_obj(bld, 'boomer', ['oss/JackBoomerDriver.cpp', '../common/memops.c'])
create_jack_driver_obj(bld, 'dummy', '../common/JackDummyDriver.cpp')
create_jack_driver_obj(bld, 'net', '../common/JackNetDriver.cpp')
create_jack_driver_obj(bld, 'loopback', '../common/JackLoopbackDriver.cpp')
create_jack_driver_obj(bld, 'proxy', '../common/JackProxyDriver.cpp')
#! /usr/bin/env python
# encoding: utf-8
def create_jack_driver_obj(bld, target, sources, uselib = None):
driver = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
driver.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
driver.includes = ['.', '..' , '../windows', '../common', '../common/jack']
driver.target = target
driver.source = sources
driver.install_path = '${ADDON_DIR}/'
driver.use = ['serverlib']
if uselib:
driver.use += uselib
return driver
def build(bld):
if bld.env['BUILD_JACKD'] == True:
jackd = bld(features = ['cxx', 'cxxprogram'])
jackd.includes = ['..', '../windows', '../common/jack', '../common', '../dbus']
jackd.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
jackd.source = ['../common/Jackdmp.cpp']
jackd.install_path = '${BINDIR}'
jackd.use = ['serverlib']
jackd.target = 'jackd'
create_jack_driver_obj(bld, 'dummy', '../common/JackDummyDriver.cpp')
winmme_driver_src = [
'winmme/JackWinMMEDriver.cpp',
'winmme/JackWinMMEInputPort.cpp',
'winmme/JackWinMMEOutputPort.cpp',
'winmme/JackWinMMEPort.cpp',
]
if bld.env['BUILD_DRIVER_WINMME'] == True:
winmme_driver = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
winmme_driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
winmme_driver.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
winmme_driver.includes = ['.', '..' , '../windows', '../common', '../common/jack']
winmme_driver.target = 'winmme'
winmme_driver.source = winmme_driver_src
winmme_driver.install_path = '${ADDON_DIR}/'
winmme_driver.use = ['serverlib', 'WINMME']
portaudio_driver_src = [
'portaudio/JackPortAudioDevices.cpp',
'portaudio/JackPortAudioDriver.cpp',
]
if bld.env['BUILD_DRIVER_PORTAUDIO'] == True:
portaudio_driver = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
portaudio_driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
portaudio_driver.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
portaudio_driver.includes = ['.', '..' , '../windows', '../common', '../common/jack']
portaudio_driver.target = 'portaudio'
portaudio_driver.source = portaudio_driver_src
portaudio_driver.install_path = '${ADDON_DIR}/'
portaudio_driver.use = ['serverlib', 'PORTAUDIO' ]
create_jack_driver_obj(bld, 'net', '../common/JackNetDriver.cpp')
create_jack_driver_obj(bld, 'loopback', '../common/JackLoopbackDriver.cpp')
create_jack_driver_obj(bld, 'netone', [ '../common/JackNetOneDriver.cpp',
'../common/netjack.c',
'../common/netjack_packet.c' ], ["SAMPLERATE", "CELT"] )
create_jack_driver_obj(bld, 'proxy', '../common/JackProxyDriver.cpp')
......@@ -668,6 +668,271 @@ def init(ctx):
cmd = name + '_' + lib32
variant = lib32
def obj_add_includes(bld, obj):
if bld.env['BUILD_JACKDBUS']:
obj.includes += ['dbus']
if bld.env['IS_LINUX']:
obj.includes += ['linux', 'posix']
if bld.env['IS_MACOSX']:
obj.includes += ['macosx', 'posix']
if bld.env['IS_SUN']:
obj.includes += ['posix', 'solaris']
if bld.env['IS_WINDOWS']:
obj.includes += ['windows']
# FIXME: Is SERVER_SIDE needed?
def build_jackd(bld):
jackd = bld(
features = ['cxx', 'cxxprogram'],
defines = ['HAVE_CONFIG_H','SERVER_SIDE'],
includes = ['.', 'common', 'common/jack'],
target = 'jackd',
source = ['common/Jackdmp.cpp'],
use = ['serverlib'])
if bld.env['BUILD_JACKDBUS']:
jackd.source += ['dbus/audio_reserve.c', 'dbus/reserve.c']
jackd.use += ['DBUS-1']
if bld.env['IS_LINUX']:
jackd.use += ['DL', 'M', 'PTHREAD', 'RT', 'STDC++']
if bld.env['IS_MACOSX']:
bld.framework = ['CoreFoundation']
jackd.use += ['DL', 'PTHREAD']
if bld.env['IS_SUN']:
jackd.use += ['DL', 'PTHREAD']
obj_add_includes(bld, jackd)
return jackd
# FIXME: Is SERVER_SIDE needed?
def create_driver_obj(bld, **kw):
driver = bld(
features = ['c', 'cshlib', 'cxx', 'cxxshlib'],
defines = ['HAVE_CONFIG_H', 'SERVER_SIDE'],
includes = ['.', 'common', 'common/jack'],
install_path = '${ADDON_DIR}/',
**kw)
if bld.env['IS_WINDOWS']:
driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
else:
driver.env['cxxshlib_PATTERN'] = 'jack_%s.so'
obj_add_includes(bld, driver)
return driver
def build_drivers(bld):
# Non-hardware driver sources. Lexically sorted.
dummy_src = [
'common/JackDummyDriver.cpp'
]
loopback_src = [
'common/JackLoopbackDriver.cpp'
]
net_src = [
'common/JackNetDriver.cpp'
]
netone_src = [
'common/JackNetOneDriver.cpp',
'common/netjack.c',
'common/netjack_packet.c'
]
proxy_src = [
'common/JackProxyDriver.cpp'
]
# Hardware driver sources. Lexically sorted.
alsa_src = [
'common/memops.c',
'linux/alsa/JackAlsaDriver.cpp',
'linux/alsa/alsa_rawmidi.c',
'linux/alsa/alsa_seqmidi.c',
'linux/alsa/alsa_midi_jackmp.cpp',
'linux/alsa/generic_hw.c',
'linux/alsa/hdsp.c',
'linux/alsa/alsa_driver.c',
'linux/alsa/hammerfall.c',
'linux/alsa/ice1712.c'
]
alsarawmidi_src = [
'linux/alsarawmidi/JackALSARawMidiDriver.cpp',
'linux/alsarawmidi/JackALSARawMidiInputPort.cpp',
'linux/alsarawmidi/JackALSARawMidiOutputPort.cpp',
'linux/alsarawmidi/JackALSARawMidiPort.cpp',
'linux/alsarawmidi/JackALSARawMidiReceiveQueue.cpp',
'linux/alsarawmidi/JackALSARawMidiSendQueue.cpp',
'linux/alsarawmidi/JackALSARawMidiUtil.cpp'
]
boomer_src = [
'common/memops.c',
'solaris/oss/JackBoomerDriver.cpp'
]
coreaudio_src = [
'macosx/coreaudio/JackCoreAudioDriver.cpp'
]
coremidi_src = [
'macosx/coremidi/JackCoreMidiInputPort.cpp',
'macosx/coremidi/JackCoreMidiOutputPort.cpp',
'macosx/coremidi/JackCoreMidiPhysicalInputPort.cpp',
'macosx/coremidi/JackCoreMidiPhysicalOutputPort.cpp',
'macosx/coremidi/JackCoreMidiVirtualInputPort.cpp',
'macosx/coremidi/JackCoreMidiVirtualOutputPort.cpp',
'macosx/coremidi/JackCoreMidiPort.cpp',
'macosx/coremidi/JackCoreMidiUtil.cpp',
'macosx/coremidi/JackCoreMidiDriver.cpp'
]
ffado_src = [
'linux/firewire/JackFFADODriver.cpp',
'linux/firewire/JackFFADOMidiInputPort.cpp',
'linux/firewire/JackFFADOMidiOutputPort.cpp',
'linux/firewire/JackFFADOMidiReceiveQueue.cpp',
'linux/firewire/JackFFADOMidiSendQueue.cpp'
]
freebob_src = [
'linux/freebob/JackFreebobDriver.cpp'
]
iio_driver_src = [
'linux/iio/JackIIODriver.cpp'
]
oss_src = [
'common/memops.c',
'solaris/oss/JackOSSDriver.cpp'
]
portaudio_src = [
'windows/portaudio/JackPortAudioDevices.cpp',
'windows/portaudio/JackPortAudioDriver.cpp',
]
winmme_driver_src = [
'windows/winmme/JackWinMMEDriver.cpp',
'windows/winmme/JackWinMMEInputPort.cpp',
'windows/winmme/JackWinMMEOutputPort.cpp',
'windows/winmme/JackWinMMEPort.cpp',
]
# Create non-hardware driver objects. Lexically sorted.
create_driver_obj(
bld,
target = 'dummy',
source = dummy_src)
create_driver_obj(
bld,
target = 'loopback',
source = loopback_src)
create_driver_obj(
bld,
target = 'net',
source = net_src)
create_driver_obj(
bld,
target = 'netone',
source = netone_src,
use = ['SAMPLERATE', 'CELT'])
create_driver_obj(
bld,
target = 'proxy',
source = proxy_src)
# Create hardware driver objects. Lexically sorted after the conditional,
# e.g. BUILD_DRIVER_ALSA.
if bld.env['BUILD_DRIVER_ALSA']:
create_driver_obj(
bld,
target = 'alsa',
source = alsa_src,
use = ['ALSA'])
create_driver_obj(
bld,
target = 'alsarawmidi',
source = alsarawmidi_src,
use = ['ALSA'])
if bld.env['BUILD_DRIVER_FREEBOB']:
create_driver_obj(
bld,
target = 'freebob',
source = freebob_src,
use = ['LIBFREEBOB'])
if bld.env['BUILD_DRIVER_FFADO']:
create_driver_obj(
bld,
target = 'firewire',
source = ffado_src,
use = ['LIBFFADO'])
if bld.env['BUILD_DRIVER_IIO']:
create_driver_obj(
bld,
target = 'iio',
source = iio_src,
use = ['GTKIOSTREAM', 'EIGEN3'])
if bld.env['BUILD_DRIVER_PORTAUDIO']:
create_driver_obj(
bld,
target = 'portaudio',
source = portaudio_src,
use = ['serverlib', 'PORTAUDIO']) # FIXME: Is serverlib needed here?
if bld.env['BUILD_DRIVER_WINMME']:
create_driver_obj(
bld,
target = 'winmme',
source = winmme_src,
use = ['serverlib', 'WINMME']) # FIXME: Is serverlib needed here?
if bld.env['IS_MACOSX']:
create_driver_obj(
bld,
target = 'coreaudio',
source = coreaudio_src,
use = ['serverlib'], # FIXME: Is this needed?
framework = ['AudioUnit', 'CoreAudio', 'CoreServices'])
create_driver_obj(
bld,
target = 'coremidi',
source = coremidi_src,
use = ['serverlib'], # FIXME: Is this needed?
framework = ['AudioUnit', 'CoreMIDI', 'CoreServices'])
if bld.env['IS_SUN']:
create_driver_obj(
bld,
target = 'boomer',
source = boomer_src)
create_driver_obj(
bld,
target = 'oss',
source = oss_src)
def build(bld):
if not bld.variant:
out2 = out
......@@ -706,8 +971,12 @@ def build(bld):
target = [bld.path.find_or_declare('svnversion.h')]
)
if bld.env['BUILD_JACKD']:
build_jackd(bld)
build_drivers(bld)
if bld.env['IS_LINUX']:
bld.recurse('linux')
bld.recurse('example-clients')
bld.recurse('tests')
bld.recurse('man')
......@@ -715,21 +984,18 @@ def build(bld):
bld.recurse('dbus')
if bld.env['IS_MACOSX']:
bld.recurse('macosx')
bld.recurse('example-clients')
bld.recurse('tests')
if bld.env['BUILD_JACKDBUS'] == True:
bld.recurse('dbus')
if bld.env['IS_SUN']:
bld.recurse('solaris')