Mercurial > audio-send
comparison CMakeLists-works.txt @ 0:f9476ff7637e
initial forking of open-al to create multiple listeners
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 13:02:31 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f9476ff7637e |
---|---|
1 # CMake build file list for OpenAL | |
2 | |
3 CMAKE_MINIMUM_REQUIRED(VERSION 2.4) | |
4 | |
5 IF(COMMAND CMAKE_POLICY) | |
6 CMAKE_POLICY(SET CMP0003 NEW) | |
7 ENDIF(COMMAND CMAKE_POLICY) | |
8 | |
9 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") | |
10 | |
11 INCLUDE(CheckFunctionExists) | |
12 INCLUDE(CheckLibraryExists) | |
13 INCLUDE(CheckSharedFunctionExists) | |
14 INCLUDE(CheckIncludeFile) | |
15 INCLUDE(CheckIncludeFiles) | |
16 INCLUDE(CheckSymbolExists) | |
17 INCLUDE(CheckCCompilerFlag) | |
18 INCLUDE(CheckCSourceCompiles) | |
19 INCLUDE(CheckTypeSize) | |
20 | |
21 | |
22 PROJECT(OpenAL C) | |
23 | |
24 | |
25 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) | |
26 | |
27 | |
28 OPTION(ALSA "Check for ALSA backend" ON) | |
29 OPTION(OSS "Check for OSS backend" ON) | |
30 OPTION(SOLARIS "Check for Solaris backend" ON) | |
31 OPTION(SNDIO "Check for SndIO backend" ON) | |
32 OPTION(MMDEVAPI "Check for MMDevApi" ON) | |
33 OPTION(DSOUND "Check for DirectSound backend" ON) | |
34 OPTION(WINMM "Check for Windows Multimedia backend" ON) | |
35 OPTION(PORTAUDIO "Check for PortAudio backend" ON) | |
36 OPTION(PULSEAUDIO "Check for PulseAudio backend" ON) | |
37 OPTION(COREAUDIO "Check for CoreAudio backend" ON) | |
38 OPTION(OPENSL "Check for OpenSL backend" ON) | |
39 OPTION(WAVE "Enable Wave Writer backend" ON) | |
40 OPTION(RECORD "Enable Recorder Backend" ON) | |
41 | |
42 OPTION(REQUIRE_ALSA "Require ALSA backend" OFF) | |
43 OPTION(REQUIRE_OSS "Require OSS backend" OFF) | |
44 OPTION(REQUIRE_SOLARIS "Require Solaris backend" OFF) | |
45 OPTION(REQUIRE_SNDIO "Require SndIO backend" OFF) | |
46 OPTION(REQUIRE_MMDEVAPI "Require MMDevApi" OFF) | |
47 OPTION(REQUIRE_DSOUND "Require DirectSound backend" OFF) | |
48 OPTION(REQUIRE_WINMM "Require Windows Multimedia backend" OFF) | |
49 OPTION(REQUIRE_PORTAUDIO "Require PortAudio backend" OFF) | |
50 OPTION(REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF) | |
51 OPTION(REQUIRE_COREAUDIO "Require CoreAudio backend" OFF) | |
52 OPTION(REQUIRE_OPENSL "Require OpenSL backend" OFF) | |
53 | |
54 OPTION(DLOPEN "Check for the dlopen API for loading optional libs" ON) | |
55 | |
56 OPTION(WERROR "Treat compile warnings as errors" OFF) | |
57 | |
58 OPTION(UTILS "Build and install utility programs" ON) | |
59 | |
60 OPTION(ALSOFT_CONFIG "Install alsoft.conf configuration file" OFF) | |
61 | |
62 | |
63 SET(LIBNAME openal) | |
64 | |
65 SET(LIBTYPE SHARED) | |
66 | |
67 SET(LIB_MAJOR_VERSION "1") | |
68 SET(LIB_MINOR_VERSION "13") | |
69 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}") | |
70 | |
71 SET(EXPORT_DECL "") | |
72 | |
73 | |
74 # Add definitions, compiler switches, etc. | |
75 INCLUDE_DIRECTORIES(OpenAL32/Include include "${OpenAL_BINARY_DIR}") | |
76 | |
77 ADD_DEFINITIONS(-Winline -Wall) | |
78 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA) | |
79 IF(HAVE_W_EXTRA) | |
80 ADD_DEFINITIONS(-Wextra) | |
81 ENDIF() | |
82 | |
83 IF(WERROR) | |
84 ADD_DEFINITIONS(-Werror) | |
85 ENDIF() | |
86 | |
87 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -D_DEBUG" CACHE STRING | |
88 "Flags used by the compiler during Release with Debug Info builds." | |
89 FORCE) | |
90 SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING | |
91 "Flags used by the compiler during release minsize builds." | |
92 FORCE) | |
93 SET(CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -DNDEBUG" CACHE STRING | |
94 "Flags used by the compiler during release builds" | |
95 FORCE) | |
96 SET(CMAKE_C_FLAGS_DEBUG "-g3 -D_DEBUG" CACHE STRING | |
97 "Flags used by the compiler during debug builds." | |
98 FORCE) | |
99 | |
100 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H) | |
101 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H) | |
102 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H) | |
103 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H) | |
104 IF(NOT HAVE_GUIDDEF_H) | |
105 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H) | |
106 ENDIF() | |
107 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H) | |
108 | |
109 CHECK_LIBRARY_EXISTS(m powf "" HAVE_POWF) | |
110 CHECK_LIBRARY_EXISTS(m sqrtf "" HAVE_SQRTF) | |
111 CHECK_LIBRARY_EXISTS(m acosf "" HAVE_ACOSF) | |
112 CHECK_LIBRARY_EXISTS(m atanf "" HAVE_ATANF) | |
113 CHECK_LIBRARY_EXISTS(m fabsf "" HAVE_FABSF) | |
114 IF(HAVE_FENV_H) | |
115 CHECK_LIBRARY_EXISTS(m fesetround "" HAVE_FESETROUND) | |
116 ENDIF() | |
117 IF(HAVE_SQRTF OR HAVE_ACOSF OR HAVE_ATANF OR HAVE_FABSF OR HAVE_FESETROUND) | |
118 SET(EXTRA_LIBS m ${EXTRA_LIBS}) | |
119 ENDIF() | |
120 CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF) | |
121 CHECK_FUNCTION_EXISTS(_controlfp HAVE__CONTROLFP) | |
122 | |
123 CHECK_FUNCTION_EXISTS(stat HAVE_STAT) | |
124 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP) | |
125 IF(NOT HAVE_STRCASECMP) | |
126 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP) | |
127 IF(NOT HAVE__STRICMP) | |
128 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!") | |
129 ENDIF() | |
130 | |
131 ADD_DEFINITIONS(-Dstrcasecmp=_stricmp) | |
132 ENDIF() | |
133 | |
134 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP) | |
135 IF(NOT HAVE_STRNCASECMP) | |
136 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP) | |
137 IF(NOT HAVE__STRNICMP) | |
138 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!") | |
139 ENDIF() | |
140 | |
141 ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp) | |
142 ENDIF() | |
143 | |
144 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF) | |
145 IF(NOT HAVE_SNPRINTF) | |
146 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF) | |
147 IF(NOT HAVE__SNPRINTF) | |
148 MESSAGE(FATAL_ERROR "No snprintf function found, please report!") | |
149 ENDIF() | |
150 | |
151 ADD_DEFINITIONS(-Dsnprintf=_snprintf) | |
152 ENDIF() | |
153 | |
154 CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF) | |
155 IF(NOT HAVE_VSNPRINTF) | |
156 CHECK_FUNCTION_EXISTS(_vsnprintf HAVE__VSNPRINTF) | |
157 IF(NOT HAVE__VSNPRINTF) | |
158 MESSAGE(FATAL_ERROR "No vsnprintf function found, please report!") | |
159 ENDIF() | |
160 | |
161 ADD_DEFINITIONS(-Dvsnprintf=_vsnprintf) | |
162 ENDIF() | |
163 | |
164 CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE) | |
165 IF(NOT HAVE_ISFINITE) | |
166 CHECK_FUNCTION_EXISTS(finite HAVE_FINITE) | |
167 IF(NOT HAVE_FINITE) | |
168 CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE) | |
169 IF(NOT HAVE__FINITE) | |
170 MESSAGE(FATAL_ERROR "No isfinite function found, please report!") | |
171 ENDIF() | |
172 ADD_DEFINITIONS(-Disfinite=_finite) | |
173 ELSE() | |
174 ADD_DEFINITIONS(-Disfinite=finite) | |
175 ENDIF() | |
176 ENDIF() | |
177 | |
178 CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN) | |
179 IF(NOT HAVE_ISNAN) | |
180 CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN) | |
181 IF(NOT HAVE__ISNAN) | |
182 MESSAGE(FATAL_ERROR "No isnan function found, please report!") | |
183 ENDIF() | |
184 | |
185 ADD_DEFINITIONS(-Disnan=_isnan) | |
186 ENDIF() | |
187 | |
188 | |
189 # Check for the dlopen API (for dynamicly loading backend libs) | |
190 IF(DLOPEN) | |
191 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H) | |
192 IF(HAVE_DLFCN_H) | |
193 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL) | |
194 IF(HAVE_LIBDL) | |
195 SET(EXTRA_LIBS dl ${EXTRA_LIBS}) | |
196 ENDIF() | |
197 ENDIF() | |
198 ENDIF() | |
199 | |
200 # Check if we have Windows headers | |
201 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0500) | |
202 IF(NOT HAVE_WINDOWS_H) | |
203 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) | |
204 IF(NOT HAVE_GETTIMEOFDAY) | |
205 MESSAGE(FATAL_ERROR "No timing function found!") | |
206 ENDIF() | |
207 | |
208 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP) | |
209 IF(NOT HAVE_NANOSLEEP) | |
210 MESSAGE(FATAL_ERROR "No sleep function found!") | |
211 ENDIF() | |
212 | |
213 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD) | |
214 IF(HAVE_PTHREAD) | |
215 ADD_DEFINITIONS(-pthread) | |
216 SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread) | |
217 ENDIF() | |
218 | |
219 # We need pthreads outside of Windows | |
220 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H) | |
221 IF(NOT HAVE_PTHREAD_H) | |
222 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!") | |
223 ENDIF() | |
224 # Some systems need pthread_np.h to get recursive mutexes | |
225 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H) | |
226 | |
227 # _GNU_SOURCE is needed on some systems for extra attributes, and | |
228 # _REENTRANT is needed for libc thread-safety | |
229 ADD_DEFINITIONS(-D_GNU_SOURCE=1) | |
230 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD) | |
231 IF(HAVE_LIBPTHREAD) | |
232 SET(EXTRA_LIBS pthread ${EXTRA_LIBS}) | |
233 ENDIF() | |
234 | |
235 CHECK_LIBRARY_EXISTS(pthread pthread_setschedparam "" HAVE_PTHREAD_SETSCHEDPARAM) | |
236 | |
237 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT) | |
238 IF(HAVE_LIBRT) | |
239 SET(EXTRA_LIBS rt ${EXTRA_LIBS}) | |
240 ENDIF() | |
241 ENDIF() | |
242 | |
243 # Check for a 64-bit type | |
244 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) | |
245 IF(NOT HAVE_STDINT_H) | |
246 IF(HAVE_WINDOWS_H) | |
247 CHECK_C_SOURCE_COMPILES("\#define _WIN32_WINNT 0x0500 | |
248 \#include <windows.h> | |
249 __int64 foo; | |
250 int main() {return 0;}" HAVE___INT64) | |
251 ENDIF() | |
252 IF(NOT HAVE___INT64) | |
253 IF(NOT SIZEOF_LONG MATCHES "8") | |
254 IF(NOT SIZEOF_LONG_LONG MATCHES "8") | |
255 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!") | |
256 ENDIF() | |
257 ENDIF() | |
258 ENDIF() | |
259 ENDIF() | |
260 | |
261 # Windows needs winmm for timeGetTime, even if the backend is disabled | |
262 CHECK_SHARED_FUNCTION_EXISTS(timeGetTime "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM) | |
263 IF(HAVE_LIBWINMM) | |
264 SET(EXTRA_LIBS winmm ${EXTRA_LIBS}) | |
265 SET(PKG_CONFIG_LIBS ${PKG_CONFIG_LIBS} -lwinmm) | |
266 ENDIF() | |
267 | |
268 | |
269 SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c | |
270 OpenAL32/alBuffer.c | |
271 OpenAL32/alEffect.c | |
272 OpenAL32/alError.c | |
273 OpenAL32/alExtension.c | |
274 OpenAL32/alFilter.c | |
275 OpenAL32/alListener.c | |
276 OpenAL32/alSource.c | |
277 OpenAL32/alState.c | |
278 OpenAL32/alThunk.c | |
279 ) | |
280 SET(ALC_OBJS Alc/ALc.c | |
281 Alc/ALu.c | |
282 Alc/alcConfig.c | |
283 Alc/alcDedicated.c | |
284 Alc/alcEcho.c | |
285 Alc/alcModulator.c | |
286 Alc/alcReverb.c | |
287 Alc/alcRing.c | |
288 Alc/alcThread.c | |
289 Alc/bs2b.c | |
290 Alc/helpers.c | |
291 Alc/hrtf.c | |
292 Alc/mixer.c | |
293 Alc/panning.c | |
294 # Default backends, always available | |
295 Alc/backends/loopback.c | |
296 Alc/backends/null.c | |
297 # RLM: add record device | |
298 Alc/backends/record.c | |
299 ) | |
300 | |
301 SET(BACKENDS "") | |
302 SET(HAVE_ALSA 0) | |
303 SET(HAVE_OSS 0) | |
304 SET(HAVE_SOLARIS 0) | |
305 SET(HAVE_SNDIO 0) | |
306 SET(HAVE_DSOUND 0) | |
307 SET(HAVE_WINMM 0) | |
308 SET(HAVE_PORTAUDIO 0) | |
309 SET(HAVE_PULSEAUDIO 0) | |
310 SET(HAVE_COREAUDIO 0) | |
311 SET(HAVE_OPENSL 0) | |
312 SET(HAVE_WAVE 0) | |
313 | |
314 | |
315 # Check for MMDevApi backend | |
316 IF(HAVE_WINDOWS_H) | |
317 IF(MMDEVAPI) | |
318 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H) | |
319 IF(HAVE_MMDEVICEAPI_H) | |
320 SET(HAVE_MMDEVAPI 1) | |
321 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c) | |
322 | |
323 SET(BACKENDS "${BACKENDS} MMDevApi,") | |
324 ENDIF() | |
325 ENDIF() | |
326 ENDIF() | |
327 IF(REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI) | |
328 MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend") | |
329 ENDIF() | |
330 | |
331 | |
332 IF(HAVE_WINDOWS_H) | |
333 IF(WINMM) | |
334 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0500) | |
335 IF(HAVE_MMSYSTEM_H AND HAVE_LIBWINMM) | |
336 SET(HAVE_WINMM 1) | |
337 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c) | |
338 SET(BACKENDS "${BACKENDS} WinMM,") | |
339 ENDIF() | |
340 ENDIF() | |
341 ENDIF() | |
342 IF(REQUIRE_WINMM AND NOT HAVE_WINMM) | |
343 MESSAGE(FATAL_ERROR "Failed to enable required WinMM backend") | |
344 ENDIF() | |
345 | |
346 # Optionally enable the Wave Writer backend | |
347 IF(WAVE) | |
348 SET(HAVE_WAVE 1) | |
349 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c) | |
350 SET(BACKENDS "${BACKENDS} WaveFile,") | |
351 ENDIF() | |
352 | |
353 | |
354 # RLM: enable the record backend | |
355 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/record.c) | |
356 SET(BACKENDS "${BACKENDS} Record,") | |
357 | |
358 | |
359 # This is always available | |
360 SET(BACKENDS "${BACKENDS} Null") | |
361 | |
362 # Needed for openal.pc.in | |
363 SET(prefix ${CMAKE_INSTALL_PREFIX}) | |
364 SET(exec_prefix "\${prefix}") | |
365 SET(libdir "\${exec_prefix}/lib${LIB_SUFFIX}") | |
366 SET(bindir "\${exec_prefix}/bin") | |
367 SET(includedir "\${prefix}/include") | |
368 SET(PACKAGE_VERSION "${LIB_VERSION}") | |
369 | |
370 # End configuration | |
371 CONFIGURE_FILE( | |
372 "${OpenAL_SOURCE_DIR}/config.h.in" | |
373 "${OpenAL_BINARY_DIR}/config.h") | |
374 CONFIGURE_FILE( | |
375 "${OpenAL_SOURCE_DIR}/openal.pc.in" | |
376 "${OpenAL_BINARY_DIR}/openal.pc" | |
377 @ONLY) | |
378 | |
379 | |
380 # RLM link jni the dumb way for now: | |
381 INCLUDE_DIRECTORIES("/usr/lib/jvm/java-6-sun-1.6.0.20/include/") | |
382 INCLUDE_DIRECTORIES("/usr/lib/jvm/java-6-sun-1.6.0.20/include/linux") | |
383 | |
384 | |
385 # Build a library | |
386 ADD_LIBRARY(${LIBNAME} SHARED ${OPENAL_OBJS} ${ALC_OBJS}) | |
387 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES DEFINE_SYMBOL AL_BUILD_LIBRARY | |
388 COMPILE_FLAGS -DAL_ALEXT_PROTOTYPES | |
389 VERSION ${LIB_VERSION}.0 | |
390 SOVERSION ${LIB_MAJOR_VERSION}) | |
391 | |
392 | |
393 TARGET_LINK_LIBRARIES(${LIBNAME} ${EXTRA_LIBS}) | |
394 | |
395 # Add an install target here | |
396 INSTALL(TARGETS ${LIBNAME} | |
397 RUNTIME DESTINATION bin | |
398 LIBRARY DESTINATION "lib${LIB_SUFFIX}" | |
399 ARCHIVE DESTINATION "lib${LIB_SUFFIX}" | |
400 ) | |
401 INSTALL(FILES include/AL/al.h | |
402 include/AL/alc.h | |
403 include/AL/alext.h | |
404 include/AL/efx.h | |
405 include/AL/efx-creative.h | |
406 DESTINATION include/AL | |
407 ) | |
408 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc" | |
409 DESTINATION "lib${LIB_SUFFIX}/pkgconfig") | |
410 | |
411 | |
412 MESSAGE(STATUS "") | |
413 MESSAGE(STATUS "Building OpenAL with support for the following backends:") | |
414 MESSAGE(STATUS " ${BACKENDS}") | |
415 MESSAGE(STATUS "") | |
416 | |
417 # Install alsoft.conf configuration file | |
418 | |
419 IF(UTILS) | |
420 ADD_EXECUTABLE(openal-info utils/openal-info.c) | |
421 TARGET_LINK_LIBRARIES(openal-info ${LIBNAME}) | |
422 INSTALL(TARGETS openal-info | |
423 RUNTIME DESTINATION bin | |
424 LIBRARY DESTINATION "lib${LIB_SUFFIX}" | |
425 ARCHIVE DESTINATION "lib${LIB_SUFFIX}" | |
426 ) | |
427 MESSAGE(STATUS "Building utility programs") | |
428 MESSAGE(STATUS "") | |
429 ENDIF() | |
430 | |
431 |