2007-11-14 02:02:18 +00:00
|
|
|
# CMake build file list for OpenAL
|
|
|
|
|
2008-07-22 18:26:56 +00:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
|
|
|
|
|
|
|
IF(COMMAND CMAKE_POLICY)
|
|
|
|
CMAKE_POLICY(SET CMP0003 NEW)
|
|
|
|
ENDIF(COMMAND CMAKE_POLICY)
|
|
|
|
|
2007-12-14 15:01:56 +00:00
|
|
|
INCLUDE(CheckFunctionExists)
|
2007-11-14 02:02:18 +00:00
|
|
|
INCLUDE(CheckLibraryExists)
|
|
|
|
INCLUDE(CheckIncludeFile)
|
2007-12-14 15:11:57 +00:00
|
|
|
INCLUDE(CheckIncludeFiles)
|
2007-11-14 02:02:18 +00:00
|
|
|
INCLUDE(CheckCCompilerFlag)
|
|
|
|
INCLUDE(CheckCSourceCompiles)
|
|
|
|
INCLUDE(CheckTypeSize)
|
|
|
|
|
|
|
|
|
2008-06-07 01:33:13 +00:00
|
|
|
PROJECT(OpenAL C)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
|
|
|
|
|
|
|
|
|
2008-01-15 20:30:20 +00:00
|
|
|
OPTION(ALSA "Check for ALSA backend" ON)
|
|
|
|
OPTION(OSS "Check for OSS backend" ON)
|
2008-09-07 21:34:14 +00:00
|
|
|
OPTION(SOLARIS "Check for Solaris backend" ON)
|
2008-01-15 20:30:20 +00:00
|
|
|
OPTION(DSOUND "Check for DirectSound backend" ON)
|
|
|
|
OPTION(WINMM "Check for Windows Multimedia backend" ON)
|
2008-12-07 09:05:39 +00:00
|
|
|
OPTION(SDL "Check for SDL backend" ON)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2008-01-15 20:30:20 +00:00
|
|
|
OPTION(DLOPEN "Check for the dlopen API for loading optional libs" ON)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2008-05-19 01:40:53 +00:00
|
|
|
OPTION(WERROR "Treat compile warnings as errors" OFF)
|
|
|
|
|
|
|
|
OPTION(EXAMPLES "Build example programs" ON)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
|
2008-12-12 19:19:38 +00:00
|
|
|
IF(WIN32)
|
2009-01-11 05:23:53 +00:00
|
|
|
SET(LIBNAME OpenAL32)
|
2008-11-14 07:13:15 +00:00
|
|
|
ADD_DEFINITIONS("-D_WIN32")
|
2008-07-23 18:58:36 +00:00
|
|
|
ELSE()
|
|
|
|
SET(LIBNAME openal)
|
|
|
|
ENDIF()
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(LIB_MAJOR_VERSION "1")
|
2008-11-21 17:16:29 +00:00
|
|
|
SET(LIB_MINOR_VERSION "6")
|
|
|
|
SET(LIB_BUILD_VERSION "372")
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_BUILD_VERSION}")
|
2008-06-07 01:39:18 +00:00
|
|
|
IF(NOT DEFINED LIB_INSTALL_DIR)
|
|
|
|
SET(LIB_INSTALL_DIR "lib")
|
|
|
|
ENDIF(NOT DEFINED LIB_INSTALL_DIR)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
|
|
|
|
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
|
|
|
|
CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT)
|
|
|
|
CHECK_TYPE_SIZE("void*" SIZEOF_VOIDP)
|
|
|
|
|
|
|
|
|
|
|
|
# Add definitions, compiler switches, etc.
|
|
|
|
INCLUDE_DIRECTORIES(OpenAL32/Include include "${OpenAL_BINARY_DIR}")
|
|
|
|
|
2008-01-15 18:00:56 +00:00
|
|
|
IF(NOT CMAKE_BUILD_TYPE)
|
|
|
|
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
|
|
|
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
|
|
|
|
FORCE)
|
|
|
|
ENDIF()
|
2008-12-02 10:37:51 +00:00
|
|
|
IF(NOT CMAKE_DEBUG_POSTFIX)
|
|
|
|
SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
|
|
|
|
"Library postfix for debug builds. Normally left blank."
|
|
|
|
FORCE)
|
|
|
|
ENDIF()
|
2008-01-15 18:00:56 +00:00
|
|
|
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(MSVC)
|
2007-11-14 02:02:18 +00:00
|
|
|
# ???
|
2008-01-15 18:00:56 +00:00
|
|
|
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_DEBUG")
|
|
|
|
SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG")
|
|
|
|
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
|
|
|
|
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
2007-11-14 02:02:18 +00:00
|
|
|
ELSE()
|
2007-12-07 07:57:14 +00:00
|
|
|
ADD_DEFINITIONS(-Wall)
|
|
|
|
CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
|
2008-12-07 10:20:17 +00:00
|
|
|
IF(HAVE_W_EXTRA)
|
2007-12-07 07:57:14 +00:00
|
|
|
ADD_DEFINITIONS(-Wextra)
|
2007-12-07 05:50:28 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
IF(WERROR)
|
|
|
|
ADD_DEFINITIONS(-Werror)
|
|
|
|
ENDIF()
|
2007-12-07 07:57:14 +00:00
|
|
|
|
2008-01-15 18:00:56 +00:00
|
|
|
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -funroll-loops -D_DEBUG" CACHE STRING
|
|
|
|
"Flags used by the compiler during Release with Debug Info builds."
|
|
|
|
FORCE)
|
|
|
|
SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING
|
|
|
|
"Flags used by the compiler during release minsize builds."
|
|
|
|
FORCE)
|
|
|
|
SET(CMAKE_C_FLAGS_RELEASE "-O2 -funroll-loops -fomit-frame-pointer -DNDEBUG" CACHE STRING
|
|
|
|
"Flags used by the compiler during release builds"
|
|
|
|
FORCE)
|
|
|
|
SET(CMAKE_C_FLAGS_DEBUG "-g3 -D_DEBUG" CACHE STRING
|
|
|
|
"Flags used by the compiler during debug builds."
|
|
|
|
FORCE)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
# Set visibility options if available
|
2008-12-12 19:19:38 +00:00
|
|
|
IF(NOT WIN32)
|
2007-11-16 09:27:02 +00:00
|
|
|
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
|
|
|
|
int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
|
|
|
|
|
2007-12-01 08:57:48 +00:00
|
|
|
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_SWITCH)
|
2008-12-07 10:20:17 +00:00
|
|
|
IF(HAVE_VISIBILITY_SWITCH)
|
2007-12-01 08:57:48 +00:00
|
|
|
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
|
|
|
|
int main() {return 0;}" HAVE_GCC_VISIBILITY)
|
2008-12-07 10:20:17 +00:00
|
|
|
IF(HAVE_GCC_VISIBILITY)
|
2007-12-01 08:57:48 +00:00
|
|
|
ADD_DEFINITIONS(-fvisibility=hidden -DHAVE_GCC_VISIBILITY)
|
|
|
|
ENDIF()
|
2007-11-14 02:02:18 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2008-08-08 15:12:41 +00:00
|
|
|
CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
|
2008-10-14 16:47:32 +00:00
|
|
|
CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
|
2007-11-30 09:16:57 +00:00
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
CHECK_LIBRARY_EXISTS(m sqrtf "" HAVE_SQRTF)
|
2008-01-16 05:23:14 +00:00
|
|
|
CHECK_LIBRARY_EXISTS(m acosf "" HAVE_ACOSF)
|
2008-08-08 15:12:41 +00:00
|
|
|
IF(HAVE_FENV_H)
|
|
|
|
CHECK_LIBRARY_EXISTS(m fesetround "" HAVE_FESETROUND)
|
|
|
|
ENDIF()
|
2008-08-08 14:32:21 +00:00
|
|
|
IF(HAVE_SQRTF OR HAVE_ACOSF OR HAVE_FESETROUND)
|
2007-12-24 00:28:09 +00:00
|
|
|
SET(EXTRA_LIBS m ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
2007-12-14 15:01:56 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
|
2008-08-08 14:32:21 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(_controlfp HAVE__CONTROLFP)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2007-12-14 15:01:56 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE_STRCASECMP)
|
2007-12-14 15:01:56 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE__STRICMP)
|
2007-11-14 02:02:18 +00:00
|
|
|
MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ADD_DEFINITIONS(-Dstrcasecmp=_stricmp)
|
|
|
|
ENDIF()
|
|
|
|
|
2008-01-15 00:30:18 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE_STRNCASECMP)
|
2008-01-15 00:30:18 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE__STRNICMP)
|
2008-01-15 00:30:18 +00:00
|
|
|
MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp)
|
|
|
|
ENDIF()
|
|
|
|
|
2007-12-22 21:35:52 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE_SNPRINTF)
|
2007-12-22 21:35:52 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE__SNPRINTF)
|
2007-12-22 21:35:52 +00:00
|
|
|
MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ADD_DEFINITIONS(-Dsnprintf=_snprintf)
|
|
|
|
ENDIF()
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
# Check for the dlopen API (for dynamicly loading backend libs)
|
|
|
|
IF(DLOPEN)
|
|
|
|
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(HAVE_DLFCN_H)
|
2007-11-14 02:02:18 +00:00
|
|
|
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(HAVE_LIBDL)
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(EXTRA_LIBS dl ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# Check if we have Windows headers
|
2008-03-01 09:39:42 +00:00
|
|
|
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0500)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE_WINDOWS_H)
|
2008-01-11 14:01:51 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE_GETTIMEOFDAY)
|
2008-01-11 14:01:51 +00:00
|
|
|
MESSAGE(FATAL_ERROR "No timing function found!")
|
|
|
|
ENDIF()
|
|
|
|
|
2008-01-11 16:15:44 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE_NANOSLEEP)
|
2008-01-11 14:54:09 +00:00
|
|
|
MESSAGE(FATAL_ERROR "No sleep function found!")
|
|
|
|
ENDIF()
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
# We need pthreads outside of Windows
|
|
|
|
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE_PTHREAD_H)
|
2007-11-14 02:02:18 +00:00
|
|
|
MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
|
|
|
|
ENDIF()
|
|
|
|
|
2008-05-16 04:35:51 +00:00
|
|
|
# Some systems need pthread_np.h to get recursive mutexes
|
|
|
|
CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
# _GNU_SOURCE is needed on some systems for extra attributes, and
|
|
|
|
# _REENTRANT is needed for libc thread-safety
|
|
|
|
ADD_DEFINITIONS(-D_GNU_SOURCE=1 -D_REENTRANT)
|
|
|
|
CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(HAVE_LIBPTHREAD)
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# Check for a 64-bit type
|
|
|
|
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE_STDINT_H)
|
|
|
|
IF(HAVE_WINDOWS_H)
|
2008-03-01 09:39:42 +00:00
|
|
|
CHECK_C_SOURCE_COMPILES("\#define _WIN32_WINNT 0x0500
|
|
|
|
\#include <windows.h>
|
2007-11-14 02:02:18 +00:00
|
|
|
__int64 foo;
|
|
|
|
int main() {return 0;}" HAVE___INT64)
|
|
|
|
ENDIF()
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(NOT HAVE___INT64)
|
|
|
|
IF(NOT SIZEOF_LONG MATCHES "8")
|
|
|
|
IF(NOT SIZEOF_LONG_LONG MATCHES "8")
|
2007-11-14 02:02:18 +00:00
|
|
|
MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
2007-12-18 01:43:19 +00:00
|
|
|
SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c
|
|
|
|
OpenAL32/alBuffer.c
|
2007-12-18 01:20:11 +00:00
|
|
|
OpenAL32/alEffect.c
|
2007-11-14 02:02:18 +00:00
|
|
|
OpenAL32/alError.c
|
|
|
|
OpenAL32/alExtension.c
|
2007-12-17 23:43:35 +00:00
|
|
|
OpenAL32/alFilter.c
|
2007-11-14 02:02:18 +00:00
|
|
|
OpenAL32/alListener.c
|
|
|
|
OpenAL32/alSource.c
|
|
|
|
OpenAL32/alState.c
|
|
|
|
OpenAL32/alThunk.c
|
|
|
|
)
|
|
|
|
SET(ALC_OBJS Alc/ALc.c
|
2007-11-16 08:54:29 +00:00
|
|
|
Alc/ALu.c
|
2007-11-14 02:02:18 +00:00
|
|
|
Alc/alcConfig.c
|
2008-11-16 08:29:49 +00:00
|
|
|
Alc/alcReverb.c
|
2007-12-17 02:36:06 +00:00
|
|
|
Alc/alcRing.c
|
2007-11-14 02:02:18 +00:00
|
|
|
Alc/alcThread.c
|
2008-01-03 13:36:51 +00:00
|
|
|
Alc/bs2b.c
|
2008-01-11 17:32:22 +00:00
|
|
|
Alc/wave.c
|
2007-11-14 02:02:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(BACKENDS "")
|
|
|
|
|
|
|
|
# Check ALSA backend
|
|
|
|
IF(ALSA)
|
|
|
|
CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ALSA_ASOUNDLIB_H)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(HAVE_ALSA_ASOUNDLIB_H)
|
2007-11-14 02:02:18 +00:00
|
|
|
CHECK_LIBRARY_EXISTS(asound snd_pcm_open "" HAVE_LIBASOUND)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(HAVE_DLFCN_H OR HAVE_LIBASOUND)
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(HAVE_ALSA 1)
|
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/alsa.c)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(HAVE_DLFCN_H)
|
2008-01-15 20:43:43 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} ALSA,")
|
2007-11-14 02:02:18 +00:00
|
|
|
ELSE()
|
2008-01-15 20:43:43 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} ALSA \(linked\),")
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(EXTRA_LIBS asound ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# Check OSS backend
|
|
|
|
IF(OSS)
|
|
|
|
CHECK_INCLUDE_FILE(sys/soundcard.h HAVE_SYS_SOUNDCARD_H)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(HAVE_SYS_SOUNDCARD_H)
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(HAVE_OSS 1)
|
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/oss.c)
|
2008-01-15 20:43:43 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} OSS,")
|
2007-11-14 02:02:18 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2008-09-07 21:34:14 +00:00
|
|
|
# Check Solaris backend
|
|
|
|
IF(SOLARIS)
|
|
|
|
CHECK_INCLUDE_FILE(sys/audioio.h HAVE_SYS_AUDIOIO_H)
|
|
|
|
IF(HAVE_SYS_AUDIOIO_H)
|
|
|
|
SET(HAVE_SOLARIS 1)
|
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/solaris.c)
|
|
|
|
SET(BACKENDS "${BACKENDS} Solaris,")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
# Check DSound/MMSystem backend
|
2008-11-16 12:39:12 +00:00
|
|
|
IF(DSOUND)
|
|
|
|
CHECK_INCLUDE_FILE(dsound.h HAVE_DSOUND_H)
|
|
|
|
IF(HAVE_DSOUND_H)
|
|
|
|
SET(HAVE_DSOUND 1)
|
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/dsound.c)
|
|
|
|
SET(BACKENDS "${BACKENDS} DirectSound,")
|
|
|
|
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES dsound)
|
|
|
|
CHECK_C_SOURCE_COMPILES("int main() {return 0;}" HAVE_LIBDSOUND)
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES "")
|
|
|
|
# CHECK_LIBRARY_EXISTS(dsound DirectSoundCreate "" HAVE_LIBDSOUND)
|
|
|
|
IF(HAVE_LIBDSOUND)
|
|
|
|
SET(EXTRA_LIBS dsound ${EXTRA_LIBS})
|
2007-11-14 02:02:18 +00:00
|
|
|
ENDIF()
|
2007-11-23 03:34:40 +00:00
|
|
|
ENDIF()
|
2008-11-16 12:39:12 +00:00
|
|
|
ENDIF()
|
|
|
|
IF(HAVE_WINDOWS_H)
|
2007-11-23 03:34:40 +00:00
|
|
|
IF(WINMM)
|
2008-03-01 09:39:42 +00:00
|
|
|
CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0500)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(HAVE_MMSYSTEM_H)
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(HAVE_WINMM 1)
|
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/winmm.c)
|
2008-01-15 20:43:43 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} WinMM,")
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES winmm)
|
|
|
|
CHECK_C_SOURCE_COMPILES("int main() {return 0;}" HAVE_LIBWINMM)
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES "")
|
|
|
|
# CHECK_LIBRARY_EXISTS(winmm waveInOpen "" HAVE_LIBWINMM)
|
2008-01-15 20:25:51 +00:00
|
|
|
IF(HAVE_LIBWINMM)
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2008-12-07 09:05:39 +00:00
|
|
|
# Check SDL backend
|
|
|
|
IF(SDL)
|
2008-12-12 19:09:23 +00:00
|
|
|
CHECK_INCLUDE_FILE(SDL.h HAVE_SDL_H)
|
|
|
|
IF(NOT HAVE_SDL_H)
|
|
|
|
CHECK_INCLUDE_FILE(SDL/SDL.h HAVE_SDL_SDL_H)
|
|
|
|
ENDIF()
|
|
|
|
IF(HAVE_SDL_H OR HAVE_SDL_SDL_H)
|
2008-12-07 09:05:39 +00:00
|
|
|
CHECK_LIBRARY_EXISTS(SDL SDL_Init "" HAVE_LIBSDL)
|
|
|
|
IF(HAVE_DLFCN_H OR HAVE_LIBSDL)
|
|
|
|
SET(HAVE_SDL 1)
|
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/sdl.c)
|
|
|
|
IF(HAVE_DLFCN_H)
|
|
|
|
SET(BACKENDS "${BACKENDS} SDL,")
|
|
|
|
ELSE()
|
|
|
|
SET(BACKENDS "${BACKENDS} SDL \(linked\),")
|
|
|
|
SET(EXTRA_LIBS SDL ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2008-01-11 17:32:22 +00:00
|
|
|
# This is always available
|
2008-01-15 20:43:43 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} WaveFile")
|
2008-01-11 17:32:22 +00:00
|
|
|
|
2008-07-23 01:42:53 +00:00
|
|
|
# Needed for openal.pc.in
|
|
|
|
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
SET(exec_prefix "\${prefix}")
|
|
|
|
SET(libdir "\${exec_prefix}/${LIB_INSTALL_DIR}")
|
|
|
|
SET(bindir "\${exec_prefix}/bin")
|
|
|
|
SET(includedir "\${prefix}/include")
|
|
|
|
SET(PACKAGE_VERSION "${LIB_VERSION}")
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
# End configuration
|
|
|
|
CONFIGURE_FILE(
|
|
|
|
"${OpenAL_SOURCE_DIR}/config.h.in"
|
|
|
|
"${OpenAL_BINARY_DIR}/config.h")
|
2008-07-23 01:42:53 +00:00
|
|
|
CONFIGURE_FILE(
|
|
|
|
"${OpenAL_SOURCE_DIR}/admin/pkgconfig/openal.pc.in"
|
|
|
|
"${OpenAL_BINARY_DIR}/admin/pkgconfig/openal.pc"
|
|
|
|
@ONLY)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
ADD_DEFINITIONS(-DAL_BUILD_LIBRARY)
|
|
|
|
|
2008-09-16 14:43:38 +00:00
|
|
|
# Build a library
|
|
|
|
IF(NOT LIBTYPE)
|
|
|
|
SET(LIBTYPE SHARED)
|
|
|
|
ENDIF()
|
|
|
|
ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS})
|
2007-12-20 20:32:54 +00:00
|
|
|
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION}
|
2007-12-24 00:27:05 +00:00
|
|
|
SOVERSION ${LIB_MAJOR_VERSION})
|
2008-11-18 11:24:49 +00:00
|
|
|
IF(WIN32)
|
|
|
|
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
|
|
|
|
ENDIF()
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES(${LIBNAME} ${EXTRA_LIBS})
|
|
|
|
|
|
|
|
# Add an install target here
|
|
|
|
INSTALL(TARGETS ${LIBNAME}
|
|
|
|
RUNTIME DESTINATION bin
|
2008-06-07 01:39:18 +00:00
|
|
|
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
|
|
|
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
|
2007-11-14 02:02:18 +00:00
|
|
|
)
|
|
|
|
INSTALL(FILES include/AL/al.h
|
|
|
|
include/AL/alc.h
|
2008-02-07 04:53:00 +00:00
|
|
|
include/AL/alext.h
|
2007-11-14 02:02:18 +00:00
|
|
|
DESTINATION include/AL
|
|
|
|
)
|
2008-07-23 01:42:53 +00:00
|
|
|
INSTALL(FILES "${OpenAL_BINARY_DIR}/admin/pkgconfig/openal.pc"
|
|
|
|
DESTINATION lib/pkgconfig)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2008-05-19 01:40:53 +00:00
|
|
|
IF(EXAMPLES)
|
|
|
|
ADD_EXECUTABLE(openal-info examples/openal-info.c)
|
|
|
|
TARGET_LINK_LIBRARIES(openal-info ${LIBNAME})
|
2008-06-05 02:40:52 +00:00
|
|
|
INSTALL(TARGETS openal-info
|
|
|
|
RUNTIME DESTINATION bin
|
2008-06-07 01:39:18 +00:00
|
|
|
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
|
|
|
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
|
2008-06-05 02:40:52 +00:00
|
|
|
)
|
2008-05-19 01:40:53 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
MESSAGE(STATUS "")
|
|
|
|
MESSAGE(STATUS "Building OpenAL with support for the following backends:")
|
|
|
|
MESSAGE(STATUS " ${BACKENDS}")
|
|
|
|
MESSAGE(STATUS "")
|
2008-07-23 07:51:55 +00:00
|
|
|
|
2008-12-12 19:19:38 +00:00
|
|
|
IF(WIN32)
|
2008-11-14 07:13:15 +00:00
|
|
|
IF(NOT HAVE_DSOUND)
|
|
|
|
MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
|
|
|
|
MESSAGE(STATUS " This is probably NOT what you want!")
|
|
|
|
MESSAGE(STATUS "")
|
|
|
|
ENDIF()
|
2008-07-23 07:51:55 +00:00
|
|
|
ENDIF()
|