# -*- coding: utf-8 -*-
import os
import util
from mixxx import Dependence, Feature
import SCons.Script as SCons
class PortAudio(Dependence):
def configure(self, build, conf):
if not conf.CheckLib('portaudio'):
raise Exception(
'Did not find libportaudio.a, portaudio.lib, or the PortAudio-v19 development header files.')
# Turn on PortAudio support in Mixxx
build.env.Append(CPPDEFINES='__PORTAUDIO__')
if build.platform_is_windows and build.static_dependencies:
conf.CheckLib('advapi32')
def sources(self, build):
return ['soundio/sounddeviceportaudio.cpp']
class PortMIDI(Dependence):
def configure(self, build, conf):
# Check for PortTime
libs = ['porttime', 'libporttime']
headers = ['porttime.h']
# Depending on the library configuration PortTime might be statically
# linked with PortMidi. We treat either presence of the lib or the
# header as success.
if not conf.CheckLib(libs) and not conf.CheckHeader(headers):
raise Exception("Did not find PortTime or its development headers.")
# Check for PortMidi
libs = ['portmidi', 'libportmidi']
headers = ['portmidi.h']
if build.platform_is_windows and build.static_dependencies:
conf.CheckLib('advapi32')
if build.platform_is_windows:
# We have this special branch here because on Windows we might want
# to link PortMidi statically which we don't want to do on other
# platforms.
# TODO(rryan): Remove this? Don't want to break anyone but the
# static/dynamic choice should be made by the whether the .a is an
# import library for a shared library or a static library.
libs.append('portmidi_s')
if not conf.CheckLib(libs) or not conf.CheckHeader(headers):
raise Exception("Did not find PortMidi or its development headers.")