Mercurial > audio-send
comparison CMakeLists.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 | 82b9267a3e19 |
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(SEND "Enable Send 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 IF(WIN32) | |
64 SET(LIBNAME OpenAL32) | |
65 ADD_DEFINITIONS("-D_WIN32") | |
66 ELSE() | |
67 SET(LIBNAME openal) | |
68 ENDIF() | |
69 | |
70 IF(NOT LIBTYPE) | |
71 SET(LIBTYPE SHARED) | |
72 ENDIF() | |
73 | |
74 SET(LIB_MAJOR_VERSION "1") | |
75 SET(LIB_MINOR_VERSION "13") | |
76 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}") | |
77 | |
78 SET(EXPORT_DECL "") | |
79 | |
80 | |
81 CHECK_TYPE_SIZE("long" SIZEOF_LONG) | |
82 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) | |
83 CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT) | |
84 CHECK_TYPE_SIZE("void*" SIZEOF_VOIDP) | |
85 | |
86 | |
87 CHECK_C_SOURCE_COMPILES("int *restrict foo; | |
88 int main() {return 0;}" HAVE_RESTRICT) | |
89 CHECK_C_SOURCE_COMPILES("int *__restrict foo; | |
90 int main() {return 0;}" HAVE___RESTRICT) | |
91 | |
92 | |
93 # Add definitions, compiler switches, etc. | |
94 INCLUDE_DIRECTORIES(OpenAL32/Include include "${OpenAL_BINARY_DIR}") | |
95 | |
96 IF(NOT CMAKE_BUILD_TYPE) | |
97 SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING | |
98 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." | |
99 FORCE) | |
100 ENDIF() | |
101 IF(NOT CMAKE_DEBUG_POSTFIX) | |
102 SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING | |
103 "Library postfix for debug builds. Normally left blank." | |
104 FORCE) | |
105 ENDIF() | |
106 | |
107 | |
108 | |
109 IF(MSVC) | |
110 # ??? | |
111 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_DEBUG") | |
112 SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG") | |
113 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG") | |
114 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") | |
115 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) | |
116 ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE) | |
117 | |
118 IF(NOT DXSDK_DIR) | |
119 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}") | |
120 ELSE() | |
121 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}") | |
122 ENDIF() | |
123 IF(DXSDK_DIR) | |
124 MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}") | |
125 SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${DXSDK_DIR}/Include") | |
126 INCLUDE_DIRECTORIES("${DXSDK_DIR}/Include") | |
127 LINK_DIRECTORIES("${DXSDK_DIR}/Lib") | |
128 ENDIF() | |
129 | |
130 OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF) | |
131 IF(FORCE_STATIC_VCRT) | |
132 FOREACH(flag_var | |
133 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE | |
134 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) | |
135 IF(${flag_var} MATCHES "/MD") | |
136 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") | |
137 ENDIF() | |
138 ENDFOREACH(flag_var) | |
139 ENDIF() | |
140 ELSE() | |
141 ADD_DEFINITIONS(-Winline -Wall) | |
142 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA) | |
143 IF(HAVE_W_EXTRA) | |
144 ADD_DEFINITIONS(-Wextra) | |
145 ENDIF() | |
146 | |
147 IF(WERROR) | |
148 ADD_DEFINITIONS(-Werror) | |
149 ENDIF() | |
150 | |
151 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -D_DEBUG" CACHE STRING | |
152 "Flags used by the compiler during Release with Debug Info builds." | |
153 FORCE) | |
154 SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING | |
155 "Flags used by the compiler during release minsize builds." | |
156 FORCE) | |
157 SET(CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -DNDEBUG" CACHE STRING | |
158 "Flags used by the compiler during release builds" | |
159 FORCE) | |
160 SET(CMAKE_C_FLAGS_DEBUG "-g3 -D_DEBUG" CACHE STRING | |
161 "Flags used by the compiler during debug builds." | |
162 FORCE) | |
163 | |
164 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor)); | |
165 int main() {return 0;}" HAVE_GCC_DESTRUCTOR) | |
166 ENDIF() | |
167 | |
168 # Set visibility/export options if available | |
169 IF(WIN32) | |
170 SET(EXPORT_DECL "__declspec(dllexport)") | |
171 | |
172 OPTION(WINE "Enable use of Wine headers when compiling" OFF) | |
173 IF(WINE) | |
174 FIND_PATH(WINE_INCLUDE_DIR library.h | |
175 PATHS | |
176 /usr/include/wine | |
177 /usr/local/include/wine | |
178 CMAKE_FIND_ROOT_PATH_BOTH) | |
179 IF(WINE_INCLUDE_DIR) | |
180 MESSAGE(STATUS "Found Wine header files - ${WINE_INCLUDE_DIR}" ) | |
181 INCLUDE_DIRECTORIES("${WINE_INCLUDE_DIR}/windows") | |
182 SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${WINE_INCLUDE_DIR}/windows") | |
183 ELSE() | |
184 MESSAGE(STATUS "Could not find Wine header files" ) | |
185 ENDIF() | |
186 ENDIF() | |
187 ELSE() | |
188 CHECK_C_COMPILER_FLAG(-fvisibility=internal HAVE_VISIBILITY_SWITCH) | |
189 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\"))); | |
190 int main() {return 0;}" HAVE_GCC_VISIBILITY) | |
191 IF(HAVE_VISIBILITY_SWITCH AND HAVE_GCC_VISIBILITY) | |
192 #ADD_DEFINITIONS(-fvisibility=internal) | |
193 #SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))") | |
194 ENDIF() | |
195 ENDIF() | |
196 | |
197 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2))); | |
198 int main() {return 0;}" HAVE_GCC_FORMAT) | |
199 | |
200 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H) | |
201 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H) | |
202 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H) | |
203 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H) | |
204 IF(NOT HAVE_GUIDDEF_H) | |
205 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H) | |
206 ENDIF() | |
207 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H) | |
208 | |
209 CHECK_LIBRARY_EXISTS(m powf "" HAVE_POWF) | |
210 CHECK_LIBRARY_EXISTS(m sqrtf "" HAVE_SQRTF) | |
211 CHECK_LIBRARY_EXISTS(m acosf "" HAVE_ACOSF) | |
212 CHECK_LIBRARY_EXISTS(m atanf "" HAVE_ATANF) | |
213 CHECK_LIBRARY_EXISTS(m fabsf "" HAVE_FABSF) | |
214 IF(HAVE_FENV_H) | |
215 CHECK_LIBRARY_EXISTS(m fesetround "" HAVE_FESETROUND) | |
216 ENDIF() | |
217 IF(HAVE_SQRTF OR HAVE_ACOSF OR HAVE_ATANF OR HAVE_FABSF OR HAVE_FESETROUND) | |
218 SET(EXTRA_LIBS m ${EXTRA_LIBS}) | |
219 ENDIF() | |
220 CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF) | |
221 CHECK_FUNCTION_EXISTS(_controlfp HAVE__CONTROLFP) | |
222 | |
223 CHECK_FUNCTION_EXISTS(stat HAVE_STAT) | |
224 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP) | |
225 IF(NOT HAVE_STRCASECMP) | |
226 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP) | |
227 IF(NOT HAVE__STRICMP) | |
228 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!") | |
229 ENDIF() | |
230 | |
231 ADD_DEFINITIONS(-Dstrcasecmp=_stricmp) | |
232 ENDIF() | |
233 | |
234 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP) | |
235 IF(NOT HAVE_STRNCASECMP) | |
236 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP) | |
237 IF(NOT HAVE__STRNICMP) | |
238 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!") | |
239 ENDIF() | |
240 | |
241 ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp) | |
242 ENDIF() | |
243 | |
244 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF) | |
245 IF(NOT HAVE_SNPRINTF) | |
246 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF) | |
247 IF(NOT HAVE__SNPRINTF) | |
248 MESSAGE(FATAL_ERROR "No snprintf function found, please report!") | |
249 ENDIF() | |
250 | |
251 ADD_DEFINITIONS(-Dsnprintf=_snprintf) | |
252 ENDIF() | |
253 | |
254 CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF) | |
255 IF(NOT HAVE_VSNPRINTF) | |
256 CHECK_FUNCTION_EXISTS(_vsnprintf HAVE__VSNPRINTF) | |
257 IF(NOT HAVE__VSNPRINTF) | |
258 MESSAGE(FATAL_ERROR "No vsnprintf function found, please report!") | |
259 ENDIF() | |
260 | |
261 ADD_DEFINITIONS(-Dvsnprintf=_vsnprintf) | |
262 ENDIF() | |
263 | |
264 CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE) | |
265 IF(NOT HAVE_ISFINITE) | |
266 CHECK_FUNCTION_EXISTS(finite HAVE_FINITE) | |
267 IF(NOT HAVE_FINITE) | |
268 CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE) | |
269 IF(NOT HAVE__FINITE) | |
270 MESSAGE(FATAL_ERROR "No isfinite function found, please report!") | |
271 ENDIF() | |
272 ADD_DEFINITIONS(-Disfinite=_finite) | |
273 ELSE() | |
274 ADD_DEFINITIONS(-Disfinite=finite) | |
275 ENDIF() | |
276 ENDIF() | |
277 | |
278 CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN) | |
279 IF(NOT HAVE_ISNAN) | |
280 CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN) | |
281 IF(NOT HAVE__ISNAN) | |
282 MESSAGE(FATAL_ERROR "No isnan function found, please report!") | |
283 ENDIF() | |
284 | |
285 ADD_DEFINITIONS(-Disnan=_isnan) | |
286 ENDIF() | |
287 | |
288 | |
289 # Check for the dlopen API (for dynamicly loading backend libs) | |
290 IF(DLOPEN) | |
291 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H) | |
292 IF(HAVE_DLFCN_H) | |
293 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL) | |
294 IF(HAVE_LIBDL) | |
295 SET(EXTRA_LIBS dl ${EXTRA_LIBS}) | |
296 ENDIF() | |
297 ENDIF() | |
298 ENDIF() | |
299 | |
300 # Check if we have Windows headers | |
301 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0500) | |
302 IF(NOT HAVE_WINDOWS_H) | |
303 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) | |
304 IF(NOT HAVE_GETTIMEOFDAY) | |
305 MESSAGE(FATAL_ERROR "No timing function found!") | |
306 ENDIF() | |
307 | |
308 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP) | |
309 IF(NOT HAVE_NANOSLEEP) | |
310 MESSAGE(FATAL_ERROR "No sleep function found!") | |
311 ENDIF() | |
312 | |
313 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD) | |
314 IF(HAVE_PTHREAD) | |
315 ADD_DEFINITIONS(-pthread) | |
316 SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread) | |
317 ENDIF() | |
318 | |
319 # We need pthreads outside of Windows | |
320 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H) | |
321 IF(NOT HAVE_PTHREAD_H) | |
322 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!") | |
323 ENDIF() | |
324 # Some systems need pthread_np.h to get recursive mutexes | |
325 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H) | |
326 | |
327 # _GNU_SOURCE is needed on some systems for extra attributes, and | |
328 # _REENTRANT is needed for libc thread-safety | |
329 ADD_DEFINITIONS(-D_GNU_SOURCE=1) | |
330 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD) | |
331 IF(HAVE_LIBPTHREAD) | |
332 SET(EXTRA_LIBS pthread ${EXTRA_LIBS}) | |
333 ENDIF() | |
334 | |
335 CHECK_LIBRARY_EXISTS(pthread pthread_setschedparam "" HAVE_PTHREAD_SETSCHEDPARAM) | |
336 | |
337 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT) | |
338 IF(HAVE_LIBRT) | |
339 SET(EXTRA_LIBS rt ${EXTRA_LIBS}) | |
340 ENDIF() | |
341 ENDIF() | |
342 | |
343 # Check for a 64-bit type | |
344 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) | |
345 IF(NOT HAVE_STDINT_H) | |
346 IF(HAVE_WINDOWS_H) | |
347 CHECK_C_SOURCE_COMPILES("\#define _WIN32_WINNT 0x0500 | |
348 \#include <windows.h> | |
349 __int64 foo; | |
350 int main() {return 0;}" HAVE___INT64) | |
351 ENDIF() | |
352 IF(NOT HAVE___INT64) | |
353 IF(NOT SIZEOF_LONG MATCHES "8") | |
354 IF(NOT SIZEOF_LONG_LONG MATCHES "8") | |
355 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!") | |
356 ENDIF() | |
357 ENDIF() | |
358 ENDIF() | |
359 ENDIF() | |
360 | |
361 # Windows needs winmm for timeGetTime, even if the backend is disabled | |
362 CHECK_SHARED_FUNCTION_EXISTS(timeGetTime "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM) | |
363 IF(HAVE_LIBWINMM) | |
364 SET(EXTRA_LIBS winmm ${EXTRA_LIBS}) | |
365 SET(PKG_CONFIG_LIBS ${PKG_CONFIG_LIBS} -lwinmm) | |
366 ENDIF() | |
367 | |
368 | |
369 SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c | |
370 OpenAL32/alBuffer.c | |
371 OpenAL32/alEffect.c | |
372 OpenAL32/alError.c | |
373 OpenAL32/alExtension.c | |
374 OpenAL32/alFilter.c | |
375 OpenAL32/alListener.c | |
376 OpenAL32/alSource.c | |
377 OpenAL32/alState.c | |
378 OpenAL32/alThunk.c | |
379 ) | |
380 SET(ALC_OBJS Alc/ALc.c | |
381 Alc/ALu.c | |
382 Alc/alcConfig.c | |
383 Alc/alcDedicated.c | |
384 Alc/alcEcho.c | |
385 Alc/alcModulator.c | |
386 Alc/alcReverb.c | |
387 Alc/alcRing.c | |
388 Alc/alcThread.c | |
389 Alc/bs2b.c | |
390 Alc/helpers.c | |
391 Alc/hrtf.c | |
392 Alc/mixer.c | |
393 Alc/panning.c | |
394 # Default backends, always available | |
395 Alc/backends/loopback.c | |
396 Alc/backends/null.c | |
397 # RLM: add send device | |
398 Alc/backends/send.c | |
399 ) | |
400 | |
401 SET(BACKENDS "") | |
402 SET(HAVE_ALSA 0) | |
403 SET(HAVE_OSS 0) | |
404 SET(HAVE_SOLARIS 0) | |
405 SET(HAVE_SNDIO 0) | |
406 SET(HAVE_DSOUND 0) | |
407 SET(HAVE_WINMM 0) | |
408 SET(HAVE_PORTAUDIO 0) | |
409 SET(HAVE_PULSEAUDIO 0) | |
410 SET(HAVE_COREAUDIO 0) | |
411 SET(HAVE_OPENSL 0) | |
412 SET(HAVE_WAVE 0) | |
413 | |
414 | |
415 # Check ALSA backend | |
416 IF(ALSA) | |
417 CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ALSA_ASOUNDLIB_H) | |
418 IF(HAVE_ALSA_ASOUNDLIB_H) | |
419 CHECK_SHARED_FUNCTION_EXISTS(snd_pcm_open "alsa/asoundlib.h" asound "" HAVE_LIBASOUND) | |
420 IF(HAVE_LIBASOUND OR HAVE_DLFCN_H OR WIN32) | |
421 SET(HAVE_ALSA 1) | |
422 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c) | |
423 IF(HAVE_DLFCN_H OR WIN32) | |
424 SET(BACKENDS "${BACKENDS} ALSA,") | |
425 ELSE() | |
426 SET(BACKENDS "${BACKENDS} ALSA \(linked\),") | |
427 SET(EXTRA_LIBS asound ${EXTRA_LIBS}) | |
428 ENDIF() | |
429 ENDIF() | |
430 ENDIF() | |
431 ENDIF() | |
432 IF(REQUIRE_ALSA AND NOT HAVE_ALSA) | |
433 MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend") | |
434 ENDIF() | |
435 | |
436 # Check OSS backend | |
437 IF(OSS) | |
438 CHECK_INCLUDE_FILE(sys/soundcard.h HAVE_SYS_SOUNDCARD_H) | |
439 IF(HAVE_SYS_SOUNDCARD_H) | |
440 SET(HAVE_OSS 1) | |
441 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c) | |
442 SET(BACKENDS "${BACKENDS} OSS,") | |
443 ENDIF() | |
444 ENDIF() | |
445 IF(REQUIRE_OSS AND NOT HAVE_OSS) | |
446 MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend") | |
447 ENDIF() | |
448 | |
449 # Check Solaris backend | |
450 IF(SOLARIS) | |
451 CHECK_INCLUDE_FILE(sys/audioio.h HAVE_SYS_AUDIOIO_H) | |
452 IF(HAVE_SYS_AUDIOIO_H) | |
453 SET(HAVE_SOLARIS 1) | |
454 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c) | |
455 SET(BACKENDS "${BACKENDS} Solaris,") | |
456 ENDIF() | |
457 ENDIF() | |
458 IF(REQUIRE_SOLARIS AND NOT HAVE_SOLARIS) | |
459 MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend") | |
460 ENDIF() | |
461 | |
462 # Check SndIO backend | |
463 IF(SNDIO) | |
464 CHECK_INCLUDE_FILE(sndio.h HAVE_SNDIO_H) | |
465 IF(HAVE_SNDIO_H) | |
466 CHECK_SHARED_FUNCTION_EXISTS(sio_open "sndio.h" sndio "" HAVE_LIBSNDIO) | |
467 IF(HAVE_LIBSNDIO OR HAVE_DLFCN_H OR WIN32) | |
468 SET(HAVE_SNDIO 1) | |
469 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c) | |
470 IF(HAVE_DLFCN_H OR WIN32) | |
471 SET(BACKENDS "${BACKENDS} SndIO,") | |
472 ELSE() | |
473 SET(BACKENDS "${BACKENDS} SndIO \(linked\),") | |
474 SET(EXTRA_LIBS sndio ${EXTRA_LIBS}) | |
475 ENDIF() | |
476 ENDIF() | |
477 ENDIF() | |
478 ENDIF() | |
479 IF(REQUIRE_SNDIO AND NOT HAVE_SNDIO) | |
480 MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend") | |
481 ENDIF() | |
482 | |
483 # Check for MMDevApi backend | |
484 IF(HAVE_WINDOWS_H) | |
485 IF(MMDEVAPI) | |
486 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H) | |
487 IF(HAVE_MMDEVICEAPI_H) | |
488 SET(HAVE_MMDEVAPI 1) | |
489 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c) | |
490 | |
491 SET(BACKENDS "${BACKENDS} MMDevApi,") | |
492 ENDIF() | |
493 ENDIF() | |
494 ENDIF() | |
495 IF(REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI) | |
496 MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend") | |
497 ENDIF() | |
498 | |
499 # Check DSound/MMSystem backend | |
500 IF(DSOUND) | |
501 CHECK_INCLUDE_FILE(dsound.h HAVE_DSOUND_H) | |
502 IF(HAVE_DSOUND_H) | |
503 CHECK_SHARED_FUNCTION_EXISTS(DirectSoundCreate "dsound.h" dsound "" HAVE_LIBDSOUND) | |
504 IF(HAVE_LIBDSOUND OR HAVE_DLFCN_H OR WIN32) | |
505 SET(HAVE_DSOUND 1) | |
506 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) | |
507 | |
508 IF(HAVE_DLFCN_H OR WIN32) | |
509 SET(BACKENDS "${BACKENDS} DirectSound,") | |
510 ELSE() | |
511 SET(BACKENDS "${BACKENDS} DirectSound \(linked\),") | |
512 SET(EXTRA_LIBS dsound ${EXTRA_LIBS}) | |
513 ENDIF() | |
514 ENDIF() | |
515 ENDIF() | |
516 ENDIF() | |
517 IF(REQUIRE_DSOUND AND NOT HAVE_DSOUND) | |
518 MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend") | |
519 ENDIF() | |
520 | |
521 IF(HAVE_WINDOWS_H) | |
522 IF(WINMM) | |
523 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0500) | |
524 IF(HAVE_MMSYSTEM_H AND HAVE_LIBWINMM) | |
525 SET(HAVE_WINMM 1) | |
526 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c) | |
527 SET(BACKENDS "${BACKENDS} WinMM,") | |
528 ENDIF() | |
529 ENDIF() | |
530 ENDIF() | |
531 IF(REQUIRE_WINMM AND NOT HAVE_WINMM) | |
532 MESSAGE(FATAL_ERROR "Failed to enable required WinMM backend") | |
533 ENDIF() | |
534 | |
535 # Check PortAudio backend | |
536 IF(PORTAUDIO) | |
537 CHECK_INCLUDE_FILE(portaudio.h HAVE_PORTAUDIO_H) | |
538 IF(HAVE_PORTAUDIO_H) | |
539 CHECK_SHARED_FUNCTION_EXISTS(Pa_Initialize "portaudio.h" portaudio "" HAVE_LIBPORTAUDIO) | |
540 IF(HAVE_LIBPORTAUDIO OR HAVE_DLFCN_H OR WIN32) | |
541 SET(HAVE_PORTAUDIO 1) | |
542 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c) | |
543 IF(HAVE_DLFCN_H OR WIN32) | |
544 SET(BACKENDS "${BACKENDS} PortAudio,") | |
545 ELSE() | |
546 SET(BACKENDS "${BACKENDS} PortAudio \(linked\),") | |
547 SET(EXTRA_LIBS portaudio ${EXTRA_LIBS}) | |
548 ENDIF() | |
549 ENDIF() | |
550 ENDIF() | |
551 ENDIF() | |
552 IF(REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO) | |
553 MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend") | |
554 ENDIF() | |
555 | |
556 # Check PulseAudio backend | |
557 IF(PULSEAUDIO) | |
558 CHECK_INCLUDE_FILE(pulse/pulseaudio.h HAVE_PULSE_PULSEAUDIO_H) | |
559 IF(HAVE_PULSE_PULSEAUDIO_H) | |
560 CHECK_SHARED_FUNCTION_EXISTS(pa_context_new "pulse/pulseaudio.h" pulse "" HAVE_LIBPULSE) | |
561 IF(HAVE_LIBPULSE OR HAVE_DLFCN_H OR WIN32) | |
562 SET(HAVE_PULSEAUDIO 1) | |
563 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c) | |
564 IF(HAVE_DLFCN_H OR WIN32) | |
565 SET(BACKENDS "${BACKENDS} PulseAudio,") | |
566 ELSE() | |
567 SET(BACKENDS "${BACKENDS} PulseAudio \(linked\),") | |
568 SET(EXTRA_LIBS pulse ${EXTRA_LIBS}) | |
569 ENDIF() | |
570 ENDIF() | |
571 ENDIF() | |
572 ENDIF() | |
573 IF(REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO) | |
574 MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend") | |
575 ENDIF() | |
576 | |
577 # Check CoreAudio backend | |
578 IF(COREAUDIO) | |
579 CHECK_INCLUDE_FILE(/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h HAVE_COREAUDIO_FRAMEWORK) | |
580 IF(HAVE_COREAUDIO_FRAMEWORK) | |
581 SET(HAVE_COREAUDIO 1) | |
582 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c) | |
583 SET(BACKENDS "${BACKENDS} CoreAudio,") | |
584 SET(EXTRA_LIBS /System/Library/Frameworks/CoreAudio.framework ${EXTRA_LIBS}) | |
585 SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS}) | |
586 SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS}) | |
587 ENDIF() | |
588 ENDIF() | |
589 IF(REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO) | |
590 MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend") | |
591 ENDIF() | |
592 | |
593 # Check for OpenSL (Android) backend | |
594 IF(OPENSL) | |
595 CHECK_INCLUDE_FILE(SLES/OpenSLES_Android.h HAVE_SLES_OPENSLES_ANDROID_H) | |
596 IF(HAVE_SLES_OPENSLES_ANDROID_H) | |
597 CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES) | |
598 IF(HAVE_LIBOPENSLES) | |
599 SET(HAVE_OPENSL 1) | |
600 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c) | |
601 SET(BACKENDS "${BACKENDS} OpenSL,") | |
602 SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS}) | |
603 ENDIF() | |
604 ENDIF() | |
605 ENDIF() | |
606 IF(REQUIRE_OPENSL AND NOT HAVE_OPENSL) | |
607 MESSAGE(FATAL_ERROR "Failed to enable required OpenSL backend") | |
608 ENDIF() | |
609 | |
610 # Optionally enable the Wave Writer backend | |
611 IF(WAVE) | |
612 SET(HAVE_WAVE 1) | |
613 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c) | |
614 SET(BACKENDS "${BACKENDS} WaveFile,") | |
615 ENDIF() | |
616 | |
617 | |
618 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/send.c) | |
619 SET(BACKENDS "${BACKENDS} Send,") | |
620 | |
621 | |
622 # This is always available | |
623 SET(BACKENDS "${BACKENDS} Null") | |
624 | |
625 IF(LIBTYPE STREQUAL "STATIC") | |
626 ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC) | |
627 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS}) | |
628 ENDIF() | |
629 | |
630 # Needed for openal.pc.in | |
631 SET(prefix ${CMAKE_INSTALL_PREFIX}) | |
632 SET(exec_prefix "\${prefix}") | |
633 SET(libdir "\${exec_prefix}/lib${LIB_SUFFIX}") | |
634 SET(bindir "\${exec_prefix}/bin") | |
635 SET(includedir "\${prefix}/include") | |
636 SET(PACKAGE_VERSION "${LIB_VERSION}") | |
637 | |
638 # End configuration | |
639 CONFIGURE_FILE( | |
640 "${OpenAL_SOURCE_DIR}/config.h.in" | |
641 "${OpenAL_BINARY_DIR}/config.h") | |
642 CONFIGURE_FILE( | |
643 "${OpenAL_SOURCE_DIR}/openal.pc.in" | |
644 "${OpenAL_BINARY_DIR}/openal.pc" | |
645 @ONLY) | |
646 | |
647 # Build a library | |
648 ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS}) | |
649 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES DEFINE_SYMBOL AL_BUILD_LIBRARY | |
650 COMPILE_FLAGS -DAL_ALEXT_PROTOTYPES | |
651 VERSION ${LIB_VERSION}.0 | |
652 SOVERSION ${LIB_MAJOR_VERSION}) | |
653 IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") | |
654 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "") | |
655 ENDIF() | |
656 | |
657 # RLM link jni the dumb way for now: | |
658 | |
659 INCLUDE_DIRECTORIES("/opt/jdk/include/") | |
660 INCLUDE_DIRECTORIES("/opt/jdk/include/linux") | |
661 TARGET_LINK_LIBRARIES(${LIBNAME} ${EXTRA_LIBS}) | |
662 | |
663 # Add an install target here | |
664 INSTALL(TARGETS ${LIBNAME} | |
665 RUNTIME DESTINATION bin | |
666 LIBRARY DESTINATION "lib${LIB_SUFFIX}" | |
667 ARCHIVE DESTINATION "lib${LIB_SUFFIX}" | |
668 ) | |
669 INSTALL(FILES include/AL/al.h | |
670 include/AL/alc.h | |
671 include/AL/alext.h | |
672 include/AL/efx.h | |
673 include/AL/efx-creative.h | |
674 DESTINATION include/AL | |
675 ) | |
676 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc" | |
677 DESTINATION "lib${LIB_SUFFIX}/pkgconfig") | |
678 | |
679 | |
680 MESSAGE(STATUS "") | |
681 MESSAGE(STATUS "Building OpenAL with support for the following backends:") | |
682 MESSAGE(STATUS " ${BACKENDS}") | |
683 MESSAGE(STATUS "") | |
684 | |
685 IF(WIN32) | |
686 IF(NOT HAVE_DSOUND) | |
687 MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output") | |
688 MESSAGE(STATUS " This is probably NOT what you want!") | |
689 MESSAGE(STATUS "") | |
690 ENDIF() | |
691 ENDIF() | |
692 | |
693 # Install alsoft.conf configuration file | |
694 IF(ALSOFT_CONFIG) | |
695 INSTALL(FILES alsoftrc.sample | |
696 DESTINATION /etc/openal | |
697 RENAME alsoft.conf | |
698 ) | |
699 MESSAGE(STATUS "Installing sample alsoft.conf") | |
700 MESSAGE(STATUS "") | |
701 ENDIF() | |
702 | |
703 IF(UTILS) | |
704 ADD_EXECUTABLE(openal-info utils/openal-info.c) | |
705 TARGET_LINK_LIBRARIES(openal-info ${LIBNAME}) | |
706 INSTALL(TARGETS openal-info | |
707 RUNTIME DESTINATION bin | |
708 LIBRARY DESTINATION "lib${LIB_SUFFIX}" | |
709 ARCHIVE DESTINATION "lib${LIB_SUFFIX}" | |
710 ) | |
711 MESSAGE(STATUS "Building utility programs") | |
712 MESSAGE(STATUS "") | |
713 ENDIF() | |
714 | |
715 |