-
Notifications
You must be signed in to change notification settings - Fork 1
/
nsound_config_mac.py
72 lines (53 loc) · 2.02 KB
/
nsound_config_mac.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
##############################################################################
#
# $Id: nsound_config_mac.py 854 2014-06-30 00:29:02Z weegreenblobbie $
#
# NsoundConfig_Mac.py
#
# A baseclass for configuring Nsound for different computing platforms.
#
##############################################################################
# Python imports
import os
import sys
# Nsound imports
from nsound_config import NsoundConfig
class NsoundConfigMac(NsoundConfig):
def _customize_environment(self):
self.env['NS_ON_MAC'] = True
self.env['NSUOND_PLATFORM_OS'] = "NSOUND_PLATFORM_OS_MAC"
if self.env['NS_DEBUG_BUILD']:
self.env.AppenduUnique(CXXFLAGS = ["-g"])
else:
self.env.AppendUnique(CXXFLAGS = ["-O2"])
# Enbale c++11.
self.env.AppendUnique(CXXFLAGS = ['-std=c++11'])
#---------------------------------------------------------
# rpath Hack, g++ on OSX doesn't use -Wl,-rpath=somepath
#
# The trick here is to specify an abspath when linking libNsound.dylib
self.env.AppendUnique(
SHLINKFLAGS =
[
'-install_name',
'%s/${TARGET.filebase}${TARGET.suffix}' % self.env['NS_LIBDIR']
])
#----------------------------------------------------------
# look for portaudio.h
PATH_LIST = ["/usr", "/usr/local", "/opt", "/opt/local"]
for path in PATH_LIST:
portaudio_h = os.path.join(path, "include", "portaudio.h")
if os.path.isfile(portaudio_h):
cpppath = os.path.join(path, "include")
libpath = os.path.join(path, "lib")
self.env.AppendUnique(
CPPPATH = [cpppath],
LIBPATH = [libpath])
def add_to_rpath(self, path):
"""
-Wl,-rpath not available on Mac.
"""
#self.env.Append(
# LINKFLAGS = ['-Xlinker', '-rpath', '-Xlinker', path])
def on_mac(self):
return True