Commit 75dfaa65 authored by Karl Lindén's avatar Karl Lindén
Browse files

Merge pull request #179 from joshdekock/merger-branch

Fixed waf building on OSX.
parents af99165e 7cb81394
sudo: false
os:
- osx
- linux
language:
- cpp
- cpp
compiler:
- gcc
install:
- sudo apt-get install libsamplerate-dev libsndfile-dev libasound2-dev
- gcc
- clang
addons:
apt:
packages:
- libsamplerate-dev
- libsndfile-dev
- libasound2-dev
before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew outdated pkg-config || brew upgrade pkg-config; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install aften; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install libsamplerate; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install libsndfile; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install opus; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install readline; fi
script:
- ./waf configure --alsa
- ./waf build
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./waf configure --alsa; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./waf configure --opus=no --readline=no; fi
- ./waf build
matrix:
exclude:
- os: osx
compiler: gcc
......@@ -17,12 +17,14 @@ def configure(conf):
conf.check_cc(function_name='timeGetDevCaps', header_name=['windows.h', 'mmsystem.h'], lib='winmm', uselib_store="WINMM", define_name='HAVE_MMSYSTEM_H')
conf.check_cc(function_name='EnumProcesses', header_name=['windows.h', 'psapi.h'], lib='psapi', uselib_store="PSAPI", define_name='HAVE_PSAPI_H')
def create_jack_process_obj(bld, target, sources, uselib = None):
def create_jack_process_obj(bld, target, sources, uselib = None, framework = None):
process = bld(features = ['cxx', 'cxxshlib'])
if not bld.env['IS_WINDOWS']:
process.env['cxxshlib_PATTERN'] = '%s.so'
process.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
if bld.env['IS_MACOSX']:
if framework:
process.framework = framework
env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
if bld.env['IS_LINUX']:
env_includes = ['../linux', '../posix', '../linux/alsa']
......@@ -111,8 +113,10 @@ def build(bld):
'timestamps.c',
'../posix/JackPosixProcessSync.cpp',
'../posix/JackPosixThread.cpp',
'../macosx/JackMachThread.cpp',
'../macosx/JackMachSemaphore.cpp',
'../posix/JackPosixMutex.cpp',
'../macosx/JackMachThread.mm',
#'../macosx/JackMachSemaphore.mm',
'../posix/JackPosixSemaphore.cpp',
'../posix/JackSocket.cpp',
'../macosx/JackMachTime.c',
]
......@@ -133,6 +137,8 @@ def build(bld):
uselib.append('WINMM')
clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
if bld.env['IS_MACOSX']:
clientlib.framework = ['CoreAudio', 'Accelerate']
clientlib.defines = 'HAVE_CONFIG_H'
clientlib.use = uselib
if bld.env['IS_WINDOWS']:
......@@ -183,8 +189,7 @@ def build(bld):
if bld.env['IS_MACOSX']:
clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
clientlib.env.append_value("LINKFLAGS", "-single_module")
if bld.env['IS_SUN']:
clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
......@@ -195,6 +200,8 @@ def build(bld):
return
serverlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
if bld.env['IS_MACOSX']:
serverlib.framework = ['CoreAudio', 'CoreFoundation', 'Accelerate']
serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
serverlib.includes = includes
serverlib.name = 'serverlib'
......@@ -281,14 +288,15 @@ def build(bld):
if bld.env['IS_MACOSX']:
serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
serverlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
serverlib.env.append_value("LINKFLAGS", "-single_module")
if bld.env['IS_SUN']:
serverlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
if bld.env['BUILD_NETLIB'] == True:
netlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
if bld.env['IS_MACOSX']:
netlib.framework = ['CoreAudio']
netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
netlib.includes = includes
netlib.name = 'netlib'
......@@ -297,6 +305,8 @@ def build(bld):
if bld.env['IS_WINDOWS']:
netlib.install_path = '${BINDIR}'
netlib.use += ['WS2_32', 'WINMM']
elif bld.env['IS_MACOSX']:
netlib.install_path = '${LIBDIR}'
else:
netlib.use += ['RT']
netlib.install_path = '${LIBDIR}'
......@@ -321,8 +331,8 @@ def build(bld):
if bld.env['IS_MACOSX']:
netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../macosx/JackMachThread.cpp', '../macosx/JackMachTime.c']
netlib.env.append_value("LINKFLAGS", "-framework CoreAudio -single_module")
netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../macosx/JackMachThread.mm', '../macosx/JackMachTime.c']
netlib.env.append_value("LINKFLAGS", "-single_module")
if bld.env['IS_WINDOWS']:
netlib.source += ['../windows/JackNetWinSocket.cpp','../windows/JackWinThread.cpp', '../windows/JackMMCSS.cpp', '../windows/JackWinTime.c']
......@@ -354,10 +364,19 @@ def build(bld):
]
if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
process.use = 'SAMPLERATE'
audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.mm']
process = create_jack_process_obj(bld,
'audioadapter',
audio_adapter_sources,
serverlib,
framework = [
"CoreAudio",
"AudioUnit",
"AudioToolbox",
"CoreServices"
]
)
process.use += ['SAMPLERATE']
if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
......
......@@ -65,7 +65,10 @@ def build(bld):
else:
use = ['clientlib']
prog = bld(features='c cprogram')
if bld.env['IS_MACOSX']:
prog = bld(features='c cprogram', framework = ["Foundation"])
else:
prog = bld(features='c cprogram')
prog.includes = os_incdir + ['../common/jack', '../common']
prog.source = example_program_source
prog.use = use
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sstream>
#include <Foundation/Foundation.h>
#include "JackError.h"
#include "JackCoreMidiUtil.h"
......@@ -25,13 +26,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
std::string
Jack::GetMacOSErrorString(OSStatus status)
{
const char *message = GetMacOSStatusErrorString(status);
if (! message) {
std::stringstream stream;
stream << "error (code: '" << status << "')";
return stream.str();
NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
NSString *errorString = [error localizedDescription];
std::string returnString;
if (errorString){
returnString = std::string([errorString UTF8String]);
} else {
returnString = std::string("No error");
}
return std::string(message);
return returnString;
}
void
......
......@@ -455,6 +455,7 @@ def options(opt):
def configure(conf):
conf.load('compiler_cxx')
conf.load('compiler_c')
if Options.options.dist_target == 'auto':
platform = sys.platform
conf.env['IS_MACOSX'] = platform == 'darwin'
......@@ -471,6 +472,7 @@ def configure(conf):
if conf.env['IS_MACOSX']:
Logs.pprint('CYAN', "MacOS X detected")
conf.check(lib='aften', uselib='AFTEN', define_name='AFTEN')
if conf.env['IS_SUN']:
Logs.pprint('CYAN', "SunOS detected")
......@@ -700,7 +702,8 @@ def build_jackd(bld):
includes = ['.', 'common', 'common/jack'],
target = 'jackd',
source = ['common/Jackdmp.cpp'],
use = ['serverlib'])
use = ['serverlib']
)
if bld.env['BUILD_JACKDBUS']:
jackd.source += ['dbus/audio_reserve.c', 'dbus/reserve.c']
......@@ -710,8 +713,8 @@ def build_jackd(bld):
jackd.use += ['DL', 'M', 'PTHREAD', 'RT', 'STDC++']
if bld.env['IS_MACOSX']:
bld.framework = ['CoreFoundation']
jackd.use += ['DL', 'PTHREAD']
jackd.framework = ['CoreFoundation']
if bld.env['IS_SUN']:
jackd.use += ['DL', 'PTHREAD']
......@@ -801,19 +804,20 @@ def build_drivers(bld):
]
coreaudio_src = [
'macosx/coreaudio/JackCoreAudioDriver.cpp'
'macosx/coreaudio/JackCoreAudioDriver.mm',
'common/JackAC3Encoder.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'
'macosx/coremidi/JackCoreMidiInputPort.mm',
'macosx/coremidi/JackCoreMidiOutputPort.mm',
'macosx/coremidi/JackCoreMidiPhysicalInputPort.mm',
'macosx/coremidi/JackCoreMidiPhysicalOutputPort.mm',
'macosx/coremidi/JackCoreMidiVirtualInputPort.mm',
'macosx/coremidi/JackCoreMidiVirtualOutputPort.mm',
'macosx/coremidi/JackCoreMidiPort.mm',
'macosx/coremidi/JackCoreMidiUtil.mm',
'macosx/coremidi/JackCoreMidiDriver.mm'
]
ffado_src = [
......@@ -930,13 +934,15 @@ def build_drivers(bld):
bld,
target = 'coreaudio',
source = coreaudio_src,
use = ['AFTEN'],
framework = ['AudioUnit', 'CoreAudio', 'CoreServices'])
create_driver_obj(
bld,
target = 'coremidi',
source = coremidi_src,
framework = ['AudioUnit', 'CoreMIDI', 'CoreServices'])
use = ['serverlib'], # FIXME: Is this needed?
framework = ['AudioUnit', 'CoreMIDI', 'CoreServices', 'Foundation'])
if bld.env['IS_SUN']:
create_driver_obj(
......@@ -1078,3 +1084,9 @@ def dist(ctx):
# This code blindly assumes it is working in the toplevel source directory.
if not os.path.exists('svnversion.h'):
os.system('./svnversion_regenerate.sh svnversion.h')
from waflib import TaskGen
@TaskGen.extension('.mm')
def mm_hook(self, node):
"""Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
return self.create_compiled_task('cxx', node)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment