Commit e0281d82 authored by Adrian Knoth's avatar Adrian Knoth Committed by GitHub
Browse files

Merge pull request #190 from jackaudio/waf-macosx-fixes

Waf macosx fixes
parents 4cf826c8 cf48eedf
sudo: false
os:
- osx
- linux
language: language:
- cpp - cpp
compiler: compiler:
- gcc - gcc
install: - clang
- sudo apt-get install libsamplerate-dev libsndfile-dev libasound2-dev 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: script:
- ./waf configure --alsa - if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./waf configure --alsa; fi
- ./waf build - if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./waf configure --opus=no --readline=no; fi
- ./waf build
matrix:
exclude:
- os: osx
compiler: gcc
...@@ -133,6 +133,4 @@ WAFLIB_STRIP_EXTRAS=" ...@@ -133,6 +133,4 @@ WAFLIB_STRIP_EXTRAS="
valadoc valadoc
why why
win32_opts win32_opts
xcode
xcode6
" "
...@@ -17,12 +17,14 @@ def configure(conf): ...@@ -17,12 +17,14 @@ def configure(conf):
conf.check(function_name='timeGetDevCaps', header_name=['windows.h', 'mmsystem.h'], lib='winmm', uselib_store="WINMM", define_name='HAVE_MMSYSTEM_H') conf.check(function_name='timeGetDevCaps', header_name=['windows.h', 'mmsystem.h'], lib='winmm', uselib_store="WINMM", define_name='HAVE_MMSYSTEM_H')
conf.check(function_name='EnumProcesses', header_name=['windows.h', 'psapi.h'], lib='psapi', uselib_store="PSAPI", define_name='HAVE_PSAPI_H') conf.check(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']) process = bld(features = ['cxx', 'cxxshlib'])
if not bld.env['IS_WINDOWS']: if not bld.env['IS_WINDOWS']:
process.env['cxxshlib_PATTERN'] = '%s.so' process.env['cxxshlib_PATTERN'] = '%s.so'
process.defines = ['HAVE_CONFIG_H','SERVER_SIDE'] process.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
if bld.env['IS_MACOSX']: if bld.env['IS_MACOSX']:
if framework:
process.framework = framework
env_includes = ['../macosx', '../posix', '../macosx/coreaudio'] env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
if bld.env['IS_LINUX']: if bld.env['IS_LINUX']:
env_includes = ['../linux', '../posix', '../linux/alsa'] env_includes = ['../linux', '../posix', '../linux/alsa']
...@@ -37,8 +39,6 @@ def create_jack_process_obj(bld, target, sources, uselib = None): ...@@ -37,8 +39,6 @@ def create_jack_process_obj(bld, target, sources, uselib = None):
if bld.env['IS_LINUX']: if bld.env['IS_LINUX']:
process.env.append_value("CPPFLAGS", "-fvisibility=hidden") process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
if bld.env['IS_MACOSX']: if bld.env['IS_MACOSX']:
process.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
#process.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
process.env.append_value("CPPFLAGS", "-fvisibility=hidden") process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
process.install_path = '${ADDON_DIR}/' process.install_path = '${ADDON_DIR}/'
process.use = [uselib.name] process.use = [uselib.name]
...@@ -113,8 +113,10 @@ def build(bld): ...@@ -113,8 +113,10 @@ def build(bld):
'timestamps.c', 'timestamps.c',
'../posix/JackPosixProcessSync.cpp', '../posix/JackPosixProcessSync.cpp',
'../posix/JackPosixThread.cpp', '../posix/JackPosixThread.cpp',
'../macosx/JackMachThread.cpp', '../posix/JackPosixMutex.cpp',
'../macosx/JackMachSemaphore.cpp', '../macosx/JackMachThread.mm',
#'../macosx/JackMachSemaphore.mm',
'../posix/JackPosixSemaphore.cpp',
'../posix/JackSocket.cpp', '../posix/JackSocket.cpp',
'../macosx/JackMachTime.c', '../macosx/JackMachTime.c',
] ]
...@@ -135,6 +137,8 @@ def build(bld): ...@@ -135,6 +137,8 @@ def build(bld):
uselib.append('WINMM') uselib.append('WINMM')
clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib']) clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
if bld.env['IS_MACOSX']:
clientlib.framework = ['CoreAudio', 'Accelerate']
clientlib.defines = 'HAVE_CONFIG_H' clientlib.defines = 'HAVE_CONFIG_H'
clientlib.use = uselib clientlib.use = uselib
if bld.env['IS_WINDOWS']: if bld.env['IS_WINDOWS']:
...@@ -185,10 +189,7 @@ def build(bld): ...@@ -185,10 +189,7 @@ def build(bld):
if bld.env['IS_MACOSX']: if bld.env['IS_MACOSX']:
clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden") clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64") clientlib.env.append_value("LINKFLAGS", "-single_module")
#clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64"
clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
if bld.env['IS_SUN']: if bld.env['IS_SUN']:
clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket") clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
...@@ -199,6 +200,8 @@ def build(bld): ...@@ -199,6 +200,8 @@ def build(bld):
return return
serverlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib']) 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.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
serverlib.includes = includes serverlib.includes = includes
serverlib.name = 'serverlib' serverlib.name = 'serverlib'
...@@ -285,16 +288,15 @@ def build(bld): ...@@ -285,16 +288,15 @@ def build(bld):
if bld.env['IS_MACOSX']: if bld.env['IS_MACOSX']:
serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden") serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
serverlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64") serverlib.env.append_value("LINKFLAGS", "-single_module")
#serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64")
serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
serverlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
if bld.env['IS_SUN']: if bld.env['IS_SUN']:
serverlib.env.append_value("LINKFLAGS", "-lnsl -lsocket") serverlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
if bld.env['BUILD_NETLIB']: if bld.env['BUILD_NETLIB']:
netlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib']) netlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
if bld.env['IS_MACOSX']:
netlib.framework = ['CoreAudio']
netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE'] netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
netlib.includes = includes netlib.includes = includes
netlib.name = 'netlib' netlib.name = 'netlib'
...@@ -303,6 +305,8 @@ def build(bld): ...@@ -303,6 +305,8 @@ def build(bld):
if bld.env['IS_WINDOWS']: if bld.env['IS_WINDOWS']:
netlib.install_path = '${BINDIR}' netlib.install_path = '${BINDIR}'
netlib.use += ['WS2_32', 'WINMM'] netlib.use += ['WS2_32', 'WINMM']
elif bld.env['IS_MACOSX']:
netlib.install_path = '${LIBDIR}'
else: else:
netlib.use += ['RT'] netlib.use += ['RT']
netlib.install_path = '${LIBDIR}' netlib.install_path = '${LIBDIR}'
...@@ -327,8 +331,8 @@ def build(bld): ...@@ -327,8 +331,8 @@ def build(bld):
if bld.env['IS_MACOSX']: if bld.env['IS_MACOSX']:
netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../macosx/JackMachThread.cpp', '../macosx/JackMachTime.c'] netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../macosx/JackMachThread.mm', '../macosx/JackMachTime.c']
netlib.env.append_value("LINKFLAGS", "-framework CoreAudio -single_module") netlib.env.append_value("LINKFLAGS", "-single_module")
if bld.env['IS_WINDOWS']: if bld.env['IS_WINDOWS']:
netlib.source += ['../windows/JackNetWinSocket.cpp','../windows/JackWinThread.cpp', '../windows/JackMMCSS.cpp', '../windows/JackWinTime.c'] netlib.source += ['../windows/JackNetWinSocket.cpp','../windows/JackWinThread.cpp', '../windows/JackMMCSS.cpp', '../windows/JackWinTime.c']
...@@ -360,10 +364,19 @@ def build(bld): ...@@ -360,10 +364,19 @@ def build(bld):
] ]
if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']: if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp'] audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.mm']
process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib) process = create_jack_process_obj(bld,
process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices") 'audioadapter',
process.use = 'SAMPLERATE' 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']: if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp'] audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
......
...@@ -66,14 +66,13 @@ def build(bld): ...@@ -66,14 +66,13 @@ def build(bld):
else: else:
use = ['clientlib'] 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.includes = os_incdir + ['../common/jack', '../common']
prog.source = example_program_source prog.source = example_program_source
prog.use = use prog.use = use
if bld.env['IS_MACOSX']:
prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
#prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
prog.env.append_value("LINKFLAGS", "")
if bld.env['IS_LINUX']: if bld.env['IS_LINUX']:
prog.use += ['RT', 'M'] prog.use += ['RT', 'M']
if bld.env['IS_SUN']: if bld.env['IS_SUN']:
...@@ -86,10 +85,6 @@ def build(bld): ...@@ -86,10 +85,6 @@ def build(bld):
prog.includes = os_incdir + ['../common/jack', '../common'] prog.includes = os_incdir + ['../common/jack', '../common']
prog.source = 'transport.c' prog.source = 'transport.c'
prog.use = ['clientlib'] prog.use = ['clientlib']
if bld.env['IS_MACOSX']:
prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
#prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
prog.env.append_value("LINKFLAGS", "")
if bld.env['IS_LINUX']: if bld.env['IS_LINUX']:
prog.use += ['RT', 'READLINE'] prog.use += ['RT', 'READLINE']
if bld.env['IS_MACOSX']: if bld.env['IS_MACOSX']:
...@@ -104,9 +99,6 @@ def build(bld): ...@@ -104,9 +99,6 @@ def build(bld):
prog.source = 'capture_client.c' prog.source = 'capture_client.c'
prog.use = ['clientlib'] prog.use = ['clientlib']
if bld.env['IS_MACOSX']: if bld.env['IS_MACOSX']:
prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
#prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
prog.env.append_value("LINKFLAGS", "")
prog.use += ['SNDFILE'] prog.use += ['SNDFILE']
if bld.env['IS_LINUX']: if bld.env['IS_LINUX']:
prog.use += ['RT', 'SNDFILE'] prog.use += ['RT', 'SNDFILE']
...@@ -147,10 +139,6 @@ def build(bld): ...@@ -147,10 +139,6 @@ def build(bld):
lib.includes = os_incdir + ['../common/jack', '../common'] lib.includes = os_incdir + ['../common/jack', '../common']
lib.target = example_lib lib.target = example_lib
lib.source = example_lib_source lib.source = example_lib_source
if bld.env['IS_MACOSX']:
lib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
#lib.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
lib.env.append_value("LINKFLAGS", "")
if bld.env['IS_SUN']: if bld.env['IS_SUN']:
lib.env.append_value("LINKFLAGS", "-lm") lib.env.append_value("LINKFLAGS", "-lm")
lib.use = 'serverlib' lib.use = 'serverlib'
......
...@@ -70,7 +70,7 @@ typedef unsigned char Boolean; ...@@ -70,7 +70,7 @@ typedef unsigned char Boolean;
#include "JackPosixThread.h" #include "JackPosixThread.h"
#ifndef MY_TARGET_OS_IPHONE #ifndef MY_TARGET_OS_IPHONE
#include <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h> #include <MacTypes.h>
#endif #endif
#include <mach/thread_policy.h> #include <mach/thread_policy.h>
......
...@@ -22,8 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ...@@ -22,8 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <string> #include <string>
#include <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h> #include <MacTypes.h>
#include <CoreServices/../Frameworks/CarbonCore.framework/Headers/Debugging.h>
namespace Jack { namespace Jack {
......
...@@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ...@@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <sstream> #include <sstream>
#include <Foundation/Foundation.h>
#include "JackError.h" #include "JackError.h"
#include "JackCoreMidiUtil.h" #include "JackCoreMidiUtil.h"
...@@ -25,13 +26,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ...@@ -25,13 +26,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
std::string std::string
Jack::GetMacOSErrorString(OSStatus status) Jack::GetMacOSErrorString(OSStatus status)
{ {
const char *message = GetMacOSStatusErrorString(status); NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
if (! message) { NSString *errorString = [error localizedDescription];
std::stringstream stream; std::string returnString;
stream << "error (code: '" << status << "')"; if (errorString){
return stream.str(); returnString = std::string([errorString UTF8String]);
} else {
returnString = std::string("No error");
} }
return std::string(message); return returnString;
} }
void void
......
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