Mercurial > audio-send
view CMakeLists-works.txt @ 6:99df34265b40
disabled the user's ability to select backend since there is only one backend
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 13:25:47 -0700 |
parents | f9476ff7637e |
children |
line wrap: on
line source
1 # CMake build file list for OpenAL3 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)5 IF(COMMAND CMAKE_POLICY)6 CMAKE_POLICY(SET CMP0003 NEW)7 ENDIF(COMMAND CMAKE_POLICY)9 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")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)22 PROJECT(OpenAL C)25 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)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)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)54 OPTION(DLOPEN "Check for the dlopen API for loading optional libs" ON)56 OPTION(WERROR "Treat compile warnings as errors" OFF)58 OPTION(UTILS "Build and install utility programs" ON)60 OPTION(ALSOFT_CONFIG "Install alsoft.conf configuration file" OFF)63 SET(LIBNAME openal)65 SET(LIBTYPE SHARED)67 SET(LIB_MAJOR_VERSION "1")68 SET(LIB_MINOR_VERSION "13")69 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}")71 SET(EXPORT_DECL "")74 # Add definitions, compiler switches, etc.75 INCLUDE_DIRECTORIES(OpenAL32/Include include "${OpenAL_BINARY_DIR}")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()83 IF(WERROR)84 ADD_DEFINITIONS(-Werror)85 ENDIF()87 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -D_DEBUG" CACHE STRING88 "Flags used by the compiler during Release with Debug Info builds."89 FORCE)90 SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING91 "Flags used by the compiler during release minsize builds."92 FORCE)93 SET(CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -DNDEBUG" CACHE STRING94 "Flags used by the compiler during release builds"95 FORCE)96 SET(CMAKE_C_FLAGS_DEBUG "-g3 -D_DEBUG" CACHE STRING97 "Flags used by the compiler during debug builds."98 FORCE)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)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)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()131 ADD_DEFINITIONS(-Dstrcasecmp=_stricmp)132 ENDIF()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()141 ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp)142 ENDIF()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()151 ADD_DEFINITIONS(-Dsnprintf=_snprintf)152 ENDIF()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()161 ADD_DEFINITIONS(-Dvsnprintf=_vsnprintf)162 ENDIF()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()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()185 ADD_DEFINITIONS(-Disnan=_isnan)186 ENDIF()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()200 # Check if we have Windows headers201 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()208 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)209 IF(NOT HAVE_NANOSLEEP)210 MESSAGE(FATAL_ERROR "No sleep function found!")211 ENDIF()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()219 # We need pthreads outside of Windows220 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 mutexes225 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)227 # _GNU_SOURCE is needed on some systems for extra attributes, and228 # _REENTRANT is needed for libc thread-safety229 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()235 CHECK_LIBRARY_EXISTS(pthread pthread_setschedparam "" HAVE_PTHREAD_SETSCHEDPARAM)237 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)238 IF(HAVE_LIBRT)239 SET(EXTRA_LIBS rt ${EXTRA_LIBS})240 ENDIF()241 ENDIF()243 # Check for a 64-bit type244 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 0x0500248 \#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()261 # Windows needs winmm for timeGetTime, even if the backend is disabled262 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()269 SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c270 OpenAL32/alBuffer.c271 OpenAL32/alEffect.c272 OpenAL32/alError.c273 OpenAL32/alExtension.c274 OpenAL32/alFilter.c275 OpenAL32/alListener.c276 OpenAL32/alSource.c277 OpenAL32/alState.c278 OpenAL32/alThunk.c279 )280 SET(ALC_OBJS Alc/ALc.c281 Alc/ALu.c282 Alc/alcConfig.c283 Alc/alcDedicated.c284 Alc/alcEcho.c285 Alc/alcModulator.c286 Alc/alcReverb.c287 Alc/alcRing.c288 Alc/alcThread.c289 Alc/bs2b.c290 Alc/helpers.c291 Alc/hrtf.c292 Alc/mixer.c293 Alc/panning.c294 # Default backends, always available295 Alc/backends/loopback.c296 Alc/backends/null.c297 # RLM: add record device298 Alc/backends/record.c299 )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)315 # Check for MMDevApi backend316 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)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()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()346 # Optionally enable the Wave Writer backend347 IF(WAVE)348 SET(HAVE_WAVE 1)349 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c)350 SET(BACKENDS "${BACKENDS} WaveFile,")351 ENDIF()354 # RLM: enable the record backend355 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/record.c)356 SET(BACKENDS "${BACKENDS} Record,")359 # This is always available360 SET(BACKENDS "${BACKENDS} Null")362 # Needed for openal.pc.in363 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}")370 # End configuration371 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)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")385 # Build a library386 ADD_LIBRARY(${LIBNAME} SHARED ${OPENAL_OBJS} ${ALC_OBJS})387 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES DEFINE_SYMBOL AL_BUILD_LIBRARY388 COMPILE_FLAGS -DAL_ALEXT_PROTOTYPES389 VERSION ${LIB_VERSION}.0390 SOVERSION ${LIB_MAJOR_VERSION})393 TARGET_LINK_LIBRARIES(${LIBNAME} ${EXTRA_LIBS})395 # Add an install target here396 INSTALL(TARGETS ${LIBNAME}397 RUNTIME DESTINATION bin398 LIBRARY DESTINATION "lib${LIB_SUFFIX}"399 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"400 )401 INSTALL(FILES include/AL/al.h402 include/AL/alc.h403 include/AL/alext.h404 include/AL/efx.h405 include/AL/efx-creative.h406 DESTINATION include/AL407 )408 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"409 DESTINATION "lib${LIB_SUFFIX}/pkgconfig")412 MESSAGE(STATUS "")413 MESSAGE(STATUS "Building OpenAL with support for the following backends:")414 MESSAGE(STATUS " ${BACKENDS}")415 MESSAGE(STATUS "")417 # Install alsoft.conf configuration file419 IF(UTILS)420 ADD_EXECUTABLE(openal-info utils/openal-info.c)421 TARGET_LINK_LIBRARIES(openal-info ${LIBNAME})422 INSTALL(TARGETS openal-info423 RUNTIME DESTINATION bin424 LIBRARY DESTINATION "lib${LIB_SUFFIX}"425 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"426 )427 MESSAGE(STATUS "Building utility programs")428 MESSAGE(STATUS "")429 ENDIF()