# -*- 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 ['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:
# 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.")
def sources(self, build):
return ['controllers/midi/portmidienumerator.cpp', 'controllers/midi/portmidicontroller.cpp']
class OpenGL(Dependence):
def configure(self, build, conf):
if build.platform_is_osx:
build.env.AppendUnique(FRAMEWORKS='OpenGL')
# Check for OpenGL (it's messy to do it for all three platforms).
if (not conf.CheckLib('GL') and
not conf.CheckLib('opengl32') and
not conf.CheckCHeader('OpenGL/gl.h') and
not conf.CheckCHeader('GL/gl.h')):
raise Exception('Did not find OpenGL development files')
if (not conf.CheckLib('GLU') and
not conf.CheckLib('glu32') and
not conf.CheckCHeader('OpenGL/glu.h')):
raise Exception('Did not find GLU development files')
class SecurityFramework(Dependence):
"""The iOS/OS X security framework is used to implement sandboxing."""
def configure(self, build, conf):
if not build.platform_is_osx:
return
build.env.Append(CPPPATH='/System/Library/Frameworks/Security.framework/Headers/')
build.env.Append(LINKFLAGS='-framework Security')
class CoreServices(Dependence):
def configure(self, build, conf):
if not build.platform_is_osx:
return
build.env.Append(CPPPATH='/System/Library/Frameworks/CoreServices.framework/Headers/')
build.env.Append(LINKFLAGS='-framework CoreServices')
class OggVorbis(Dependence):
def configure(self, build, conf):
# if build.platform_is_windows and build.machine_is_64bit:
# For some reason this has to be checked this way on win64,
# otherwise it looks for the dll lib which will cause a conflict
# later
# if not conf.CheckLib('vorbisfile_static'):
# raise Exception('Did not find vorbisfile_static.lib or the libvorbisfile development headers.')
# else:
libs = ['libvorbisfile', 'vorbisfile']
if not conf.CheckLib(libs):
Exception('Did not find libvorbisfile.a, li