Mercurial > audio-send
diff 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 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/CMakeLists.txt Tue Oct 25 13:02:31 2011 -0700 1.3 @@ -0,0 +1,715 @@ 1.4 +# CMake build file list for OpenAL 1.5 + 1.6 +CMAKE_MINIMUM_REQUIRED(VERSION 2.4) 1.7 + 1.8 +IF(COMMAND CMAKE_POLICY) 1.9 + CMAKE_POLICY(SET CMP0003 NEW) 1.10 +ENDIF(COMMAND CMAKE_POLICY) 1.11 + 1.12 +SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") 1.13 + 1.14 +INCLUDE(CheckFunctionExists) 1.15 +INCLUDE(CheckLibraryExists) 1.16 +INCLUDE(CheckSharedFunctionExists) 1.17 +INCLUDE(CheckIncludeFile) 1.18 +INCLUDE(CheckIncludeFiles) 1.19 +INCLUDE(CheckSymbolExists) 1.20 +INCLUDE(CheckCCompilerFlag) 1.21 +INCLUDE(CheckCSourceCompiles) 1.22 +INCLUDE(CheckTypeSize) 1.23 + 1.24 + 1.25 +PROJECT(OpenAL C) 1.26 + 1.27 + 1.28 +SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) 1.29 + 1.30 + 1.31 +OPTION(ALSA "Check for ALSA backend" ON) 1.32 +OPTION(OSS "Check for OSS backend" ON) 1.33 +OPTION(SOLARIS "Check for Solaris backend" ON) 1.34 +OPTION(SNDIO "Check for SndIO backend" ON) 1.35 +OPTION(MMDEVAPI "Check for MMDevApi" ON) 1.36 +OPTION(DSOUND "Check for DirectSound backend" ON) 1.37 +OPTION(WINMM "Check for Windows Multimedia backend" ON) 1.38 +OPTION(PORTAUDIO "Check for PortAudio backend" ON) 1.39 +OPTION(PULSEAUDIO "Check for PulseAudio backend" ON) 1.40 +OPTION(COREAUDIO "Check for CoreAudio backend" ON) 1.41 +OPTION(OPENSL "Check for OpenSL backend" ON) 1.42 +OPTION(WAVE "Enable Wave Writer backend" ON) 1.43 +OPTION(SEND "Enable Send Backend" ON) 1.44 + 1.45 +OPTION(REQUIRE_ALSA "Require ALSA backend" OFF) 1.46 +OPTION(REQUIRE_OSS "Require OSS backend" OFF) 1.47 +OPTION(REQUIRE_SOLARIS "Require Solaris backend" OFF) 1.48 +OPTION(REQUIRE_SNDIO "Require SndIO backend" OFF) 1.49 +OPTION(REQUIRE_MMDEVAPI "Require MMDevApi" OFF) 1.50 +OPTION(REQUIRE_DSOUND "Require DirectSound backend" OFF) 1.51 +OPTION(REQUIRE_WINMM "Require Windows Multimedia backend" OFF) 1.52 +OPTION(REQUIRE_PORTAUDIO "Require PortAudio backend" OFF) 1.53 +OPTION(REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF) 1.54 +OPTION(REQUIRE_COREAUDIO "Require CoreAudio backend" OFF) 1.55 +OPTION(REQUIRE_OPENSL "Require OpenSL backend" OFF) 1.56 + 1.57 +OPTION(DLOPEN "Check for the dlopen API for loading optional libs" ON) 1.58 + 1.59 +OPTION(WERROR "Treat compile warnings as errors" OFF) 1.60 + 1.61 +OPTION(UTILS "Build and install utility programs" ON) 1.62 + 1.63 +OPTION(ALSOFT_CONFIG "Install alsoft.conf configuration file" OFF) 1.64 + 1.65 + 1.66 +IF(WIN32) 1.67 + SET(LIBNAME OpenAL32) 1.68 + ADD_DEFINITIONS("-D_WIN32") 1.69 +ELSE() 1.70 + SET(LIBNAME openal) 1.71 +ENDIF() 1.72 + 1.73 +IF(NOT LIBTYPE) 1.74 + SET(LIBTYPE SHARED) 1.75 +ENDIF() 1.76 + 1.77 +SET(LIB_MAJOR_VERSION "1") 1.78 +SET(LIB_MINOR_VERSION "13") 1.79 +SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}") 1.80 + 1.81 +SET(EXPORT_DECL "") 1.82 + 1.83 + 1.84 +CHECK_TYPE_SIZE("long" SIZEOF_LONG) 1.85 +CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) 1.86 +CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT) 1.87 +CHECK_TYPE_SIZE("void*" SIZEOF_VOIDP) 1.88 + 1.89 + 1.90 +CHECK_C_SOURCE_COMPILES("int *restrict foo; 1.91 + int main() {return 0;}" HAVE_RESTRICT) 1.92 +CHECK_C_SOURCE_COMPILES("int *__restrict foo; 1.93 + int main() {return 0;}" HAVE___RESTRICT) 1.94 + 1.95 + 1.96 +# Add definitions, compiler switches, etc. 1.97 +INCLUDE_DIRECTORIES(OpenAL32/Include include "${OpenAL_BINARY_DIR}") 1.98 + 1.99 +IF(NOT CMAKE_BUILD_TYPE) 1.100 + SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING 1.101 + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." 1.102 + FORCE) 1.103 +ENDIF() 1.104 +IF(NOT CMAKE_DEBUG_POSTFIX) 1.105 + SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING 1.106 + "Library postfix for debug builds. Normally left blank." 1.107 + FORCE) 1.108 +ENDIF() 1.109 + 1.110 + 1.111 + 1.112 +IF(MSVC) 1.113 + # ??? 1.114 + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_DEBUG") 1.115 + SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG") 1.116 + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG") 1.117 + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") 1.118 + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) 1.119 + ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE) 1.120 + 1.121 + IF(NOT DXSDK_DIR) 1.122 + STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}") 1.123 + ELSE() 1.124 + STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}") 1.125 + ENDIF() 1.126 + IF(DXSDK_DIR) 1.127 + MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}") 1.128 + SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${DXSDK_DIR}/Include") 1.129 + INCLUDE_DIRECTORIES("${DXSDK_DIR}/Include") 1.130 + LINK_DIRECTORIES("${DXSDK_DIR}/Lib") 1.131 + ENDIF() 1.132 + 1.133 + OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF) 1.134 + IF(FORCE_STATIC_VCRT) 1.135 + FOREACH(flag_var 1.136 + CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE 1.137 + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) 1.138 + IF(${flag_var} MATCHES "/MD") 1.139 + STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") 1.140 + ENDIF() 1.141 + ENDFOREACH(flag_var) 1.142 + ENDIF() 1.143 +ELSE() 1.144 + ADD_DEFINITIONS(-Winline -Wall) 1.145 + CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA) 1.146 + IF(HAVE_W_EXTRA) 1.147 + ADD_DEFINITIONS(-Wextra) 1.148 + ENDIF() 1.149 + 1.150 + IF(WERROR) 1.151 + ADD_DEFINITIONS(-Werror) 1.152 + ENDIF() 1.153 + 1.154 + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -D_DEBUG" CACHE STRING 1.155 + "Flags used by the compiler during Release with Debug Info builds." 1.156 + FORCE) 1.157 + SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING 1.158 + "Flags used by the compiler during release minsize builds." 1.159 + FORCE) 1.160 + SET(CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -DNDEBUG" CACHE STRING 1.161 + "Flags used by the compiler during release builds" 1.162 + FORCE) 1.163 + SET(CMAKE_C_FLAGS_DEBUG "-g3 -D_DEBUG" CACHE STRING 1.164 + "Flags used by the compiler during debug builds." 1.165 + FORCE) 1.166 + 1.167 + CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor)); 1.168 + int main() {return 0;}" HAVE_GCC_DESTRUCTOR) 1.169 +ENDIF() 1.170 + 1.171 +# Set visibility/export options if available 1.172 +IF(WIN32) 1.173 + SET(EXPORT_DECL "__declspec(dllexport)") 1.174 + 1.175 + OPTION(WINE "Enable use of Wine headers when compiling" OFF) 1.176 + IF(WINE) 1.177 + FIND_PATH(WINE_INCLUDE_DIR library.h 1.178 + PATHS 1.179 + /usr/include/wine 1.180 + /usr/local/include/wine 1.181 + CMAKE_FIND_ROOT_PATH_BOTH) 1.182 + IF(WINE_INCLUDE_DIR) 1.183 + MESSAGE(STATUS "Found Wine header files - ${WINE_INCLUDE_DIR}" ) 1.184 + INCLUDE_DIRECTORIES("${WINE_INCLUDE_DIR}/windows") 1.185 + SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${WINE_INCLUDE_DIR}/windows") 1.186 + ELSE() 1.187 + MESSAGE(STATUS "Could not find Wine header files" ) 1.188 + ENDIF() 1.189 + ENDIF() 1.190 +ELSE() 1.191 + CHECK_C_COMPILER_FLAG(-fvisibility=internal HAVE_VISIBILITY_SWITCH) 1.192 + CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\"))); 1.193 + int main() {return 0;}" HAVE_GCC_VISIBILITY) 1.194 + IF(HAVE_VISIBILITY_SWITCH AND HAVE_GCC_VISIBILITY) 1.195 + #ADD_DEFINITIONS(-fvisibility=internal) 1.196 + #SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))") 1.197 + ENDIF() 1.198 +ENDIF() 1.199 + 1.200 +CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2))); 1.201 + int main() {return 0;}" HAVE_GCC_FORMAT) 1.202 + 1.203 +CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H) 1.204 +CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H) 1.205 +CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H) 1.206 +CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H) 1.207 +IF(NOT HAVE_GUIDDEF_H) 1.208 + CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H) 1.209 +ENDIF() 1.210 +CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H) 1.211 + 1.212 +CHECK_LIBRARY_EXISTS(m powf "" HAVE_POWF) 1.213 +CHECK_LIBRARY_EXISTS(m sqrtf "" HAVE_SQRTF) 1.214 +CHECK_LIBRARY_EXISTS(m acosf "" HAVE_ACOSF) 1.215 +CHECK_LIBRARY_EXISTS(m atanf "" HAVE_ATANF) 1.216 +CHECK_LIBRARY_EXISTS(m fabsf "" HAVE_FABSF) 1.217 +IF(HAVE_FENV_H) 1.218 + CHECK_LIBRARY_EXISTS(m fesetround "" HAVE_FESETROUND) 1.219 +ENDIF() 1.220 +IF(HAVE_SQRTF OR HAVE_ACOSF OR HAVE_ATANF OR HAVE_FABSF OR HAVE_FESETROUND) 1.221 + SET(EXTRA_LIBS m ${EXTRA_LIBS}) 1.222 +ENDIF() 1.223 +CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF) 1.224 +CHECK_FUNCTION_EXISTS(_controlfp HAVE__CONTROLFP) 1.225 + 1.226 +CHECK_FUNCTION_EXISTS(stat HAVE_STAT) 1.227 +CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP) 1.228 +IF(NOT HAVE_STRCASECMP) 1.229 + CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP) 1.230 + IF(NOT HAVE__STRICMP) 1.231 + MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!") 1.232 + ENDIF() 1.233 + 1.234 + ADD_DEFINITIONS(-Dstrcasecmp=_stricmp) 1.235 +ENDIF() 1.236 + 1.237 +CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP) 1.238 +IF(NOT HAVE_STRNCASECMP) 1.239 + CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP) 1.240 + IF(NOT HAVE__STRNICMP) 1.241 + MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!") 1.242 + ENDIF() 1.243 + 1.244 + ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp) 1.245 +ENDIF() 1.246 + 1.247 +CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF) 1.248 +IF(NOT HAVE_SNPRINTF) 1.249 + CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF) 1.250 + IF(NOT HAVE__SNPRINTF) 1.251 + MESSAGE(FATAL_ERROR "No snprintf function found, please report!") 1.252 + ENDIF() 1.253 + 1.254 + ADD_DEFINITIONS(-Dsnprintf=_snprintf) 1.255 +ENDIF() 1.256 + 1.257 +CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF) 1.258 +IF(NOT HAVE_VSNPRINTF) 1.259 + CHECK_FUNCTION_EXISTS(_vsnprintf HAVE__VSNPRINTF) 1.260 + IF(NOT HAVE__VSNPRINTF) 1.261 + MESSAGE(FATAL_ERROR "No vsnprintf function found, please report!") 1.262 + ENDIF() 1.263 + 1.264 + ADD_DEFINITIONS(-Dvsnprintf=_vsnprintf) 1.265 +ENDIF() 1.266 + 1.267 +CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE) 1.268 +IF(NOT HAVE_ISFINITE) 1.269 + CHECK_FUNCTION_EXISTS(finite HAVE_FINITE) 1.270 + IF(NOT HAVE_FINITE) 1.271 + CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE) 1.272 + IF(NOT HAVE__FINITE) 1.273 + MESSAGE(FATAL_ERROR "No isfinite function found, please report!") 1.274 + ENDIF() 1.275 + ADD_DEFINITIONS(-Disfinite=_finite) 1.276 + ELSE() 1.277 + ADD_DEFINITIONS(-Disfinite=finite) 1.278 + ENDIF() 1.279 +ENDIF() 1.280 + 1.281 +CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN) 1.282 +IF(NOT HAVE_ISNAN) 1.283 + CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN) 1.284 + IF(NOT HAVE__ISNAN) 1.285 + MESSAGE(FATAL_ERROR "No isnan function found, please report!") 1.286 + ENDIF() 1.287 + 1.288 + ADD_DEFINITIONS(-Disnan=_isnan) 1.289 +ENDIF() 1.290 + 1.291 + 1.292 +# Check for the dlopen API (for dynamicly loading backend libs) 1.293 +IF(DLOPEN) 1.294 + CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H) 1.295 + IF(HAVE_DLFCN_H) 1.296 + CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL) 1.297 + IF(HAVE_LIBDL) 1.298 + SET(EXTRA_LIBS dl ${EXTRA_LIBS}) 1.299 + ENDIF() 1.300 + ENDIF() 1.301 +ENDIF() 1.302 + 1.303 +# Check if we have Windows headers 1.304 +CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0500) 1.305 +IF(NOT HAVE_WINDOWS_H) 1.306 + CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) 1.307 + IF(NOT HAVE_GETTIMEOFDAY) 1.308 + MESSAGE(FATAL_ERROR "No timing function found!") 1.309 + ENDIF() 1.310 + 1.311 + CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP) 1.312 + IF(NOT HAVE_NANOSLEEP) 1.313 + MESSAGE(FATAL_ERROR "No sleep function found!") 1.314 + ENDIF() 1.315 + 1.316 + CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD) 1.317 + IF(HAVE_PTHREAD) 1.318 + ADD_DEFINITIONS(-pthread) 1.319 + SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread) 1.320 + ENDIF() 1.321 + 1.322 + # We need pthreads outside of Windows 1.323 + CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H) 1.324 + IF(NOT HAVE_PTHREAD_H) 1.325 + MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!") 1.326 + ENDIF() 1.327 + # Some systems need pthread_np.h to get recursive mutexes 1.328 + CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H) 1.329 + 1.330 + # _GNU_SOURCE is needed on some systems for extra attributes, and 1.331 + # _REENTRANT is needed for libc thread-safety 1.332 + ADD_DEFINITIONS(-D_GNU_SOURCE=1) 1.333 + CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD) 1.334 + IF(HAVE_LIBPTHREAD) 1.335 + SET(EXTRA_LIBS pthread ${EXTRA_LIBS}) 1.336 + ENDIF() 1.337 + 1.338 + CHECK_LIBRARY_EXISTS(pthread pthread_setschedparam "" HAVE_PTHREAD_SETSCHEDPARAM) 1.339 + 1.340 + CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT) 1.341 + IF(HAVE_LIBRT) 1.342 + SET(EXTRA_LIBS rt ${EXTRA_LIBS}) 1.343 + ENDIF() 1.344 +ENDIF() 1.345 + 1.346 +# Check for a 64-bit type 1.347 +CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) 1.348 +IF(NOT HAVE_STDINT_H) 1.349 + IF(HAVE_WINDOWS_H) 1.350 + CHECK_C_SOURCE_COMPILES("\#define _WIN32_WINNT 0x0500 1.351 + \#include <windows.h> 1.352 + __int64 foo; 1.353 + int main() {return 0;}" HAVE___INT64) 1.354 + ENDIF() 1.355 + IF(NOT HAVE___INT64) 1.356 + IF(NOT SIZEOF_LONG MATCHES "8") 1.357 + IF(NOT SIZEOF_LONG_LONG MATCHES "8") 1.358 + MESSAGE(FATAL_ERROR "No 64-bit types found, please report!") 1.359 + ENDIF() 1.360 + ENDIF() 1.361 + ENDIF() 1.362 +ENDIF() 1.363 + 1.364 +# Windows needs winmm for timeGetTime, even if the backend is disabled 1.365 +CHECK_SHARED_FUNCTION_EXISTS(timeGetTime "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM) 1.366 +IF(HAVE_LIBWINMM) 1.367 + SET(EXTRA_LIBS winmm ${EXTRA_LIBS}) 1.368 + SET(PKG_CONFIG_LIBS ${PKG_CONFIG_LIBS} -lwinmm) 1.369 +ENDIF() 1.370 + 1.371 + 1.372 +SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c 1.373 + OpenAL32/alBuffer.c 1.374 + OpenAL32/alEffect.c 1.375 + OpenAL32/alError.c 1.376 + OpenAL32/alExtension.c 1.377 + OpenAL32/alFilter.c 1.378 + OpenAL32/alListener.c 1.379 + OpenAL32/alSource.c 1.380 + OpenAL32/alState.c 1.381 + OpenAL32/alThunk.c 1.382 +) 1.383 +SET(ALC_OBJS Alc/ALc.c 1.384 + Alc/ALu.c 1.385 + Alc/alcConfig.c 1.386 + Alc/alcDedicated.c 1.387 + Alc/alcEcho.c 1.388 + Alc/alcModulator.c 1.389 + Alc/alcReverb.c 1.390 + Alc/alcRing.c 1.391 + Alc/alcThread.c 1.392 + Alc/bs2b.c 1.393 + Alc/helpers.c 1.394 + Alc/hrtf.c 1.395 + Alc/mixer.c 1.396 + Alc/panning.c 1.397 + # Default backends, always available 1.398 + Alc/backends/loopback.c 1.399 + Alc/backends/null.c 1.400 + # RLM: add send device 1.401 + Alc/backends/send.c 1.402 +) 1.403 + 1.404 +SET(BACKENDS "") 1.405 +SET(HAVE_ALSA 0) 1.406 +SET(HAVE_OSS 0) 1.407 +SET(HAVE_SOLARIS 0) 1.408 +SET(HAVE_SNDIO 0) 1.409 +SET(HAVE_DSOUND 0) 1.410 +SET(HAVE_WINMM 0) 1.411 +SET(HAVE_PORTAUDIO 0) 1.412 +SET(HAVE_PULSEAUDIO 0) 1.413 +SET(HAVE_COREAUDIO 0) 1.414 +SET(HAVE_OPENSL 0) 1.415 +SET(HAVE_WAVE 0) 1.416 + 1.417 + 1.418 +# Check ALSA backend 1.419 +IF(ALSA) 1.420 + CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ALSA_ASOUNDLIB_H) 1.421 + IF(HAVE_ALSA_ASOUNDLIB_H) 1.422 + CHECK_SHARED_FUNCTION_EXISTS(snd_pcm_open "alsa/asoundlib.h" asound "" HAVE_LIBASOUND) 1.423 + IF(HAVE_LIBASOUND OR HAVE_DLFCN_H OR WIN32) 1.424 + SET(HAVE_ALSA 1) 1.425 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c) 1.426 + IF(HAVE_DLFCN_H OR WIN32) 1.427 + SET(BACKENDS "${BACKENDS} ALSA,") 1.428 + ELSE() 1.429 + SET(BACKENDS "${BACKENDS} ALSA \(linked\),") 1.430 + SET(EXTRA_LIBS asound ${EXTRA_LIBS}) 1.431 + ENDIF() 1.432 + ENDIF() 1.433 + ENDIF() 1.434 +ENDIF() 1.435 +IF(REQUIRE_ALSA AND NOT HAVE_ALSA) 1.436 + MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend") 1.437 +ENDIF() 1.438 + 1.439 +# Check OSS backend 1.440 +IF(OSS) 1.441 + CHECK_INCLUDE_FILE(sys/soundcard.h HAVE_SYS_SOUNDCARD_H) 1.442 + IF(HAVE_SYS_SOUNDCARD_H) 1.443 + SET(HAVE_OSS 1) 1.444 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c) 1.445 + SET(BACKENDS "${BACKENDS} OSS,") 1.446 + ENDIF() 1.447 +ENDIF() 1.448 +IF(REQUIRE_OSS AND NOT HAVE_OSS) 1.449 + MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend") 1.450 +ENDIF() 1.451 + 1.452 +# Check Solaris backend 1.453 +IF(SOLARIS) 1.454 + CHECK_INCLUDE_FILE(sys/audioio.h HAVE_SYS_AUDIOIO_H) 1.455 + IF(HAVE_SYS_AUDIOIO_H) 1.456 + SET(HAVE_SOLARIS 1) 1.457 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c) 1.458 + SET(BACKENDS "${BACKENDS} Solaris,") 1.459 + ENDIF() 1.460 +ENDIF() 1.461 +IF(REQUIRE_SOLARIS AND NOT HAVE_SOLARIS) 1.462 + MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend") 1.463 +ENDIF() 1.464 + 1.465 +# Check SndIO backend 1.466 +IF(SNDIO) 1.467 + CHECK_INCLUDE_FILE(sndio.h HAVE_SNDIO_H) 1.468 + IF(HAVE_SNDIO_H) 1.469 + CHECK_SHARED_FUNCTION_EXISTS(sio_open "sndio.h" sndio "" HAVE_LIBSNDIO) 1.470 + IF(HAVE_LIBSNDIO OR HAVE_DLFCN_H OR WIN32) 1.471 + SET(HAVE_SNDIO 1) 1.472 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c) 1.473 + IF(HAVE_DLFCN_H OR WIN32) 1.474 + SET(BACKENDS "${BACKENDS} SndIO,") 1.475 + ELSE() 1.476 + SET(BACKENDS "${BACKENDS} SndIO \(linked\),") 1.477 + SET(EXTRA_LIBS sndio ${EXTRA_LIBS}) 1.478 + ENDIF() 1.479 + ENDIF() 1.480 + ENDIF() 1.481 +ENDIF() 1.482 +IF(REQUIRE_SNDIO AND NOT HAVE_SNDIO) 1.483 + MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend") 1.484 +ENDIF() 1.485 + 1.486 +# Check for MMDevApi backend 1.487 +IF(HAVE_WINDOWS_H) 1.488 + IF(MMDEVAPI) 1.489 + CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H) 1.490 + IF(HAVE_MMDEVICEAPI_H) 1.491 + SET(HAVE_MMDEVAPI 1) 1.492 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c) 1.493 + 1.494 + SET(BACKENDS "${BACKENDS} MMDevApi,") 1.495 + ENDIF() 1.496 + ENDIF() 1.497 +ENDIF() 1.498 +IF(REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI) 1.499 + MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend") 1.500 +ENDIF() 1.501 + 1.502 +# Check DSound/MMSystem backend 1.503 +IF(DSOUND) 1.504 + CHECK_INCLUDE_FILE(dsound.h HAVE_DSOUND_H) 1.505 + IF(HAVE_DSOUND_H) 1.506 + CHECK_SHARED_FUNCTION_EXISTS(DirectSoundCreate "dsound.h" dsound "" HAVE_LIBDSOUND) 1.507 + IF(HAVE_LIBDSOUND OR HAVE_DLFCN_H OR WIN32) 1.508 + SET(HAVE_DSOUND 1) 1.509 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) 1.510 + 1.511 + IF(HAVE_DLFCN_H OR WIN32) 1.512 + SET(BACKENDS "${BACKENDS} DirectSound,") 1.513 + ELSE() 1.514 + SET(BACKENDS "${BACKENDS} DirectSound \(linked\),") 1.515 + SET(EXTRA_LIBS dsound ${EXTRA_LIBS}) 1.516 + ENDIF() 1.517 + ENDIF() 1.518 + ENDIF() 1.519 +ENDIF() 1.520 +IF(REQUIRE_DSOUND AND NOT HAVE_DSOUND) 1.521 + MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend") 1.522 +ENDIF() 1.523 + 1.524 +IF(HAVE_WINDOWS_H) 1.525 + IF(WINMM) 1.526 + CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0500) 1.527 + IF(HAVE_MMSYSTEM_H AND HAVE_LIBWINMM) 1.528 + SET(HAVE_WINMM 1) 1.529 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c) 1.530 + SET(BACKENDS "${BACKENDS} WinMM,") 1.531 + ENDIF() 1.532 + ENDIF() 1.533 +ENDIF() 1.534 +IF(REQUIRE_WINMM AND NOT HAVE_WINMM) 1.535 + MESSAGE(FATAL_ERROR "Failed to enable required WinMM backend") 1.536 +ENDIF() 1.537 + 1.538 +# Check PortAudio backend 1.539 +IF(PORTAUDIO) 1.540 + CHECK_INCLUDE_FILE(portaudio.h HAVE_PORTAUDIO_H) 1.541 + IF(HAVE_PORTAUDIO_H) 1.542 + CHECK_SHARED_FUNCTION_EXISTS(Pa_Initialize "portaudio.h" portaudio "" HAVE_LIBPORTAUDIO) 1.543 + IF(HAVE_LIBPORTAUDIO OR HAVE_DLFCN_H OR WIN32) 1.544 + SET(HAVE_PORTAUDIO 1) 1.545 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c) 1.546 + IF(HAVE_DLFCN_H OR WIN32) 1.547 + SET(BACKENDS "${BACKENDS} PortAudio,") 1.548 + ELSE() 1.549 + SET(BACKENDS "${BACKENDS} PortAudio \(linked\),") 1.550 + SET(EXTRA_LIBS portaudio ${EXTRA_LIBS}) 1.551 + ENDIF() 1.552 + ENDIF() 1.553 + ENDIF() 1.554 +ENDIF() 1.555 +IF(REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO) 1.556 + MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend") 1.557 +ENDIF() 1.558 + 1.559 +# Check PulseAudio backend 1.560 +IF(PULSEAUDIO) 1.561 + CHECK_INCLUDE_FILE(pulse/pulseaudio.h HAVE_PULSE_PULSEAUDIO_H) 1.562 + IF(HAVE_PULSE_PULSEAUDIO_H) 1.563 + CHECK_SHARED_FUNCTION_EXISTS(pa_context_new "pulse/pulseaudio.h" pulse "" HAVE_LIBPULSE) 1.564 + IF(HAVE_LIBPULSE OR HAVE_DLFCN_H OR WIN32) 1.565 + SET(HAVE_PULSEAUDIO 1) 1.566 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c) 1.567 + IF(HAVE_DLFCN_H OR WIN32) 1.568 + SET(BACKENDS "${BACKENDS} PulseAudio,") 1.569 + ELSE() 1.570 + SET(BACKENDS "${BACKENDS} PulseAudio \(linked\),") 1.571 + SET(EXTRA_LIBS pulse ${EXTRA_LIBS}) 1.572 + ENDIF() 1.573 + ENDIF() 1.574 + ENDIF() 1.575 +ENDIF() 1.576 +IF(REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO) 1.577 + MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend") 1.578 +ENDIF() 1.579 + 1.580 +# Check CoreAudio backend 1.581 +IF(COREAUDIO) 1.582 + CHECK_INCLUDE_FILE(/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h HAVE_COREAUDIO_FRAMEWORK) 1.583 + IF(HAVE_COREAUDIO_FRAMEWORK) 1.584 + SET(HAVE_COREAUDIO 1) 1.585 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c) 1.586 + SET(BACKENDS "${BACKENDS} CoreAudio,") 1.587 + SET(EXTRA_LIBS /System/Library/Frameworks/CoreAudio.framework ${EXTRA_LIBS}) 1.588 + SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS}) 1.589 + SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS}) 1.590 + ENDIF() 1.591 +ENDIF() 1.592 +IF(REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO) 1.593 + MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend") 1.594 +ENDIF() 1.595 + 1.596 +# Check for OpenSL (Android) backend 1.597 +IF(OPENSL) 1.598 + CHECK_INCLUDE_FILE(SLES/OpenSLES_Android.h HAVE_SLES_OPENSLES_ANDROID_H) 1.599 + IF(HAVE_SLES_OPENSLES_ANDROID_H) 1.600 + CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES) 1.601 + IF(HAVE_LIBOPENSLES) 1.602 + SET(HAVE_OPENSL 1) 1.603 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c) 1.604 + SET(BACKENDS "${BACKENDS} OpenSL,") 1.605 + SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS}) 1.606 + ENDIF() 1.607 + ENDIF() 1.608 +ENDIF() 1.609 +IF(REQUIRE_OPENSL AND NOT HAVE_OPENSL) 1.610 + MESSAGE(FATAL_ERROR "Failed to enable required OpenSL backend") 1.611 +ENDIF() 1.612 + 1.613 +# Optionally enable the Wave Writer backend 1.614 +IF(WAVE) 1.615 + SET(HAVE_WAVE 1) 1.616 + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c) 1.617 + SET(BACKENDS "${BACKENDS} WaveFile,") 1.618 +ENDIF() 1.619 + 1.620 + 1.621 +SET(ALC_OBJS ${ALC_OBJS} Alc/backends/send.c) 1.622 +SET(BACKENDS "${BACKENDS} Send,") 1.623 + 1.624 + 1.625 +# This is always available 1.626 +SET(BACKENDS "${BACKENDS} Null") 1.627 + 1.628 +IF(LIBTYPE STREQUAL "STATIC") 1.629 + ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC) 1.630 + SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS}) 1.631 +ENDIF() 1.632 + 1.633 +# Needed for openal.pc.in 1.634 +SET(prefix ${CMAKE_INSTALL_PREFIX}) 1.635 +SET(exec_prefix "\${prefix}") 1.636 +SET(libdir "\${exec_prefix}/lib${LIB_SUFFIX}") 1.637 +SET(bindir "\${exec_prefix}/bin") 1.638 +SET(includedir "\${prefix}/include") 1.639 +SET(PACKAGE_VERSION "${LIB_VERSION}") 1.640 + 1.641 +# End configuration 1.642 +CONFIGURE_FILE( 1.643 + "${OpenAL_SOURCE_DIR}/config.h.in" 1.644 + "${OpenAL_BINARY_DIR}/config.h") 1.645 +CONFIGURE_FILE( 1.646 + "${OpenAL_SOURCE_DIR}/openal.pc.in" 1.647 + "${OpenAL_BINARY_DIR}/openal.pc" 1.648 + @ONLY) 1.649 + 1.650 +# Build a library 1.651 +ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS}) 1.652 +SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES DEFINE_SYMBOL AL_BUILD_LIBRARY 1.653 + COMPILE_FLAGS -DAL_ALEXT_PROTOTYPES 1.654 + VERSION ${LIB_VERSION}.0 1.655 + SOVERSION ${LIB_MAJOR_VERSION}) 1.656 +IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") 1.657 + SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "") 1.658 +ENDIF() 1.659 + 1.660 +# RLM link jni the dumb way for now: 1.661 + 1.662 +INCLUDE_DIRECTORIES("/opt/jdk/include/") 1.663 +INCLUDE_DIRECTORIES("/opt/jdk/include/linux") 1.664 +TARGET_LINK_LIBRARIES(${LIBNAME} ${EXTRA_LIBS}) 1.665 + 1.666 +# Add an install target here 1.667 +INSTALL(TARGETS ${LIBNAME} 1.668 + RUNTIME DESTINATION bin 1.669 + LIBRARY DESTINATION "lib${LIB_SUFFIX}" 1.670 + ARCHIVE DESTINATION "lib${LIB_SUFFIX}" 1.671 +) 1.672 +INSTALL(FILES include/AL/al.h 1.673 + include/AL/alc.h 1.674 + include/AL/alext.h 1.675 + include/AL/efx.h 1.676 + include/AL/efx-creative.h 1.677 + DESTINATION include/AL 1.678 +) 1.679 +INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc" 1.680 + DESTINATION "lib${LIB_SUFFIX}/pkgconfig") 1.681 + 1.682 + 1.683 +MESSAGE(STATUS "") 1.684 +MESSAGE(STATUS "Building OpenAL with support for the following backends:") 1.685 +MESSAGE(STATUS " ${BACKENDS}") 1.686 +MESSAGE(STATUS "") 1.687 + 1.688 +IF(WIN32) 1.689 + IF(NOT HAVE_DSOUND) 1.690 + MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output") 1.691 + MESSAGE(STATUS " This is probably NOT what you want!") 1.692 + MESSAGE(STATUS "") 1.693 + ENDIF() 1.694 +ENDIF() 1.695 + 1.696 +# Install alsoft.conf configuration file 1.697 +IF(ALSOFT_CONFIG) 1.698 + INSTALL(FILES alsoftrc.sample 1.699 + DESTINATION /etc/openal 1.700 + RENAME alsoft.conf 1.701 + ) 1.702 + MESSAGE(STATUS "Installing sample alsoft.conf") 1.703 + MESSAGE(STATUS "") 1.704 +ENDIF() 1.705 + 1.706 +IF(UTILS) 1.707 + ADD_EXECUTABLE(openal-info utils/openal-info.c) 1.708 + TARGET_LINK_LIBRARIES(openal-info ${LIBNAME}) 1.709 + INSTALL(TARGETS openal-info 1.710 + RUNTIME DESTINATION bin 1.711 + LIBRARY DESTINATION "lib${LIB_SUFFIX}" 1.712 + ARCHIVE DESTINATION "lib${LIB_SUFFIX}" 1.713 + ) 1.714 + MESSAGE(STATUS "Building utility programs") 1.715 + MESSAGE(STATUS "") 1.716 +ENDIF() 1.717 + 1.718 +