forked from vancegroup/Audiere
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SConstruct
209 lines (173 loc) · 5.5 KB
/
SConstruct
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import os, sys
env = Environment(ENV=os.environ)
def addLib(lib):
global env
env.Append(LIBS="lib")
def addLibs(libs):
for lib in libs:
addLib(lib)
DEFINITIONS = {}
def define(name,what=True):
global DEFINITIONS
DEFINITIONS[name] = what
env.Append(CFLAGS="-D" + name, CXXFLAGS="-D"+name)
def isdef(name):
global DEFINITIONS
return DEFINITIONS.has_key(name)
env.Append(CPPPATH=["#/src"])
if env['CC'] == 'cl':
env.Append(CCFLAGS=['/EHsc', '/Z7', '/O2', '/W3'],
LINKFLAGS=['/DEBUG'],
CPPDEFINES=['AUDIERE_EXPORTS', 'NOMINMAX', 'FLAC__NO_DLL', '_CRT_SECURE_NO_WARNINGS', 'WIN32'],
CPPPATH=['#/third-party/vc6/include'],
LIBPATH=['#/third-party/vc6/lib'],
LIBS=['user32', 'ole32', 'rpcrt4', 'winmm'])
elif env['CC'] == 'gcc':
env.Append(CCFLAGS=['-Wall', '-Wno-non-virtual-dtor'])
# Sanity is good
if sys.platform == 'win32':
if ARGUMENTS.has_key('use_oss') and ARGUMENTS['use_oss'] == True:
print "Detected Win32. Disabling OSS."
ARGUMENTS['use_oss'] = False
if sys.platform != 'win32':
if ARGUMENTS.has_key('use_dsound') and ARGUMENTS['use_dsound'] == True:
print "Detected POSIX system. Disabling DirectSound."
ARGUMENTS['use_dsound'] = False
if sys.platform not in ['win32', 'cygwin']:
if ARGUMENTS.has_key('use_winmm') and ARGUMENTS['use_winmm'] == True:
print "Detected POSIX system. Disabling WinMM."
ARGUMENTS['use_winmm'] = False
conf = Configure(env)
# Parse command-line options.
if ARGUMENTS.get('use_oggvorbis', 'yes') == 'yes':
if sys.platform == 'win32':
conf.env.Append(LIBS=['vorbisfile_static', 'vorbis_static', 'ogg_static'])
else:
if not conf.CheckHeader("vorbis/vorbisfile.h"):
print "Error: Ogg Vorbis support was not found. Either install libvorbis, or rebuild with use_oggvorbis=no."
sys.exit(1)
conf.env.Append(LIBS=['vorbis', 'ogg', 'vorbisfile'])
define("HAVE_OGG")
else:
define("NO_OGG")
if ARGUMENTS.get('use_flac', 'yes') == 'yes':
if sys.platform == 'win32':
conf.env.Append(LIBS=['libFLAC++_static', 'libFLAC_static'])
else:
if not conf.CheckHeader('FLAC/all.h'):
print "Error: FLAC support was not found. Either install libFLAC, or rebuild with use_flac=no."
sys.exit(1)
conf.env.Append(LIBS=['m'])
define("HAVE_FLAC")
else:
define("NO_FLAC")
if ARGUMENTS.get('use_dumb', 'yes') == 'yes':
if sys.platform == 'win32':
pass
else:
if not conf.CheckHeader('dumb.h'):
print "Error: libdumb was not found. Either install it, or rebuild with use_dumb=no."
sys.exit(1)
conf.env.Append(LIBS=['dumb_static'])
define("HAVE_DUMB")
else:
define("NO_DUMB")
if ARGUMENTS.has_key('use_winmm') and ARGUMENTS['use_winmm'] == True:
if sys.platform == 'win32':
define("HAVE_WINMM")
else:
ARGUMENTS['use_winmm'] = False
else:
define("NO_WINMM")
if conf.CheckHeader('speex.h'):
conf.env.Append(LIBS=['libspeex'])
define("HAVE_SPEEX")
else:
define("NO_SPEEX")
if ARGUMENTS.get('use_oss', 'yes') == 'yes':
if not (conf.CheckHeader("unistd.h") and conf.CheckHeader("sys/soundcard.h")):
print "Error: OSS support was not found. Either enable it, or rebuild with use_oss=no."
sys.exit(1)
define("HAVE_OSS")
else:
define("NO_OSS")
if ARGUMENTS.get('use_dsound', 'yes') == 'yes':
#conf.env.Append(LIBS=['dsound', 'ole32', 'rpcrt4'])
if sys.platform == 'win32':
pass
else:
if not conf.CheckHeader("dsound.h"):
print "Error: DirectSound support was not found. Install DirectX or rebuild with use_dsound=no."
sys.exit(1)
define("HAVE_DSOUND")
else:
define("NO_DSOUND")
PREFIX = ARGUMENTS.get('prefix','/usr/local')
# Handle source
source = """
src/basic_source.cpp
src/debug.cpp
src/device.cpp
src/device_mixer.cpp
src/device_null.cpp
src/dumb_resample.cpp
src/file_ansi.cpp
src/input.cpp
src/input_aiff.cpp
src/input_mp3.cpp
src/input_wav.cpp
src/loop_point_source.cpp
src/memory_file.cpp
src/mpaudec/bits.c
src/mpaudec/mpaudec.c
src/noise.cpp
src/resampler.cpp
src/sample_buffer.cpp
src/sound.cpp
src/sound_effect.cpp
src/square_wave.cpp
src/tone.cpp
src/utility.cpp
src/version.cpp
"""
if sys.platform == 'win32':
source += '''
src/timer_win32.cpp
src/threads_win32.cpp
'''
else:
source += '''
src/timer_posix.cpp
src/threads_posix.cpp
'''
if isdef("HAVE_SPEEX"):
source += '''
src/input_speex.cpp
src/speexfile/speexfile.cpp
'''
if isdef("HAVE_FLAC"):
source += " src/input_flac.cpp"
if isdef("HAVE_DUMB"):
source += " src/input_mod.cpp"
if isdef("HAVE_OGG"):
source += " src/input_ogg.cpp"
if isdef("HAVE_AL"): # NOTHING CHECKS FOR THIS YET
source += " src/device_al.cpp"
if isdef("HAVE_OSS"):
source += " src/device_oss.cpp"
if isdef("HAVE_DSOUND"):
source += """
src/device_ds.cpp
src/device_ds_buffer.cpp
src/device_ds_stream.cpp
src/dxguid.cpp
"""
if isdef("HAVE_WINMM"):
source += " src/device_mm.cpp"
env = conf.Finish()
env.SharedLibrary(target='audiere', source=Split(source))
env.Program('race', 'test/race/race.cpp', LIBS=['audiere'])
#env.Install(dir = PREFIX + "/lib", source = ['libaudiere.so'])
#env.Alias('install', [PREFIX + "/lib"])
#env.Install(dir = PREFIX + "/include", source = ['src/audiere.h'])
#env.Alias('install', [PREFIX + "/include"])