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)
|
|
|
|
|
2009-12-09 16:46:35 +00:00
|
|
|
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
|
|
|
|
2007-12-14 15:01:56 +00:00
|
|
|
INCLUDE(CheckFunctionExists)
|
2007-11-14 02:02:18 +00:00
|
|
|
INCLUDE(CheckLibraryExists)
|
2011-07-23 07:48:19 +00:00
|
|
|
INCLUDE(CheckSharedFunctionExists)
|
2007-11-14 02:02:18 +00:00
|
|
|
INCLUDE(CheckIncludeFile)
|
2007-12-14 15:11:57 +00:00
|
|
|
INCLUDE(CheckIncludeFiles)
|
2009-05-31 18:34:07 +00:00
|
|
|
INCLUDE(CheckSymbolExists)
|
2007-11-14 02:02:18 +00:00
|
|
|
INCLUDE(CheckCCompilerFlag)
|
|
|
|
INCLUDE(CheckCSourceCompiles)
|
|
|
|
INCLUDE(CheckTypeSize)
|
2012-01-01 20:36:41 +00:00
|
|
|
INCLUDE(FindPkgConfig)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
2012-08-15 08:24:50 +00:00
|
|
|
OPTION(SSE "Check for SSE CPU extensions" ON)
|
|
|
|
OPTION(NEON "Check for ARM Neon CPU extensions" ON)
|
|
|
|
|
|
|
|
OPTION(REQUIRE_SSE "Require SSE CPU extensions" OFF)
|
|
|
|
OPTION(REQUIRE_NEON "Require ARM Neon CPU extensions" OFF)
|
|
|
|
|
|
|
|
|
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)
|
2011-06-23 02:29:13 +00:00
|
|
|
OPTION(SNDIO "Check for SndIO backend" ON)
|
2011-05-16 03:26:25 +00:00
|
|
|
OPTION(MMDEVAPI "Check for MMDevApi" ON)
|
2008-01-15 20:30:20 +00:00
|
|
|
OPTION(DSOUND "Check for DirectSound backend" ON)
|
|
|
|
OPTION(WINMM "Check for Windows Multimedia backend" ON)
|
2009-04-16 12:17:42 +00:00
|
|
|
OPTION(PORTAUDIO "Check for PortAudio backend" ON)
|
|
|
|
OPTION(PULSEAUDIO "Check for PulseAudio backend" ON)
|
2011-03-15 11:58:56 +00:00
|
|
|
OPTION(COREAUDIO "Check for CoreAudio backend" ON)
|
2011-06-12 11:41:42 +00:00
|
|
|
OPTION(OPENSL "Check for OpenSL backend" ON)
|
2010-06-08 09:01:11 +00:00
|
|
|
OPTION(WAVE "Enable Wave Writer backend" ON)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2011-05-18 12:34:21 +00:00
|
|
|
OPTION(REQUIRE_ALSA "Require ALSA backend" OFF)
|
|
|
|
OPTION(REQUIRE_OSS "Require OSS backend" OFF)
|
|
|
|
OPTION(REQUIRE_SOLARIS "Require Solaris backend" OFF)
|
2011-06-23 02:29:13 +00:00
|
|
|
OPTION(REQUIRE_SNDIO "Require SndIO backend" OFF)
|
2011-05-18 12:34:21 +00:00
|
|
|
OPTION(REQUIRE_MMDEVAPI "Require MMDevApi" OFF)
|
|
|
|
OPTION(REQUIRE_DSOUND "Require DirectSound backend" OFF)
|
|
|
|
OPTION(REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
|
|
|
|
OPTION(REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
|
|
|
|
OPTION(REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
|
|
|
|
OPTION(REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
|
2011-06-12 11:41:42 +00:00
|
|
|
OPTION(REQUIRE_OPENSL "Require OpenSL backend" OFF)
|
2011-05-18 12:34:21 +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)
|
|
|
|
|
2010-07-17 08:02:51 +00:00
|
|
|
OPTION(UTILS "Build and install utility programs" ON)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2012-01-01 20:36:41 +00:00
|
|
|
OPTION(EXAMPLES "Build and install example programs" ON)
|
|
|
|
|
2012-11-06 11:52:41 +00:00
|
|
|
OPTION(ALSOFT_CONFIG "Install alsoft.conf sample configuration file" ON)
|
2009-05-18 05:36:45 +00:00
|
|
|
|
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)
|
2012-03-09 01:42:16 +00:00
|
|
|
ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0501")
|
2008-07-23 18:58:36 +00:00
|
|
|
ELSE()
|
|
|
|
SET(LIBNAME openal)
|
|
|
|
ENDIF()
|
|
|
|
|
2010-11-29 00:19:11 +00:00
|
|
|
IF(NOT LIBTYPE)
|
|
|
|
SET(LIBTYPE SHARED)
|
|
|
|
ENDIF()
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(LIB_MAJOR_VERSION "1")
|
2012-03-28 15:55:17 +00:00
|
|
|
SET(LIB_MINOR_VERSION "14")
|
2010-07-16 07:18:21 +00:00
|
|
|
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}")
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2011-05-17 16:13:55 +00:00
|
|
|
SET(EXPORT_DECL "")
|
2012-08-15 10:43:36 +00:00
|
|
|
SET(ALIGN_DECL "")
|
2012-10-09 08:46:02 +00:00
|
|
|
SET(RESTRICT_DECL "")
|
2011-05-17 16:13:55 +00:00
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
|
|
|
|
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
|
|
|
|
|
|
|
|
|
2011-05-03 00:06:32 +00:00
|
|
|
CHECK_C_SOURCE_COMPILES("int *restrict foo;
|
|
|
|
int main() {return 0;}" HAVE_RESTRICT)
|
2012-10-09 08:46:02 +00:00
|
|
|
IF(HAVE_RESTRICT)
|
|
|
|
SET(RESTRICT_DECL "restrict")
|
|
|
|
ELSE()
|
|
|
|
CHECK_C_SOURCE_COMPILES("int *__restrict foo;
|
|
|
|
int main() {return 0;}" HAVE___RESTRICT)
|
|
|
|
IF(HAVE___RESTRICT)
|
|
|
|
SET(RESTRICT_DECL "__restrict")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2011-05-03 00:06:32 +00:00
|
|
|
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
# 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")
|
2009-05-26 13:02:40 +00:00
|
|
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
2010-03-18 18:46:38 +00:00
|
|
|
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
|
2010-03-18 20:12:33 +00:00
|
|
|
|
|
|
|
IF(NOT DXSDK_DIR)
|
|
|
|
STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
|
|
|
|
ELSE()
|
|
|
|
STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
|
|
|
|
ENDIF()
|
|
|
|
IF(DXSDK_DIR)
|
|
|
|
MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
|
|
|
|
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${DXSDK_DIR}/Include")
|
|
|
|
INCLUDE_DIRECTORIES("${DXSDK_DIR}/Include")
|
|
|
|
LINK_DIRECTORIES("${DXSDK_DIR}/Lib")
|
|
|
|
ENDIF()
|
2011-02-08 08:34:25 +00:00
|
|
|
|
|
|
|
OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
|
|
|
|
IF(FORCE_STATIC_VCRT)
|
|
|
|
FOREACH(flag_var
|
|
|
|
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
|
|
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
|
|
|
IF(${flag_var} MATCHES "/MD")
|
|
|
|
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
|
|
|
ENDIF()
|
|
|
|
ENDFOREACH(flag_var)
|
|
|
|
ENDIF()
|
2007-11-14 02:02:18 +00:00
|
|
|
ELSE()
|
2010-11-29 03:52:17 +00:00
|
|
|
ADD_DEFINITIONS(-Winline -Wall)
|
2007-12-07 07:57:14 +00:00
|
|
|
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
|
|
|
|
2010-10-15 22:21:23 +00:00
|
|
|
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -D_DEBUG" CACHE STRING
|
2008-01-15 18:00:56 +00:00
|
|
|
"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)
|
2010-10-15 22:21:23 +00:00
|
|
|
SET(CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -DNDEBUG" CACHE STRING
|
2008-01-15 18:00:56 +00:00
|
|
|
"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
|
|
|
|
2010-11-28 22:27:07 +00:00
|
|
|
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
|
|
|
|
int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
|
2011-05-17 16:13:55 +00:00
|
|
|
ENDIF()
|
2010-11-28 22:27:07 +00:00
|
|
|
|
2011-05-17 16:13:55 +00:00
|
|
|
# Set visibility/export options if available
|
|
|
|
IF(WIN32)
|
|
|
|
SET(EXPORT_DECL "__declspec(dllexport)")
|
2012-08-16 17:33:37 +00:00
|
|
|
SET(ALIGN_DECL "__declspec(align(x))")
|
2011-05-17 16:13:55 +00:00
|
|
|
|
2011-07-13 08:49:43 +00:00
|
|
|
OPTION(WINE "Enable use of Wine headers when compiling" OFF)
|
2011-05-17 16:13:55 +00:00
|
|
|
IF(WINE)
|
|
|
|
FIND_PATH(WINE_INCLUDE_DIR library.h
|
|
|
|
PATHS
|
|
|
|
/usr/include/wine
|
2011-07-13 08:49:43 +00:00
|
|
|
/usr/local/include/wine
|
|
|
|
CMAKE_FIND_ROOT_PATH_BOTH)
|
2011-05-17 16:13:55 +00:00
|
|
|
IF(WINE_INCLUDE_DIR)
|
|
|
|
MESSAGE(STATUS "Found Wine header files - ${WINE_INCLUDE_DIR}" )
|
|
|
|
INCLUDE_DIRECTORIES("${WINE_INCLUDE_DIR}/windows")
|
|
|
|
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${WINE_INCLUDE_DIR}/windows")
|
|
|
|
ELSE()
|
|
|
|
MESSAGE(STATUS "Could not find Wine header files" )
|
2011-05-16 03:25:09 +00:00
|
|
|
ENDIF()
|
2007-11-14 02:02:18 +00:00
|
|
|
ENDIF()
|
2011-05-17 16:13:55 +00:00
|
|
|
ELSE()
|
2011-09-20 23:53:05 +00:00
|
|
|
SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
2011-09-22 06:41:52 +00:00
|
|
|
# Yes GCC, really don't accept visibility modes you don't support
|
2011-10-03 05:12:31 +00:00
|
|
|
SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
|
2011-09-20 23:53:05 +00:00
|
|
|
|
2011-05-17 16:13:55 +00:00
|
|
|
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
|
2011-09-20 23:53:05 +00:00
|
|
|
int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
|
|
|
|
IF(HAVE_GCC_PROTECTED_VISIBILITY)
|
2011-05-17 16:13:55 +00:00
|
|
|
SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
|
2011-09-20 23:53:05 +00:00
|
|
|
ELSE()
|
|
|
|
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
|
|
|
|
int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
|
|
|
|
IF(HAVE_GCC_DEFAULT_VISIBILITY)
|
|
|
|
SET(EXPORT_DECL "__attribute__((visibility(\"default\")))")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2011-09-22 06:41:52 +00:00
|
|
|
IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
|
|
|
|
CHECK_C_COMPILER_FLAG(-fvisibility=internal HAVE_VISIBILITY_INTERNAL_SWITCH)
|
|
|
|
IF(HAVE_VISIBILITY_INTERNAL_SWITCH)
|
|
|
|
ADD_DEFINITIONS(-fvisibility=internal)
|
|
|
|
ELSE()
|
|
|
|
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
|
|
|
|
IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
|
|
|
|
ADD_DEFINITIONS(-fvisibility=hidden)
|
|
|
|
ENDIF()
|
2011-09-20 23:53:05 +00:00
|
|
|
ENDIF()
|
2011-05-17 16:13:55 +00:00
|
|
|
ENDIF()
|
2011-09-20 23:53:05 +00:00
|
|
|
|
2012-08-15 10:43:36 +00:00
|
|
|
CHECK_C_SOURCE_COMPILES("int foo __attribute__((aligned(16)));
|
|
|
|
int main() {return 0;}" HAVE_ATTRIBUTE_ALIGNED)
|
|
|
|
IF(HAVE_ATTRIBUTE_ALIGNED)
|
2012-08-16 17:33:37 +00:00
|
|
|
SET(ALIGN_DECL "__attribute__((aligned(x)))")
|
2012-08-15 10:43:36 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2011-09-20 23:53:05 +00:00
|
|
|
SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
|
2007-11-14 02:02:18 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2012-08-15 08:46:42 +00:00
|
|
|
SET(SSE_SWITCH "")
|
|
|
|
CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
|
|
|
|
IF(HAVE_MSSE_SWITCH)
|
|
|
|
SET(SSE_SWITCH "-msse")
|
|
|
|
ENDIF()
|
|
|
|
|
2010-01-12 16:48:25 +00:00
|
|
|
CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
|
|
|
|
int main() {return 0;}" HAVE_GCC_FORMAT)
|
|
|
|
|
2012-08-15 08:01:55 +00:00
|
|
|
CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
|
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)
|
2011-07-23 11:06:29 +00:00
|
|
|
CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
|
2011-05-22 20:29:32 +00:00
|
|
|
CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
|
|
|
|
IF(NOT HAVE_GUIDDEF_H)
|
|
|
|
CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
|
|
|
|
ENDIF()
|
2007-11-30 09:16:57 +00:00
|
|
|
|
2011-09-24 07:42:14 +00:00
|
|
|
# Some systems need libm for some of the following math functions to work
|
|
|
|
CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
|
|
|
|
IF(HAVE_LIBM)
|
2007-12-24 00:28:09 +00:00
|
|
|
SET(EXTRA_LIBS m ${EXTRA_LIBS})
|
2011-09-24 07:42:14 +00:00
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
2012-08-15 12:50:40 +00:00
|
|
|
CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
|
|
|
|
CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
|
|
|
|
CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
|
2012-09-28 11:20:55 +00:00
|
|
|
CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
|
2011-09-24 07:42:14 +00:00
|
|
|
|
|
|
|
IF(HAVE_FENV_H)
|
|
|
|
CHECK_SYMBOL_EXISTS(fesetround fenv.h HAVE_FESETROUND)
|
2007-12-24 00:28:09 +00:00
|
|
|
ENDIF()
|
2012-09-10 07:19:13 +00:00
|
|
|
IF(HAVE_FLOAT_H)
|
|
|
|
CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
|
2012-09-16 08:44:45 +00:00
|
|
|
CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
|
2012-09-10 07:19:13 +00:00
|
|
|
ENDIF()
|
2011-09-24 07:42:14 +00:00
|
|
|
|
2007-12-14 15:01:56 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
|
2010-01-09 14:40:50 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
|
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()
|
|
|
|
|
2009-06-07 22:42:15 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF)
|
|
|
|
IF(NOT HAVE_VSNPRINTF)
|
|
|
|
CHECK_FUNCTION_EXISTS(_vsnprintf HAVE__VSNPRINTF)
|
|
|
|
IF(NOT HAVE__VSNPRINTF)
|
|
|
|
MESSAGE(FATAL_ERROR "No vsnprintf function found, please report!")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ADD_DEFINITIONS(-Dvsnprintf=_vsnprintf)
|
|
|
|
ENDIF()
|
|
|
|
|
2011-07-20 10:18:11 +00:00
|
|
|
CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
|
|
|
|
IF(NOT HAVE_ISFINITE)
|
2011-07-23 11:23:54 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
|
2011-07-23 11:36:03 +00:00
|
|
|
IF(NOT HAVE_FINITE)
|
2011-07-23 11:23:54 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE)
|
|
|
|
IF(NOT HAVE__FINITE)
|
|
|
|
MESSAGE(FATAL_ERROR "No isfinite function found, please report!")
|
|
|
|
ENDIF()
|
|
|
|
ADD_DEFINITIONS(-Disfinite=_finite)
|
|
|
|
ELSE()
|
|
|
|
ADD_DEFINITIONS(-Disfinite=finite)
|
2011-07-20 10:18:11 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2009-05-31 18:34:07 +00:00
|
|
|
CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
|
|
|
|
IF(NOT HAVE_ISNAN)
|
|
|
|
CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN)
|
|
|
|
IF(NOT HAVE__ISNAN)
|
|
|
|
MESSAGE(FATAL_ERROR "No isnan function found, please report!")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ADD_DEFINITIONS(-Disnan=_isnan)
|
|
|
|
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
|
2012-03-09 01:42:16 +00:00
|
|
|
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0501)
|
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()
|
|
|
|
|
2009-10-23 17:36:32 +00:00
|
|
|
CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
|
|
|
|
IF(HAVE_PTHREAD)
|
|
|
|
ADD_DEFINITIONS(-pthread)
|
|
|
|
SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread)
|
|
|
|
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)
|
|
|
|
|
2012-06-18 09:04:10 +00:00
|
|
|
# _GNU_SOURCE is needed on some systems for extra attributes
|
2009-10-23 17:36:32 +00:00
|
|
|
ADD_DEFINITIONS(-D_GNU_SOURCE=1)
|
2007-11-14 02:02:18 +00:00
|
|
|
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})
|
2009-11-01 18:03:05 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2009-11-30 06:44:56 +00:00
|
|
|
CHECK_LIBRARY_EXISTS(pthread pthread_setschedparam "" HAVE_PTHREAD_SETSCHEDPARAM)
|
|
|
|
|
2009-11-01 18:03:05 +00:00
|
|
|
CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
|
|
|
|
IF(HAVE_LIBRT)
|
|
|
|
SET(EXTRA_LIBS rt ${EXTRA_LIBS})
|
2007-11-14 02:02:18 +00:00
|
|
|
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)
|
2012-03-09 01:42:16 +00:00
|
|
|
CHECK_C_SOURCE_COMPILES("\#define _WIN32_WINNT 0x0501
|
2008-03-01 09:39:42 +00:00
|
|
|
\#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()
|
|
|
|
|
2011-05-17 15:36:26 +00:00
|
|
|
# Windows needs winmm for timeGetTime, even if the backend is disabled
|
2011-07-23 07:48:19 +00:00
|
|
|
CHECK_SHARED_FUNCTION_EXISTS(timeGetTime "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
|
2011-05-17 15:36:26 +00:00
|
|
|
IF(HAVE_LIBWINMM)
|
|
|
|
SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
|
|
|
|
SET(PKG_CONFIG_LIBS ${PKG_CONFIG_LIBS} -lwinmm)
|
2010-05-16 14:52:43 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
|
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
|
2011-03-13 04:11:25 +00:00
|
|
|
Alc/alcDedicated.c
|
2009-04-12 23:01:10 +00:00
|
|
|
Alc/alcEcho.c
|
2010-04-08 15:54:28 +00:00
|
|
|
Alc/alcModulator.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
|
2011-08-20 10:59:46 +00:00
|
|
|
Alc/helpers.c
|
2012-08-15 08:01:55 +00:00
|
|
|
Alc/panning.c
|
2011-05-01 20:59:44 +00:00
|
|
|
Alc/hrtf.c
|
2010-08-04 06:19:36 +00:00
|
|
|
Alc/mixer.c
|
2012-08-15 08:01:55 +00:00
|
|
|
Alc/mixer_c.c
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
SET(CPU_EXTS "Default")
|
2012-08-15 08:24:50 +00:00
|
|
|
SET(HAVE_SSE 0)
|
|
|
|
SET(HAVE_NEON 0)
|
2012-08-15 08:01:55 +00:00
|
|
|
|
|
|
|
# Check for SSE support
|
2012-10-15 09:23:08 +00:00
|
|
|
IF(SSE AND ALIGN_DECL)
|
2012-08-15 08:46:42 +00:00
|
|
|
CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
|
2012-08-15 08:24:50 +00:00
|
|
|
IF(HAVE_XMMINTRIN_H)
|
|
|
|
SET(HAVE_SSE 1)
|
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse.c)
|
2012-08-15 08:46:42 +00:00
|
|
|
IF(SSE_SWITCH)
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse.c PROPERTIES
|
|
|
|
COMPILE_FLAGS "${SSE_SWITCH}")
|
|
|
|
ENDIF()
|
2012-08-15 08:24:50 +00:00
|
|
|
SET(CPU_EXTS "${CPU_EXTS}, SSE")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
IF(REQUIRE_SSE AND NOT HAVE_SSE)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
|
2012-08-15 08:01:55 +00:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# Check for ARM Neon support
|
2012-08-15 08:24:50 +00:00
|
|
|
IF(NEON)
|
|
|
|
CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H)
|
|
|
|
IF(HAVE_ARM_NEON_H)
|
|
|
|
SET(HAVE_NEON 1)
|
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_neon.c)
|
|
|
|
SET(CPU_EXTS "${CPU_EXTS}, Neon")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
IF(REQUIRE_NEON AND NOT HAVE_NEON)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
|
2012-08-15 08:01:55 +00:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
|
|
SET(ALC_OBJS ${ALC_OBJS}
|
2011-08-20 07:41:47 +00:00
|
|
|
# Default backends, always available
|
|
|
|
Alc/backends/loopback.c
|
|
|
|
Alc/backends/null.c
|
2007-11-14 02:02:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(BACKENDS "")
|
2010-07-17 07:37:54 +00:00
|
|
|
SET(HAVE_ALSA 0)
|
|
|
|
SET(HAVE_OSS 0)
|
|
|
|
SET(HAVE_SOLARIS 0)
|
2011-06-24 01:39:16 +00:00
|
|
|
SET(HAVE_SNDIO 0)
|
2010-07-17 07:37:54 +00:00
|
|
|
SET(HAVE_DSOUND 0)
|
2012-03-12 22:33:56 +00:00
|
|
|
SET(HAVE_MMDEVAPI 0)
|
2010-07-17 07:37:54 +00:00
|
|
|
SET(HAVE_WINMM 0)
|
|
|
|
SET(HAVE_PORTAUDIO 0)
|
|
|
|
SET(HAVE_PULSEAUDIO 0)
|
2011-03-15 11:58:56 +00:00
|
|
|
SET(HAVE_COREAUDIO 0)
|
2011-06-12 11:41:42 +00:00
|
|
|
SET(HAVE_OPENSL 0)
|
2010-07-17 07:37:54 +00:00
|
|
|
SET(HAVE_WAVE 0)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
# 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)
|
2011-07-23 07:48:19 +00:00
|
|
|
CHECK_SHARED_FUNCTION_EXISTS(snd_pcm_open "alsa/asoundlib.h" asound "" HAVE_LIBASOUND)
|
2010-02-16 13:43:36 +00:00
|
|
|
IF(HAVE_LIBASOUND OR HAVE_DLFCN_H OR WIN32)
|
2007-11-14 02:02:18 +00:00
|
|
|
SET(HAVE_ALSA 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c)
|
2010-02-16 13:43:36 +00:00
|
|
|
IF(HAVE_DLFCN_H OR WIN32)
|
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()
|
2011-05-18 12:34:21 +00:00
|
|
|
IF(REQUIRE_ALSA AND NOT HAVE_ALSA)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend")
|
|
|
|
ENDIF()
|
2007-11-14 02:02:18 +00:00
|
|
|
|
|
|
|
# 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)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
|
2008-01-15 20:43:43 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} OSS,")
|
2007-11-14 02:02:18 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2011-05-18 12:34:21 +00:00
|
|
|
IF(REQUIRE_OSS AND NOT HAVE_OSS)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend")
|
|
|
|
ENDIF()
|
2007-11-14 02:02:18 +00:00
|
|
|
|
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)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
|
2008-09-07 21:34:14 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} Solaris,")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2011-05-18 12:34:21 +00:00
|
|
|
IF(REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend")
|
|
|
|
ENDIF()
|
2008-09-07 21:34:14 +00:00
|
|
|
|
2011-06-23 02:29:13 +00:00
|
|
|
# Check SndIO backend
|
|
|
|
IF(SNDIO)
|
|
|
|
CHECK_INCLUDE_FILE(sndio.h HAVE_SNDIO_H)
|
|
|
|
IF(HAVE_SNDIO_H)
|
2011-07-23 07:48:19 +00:00
|
|
|
CHECK_SHARED_FUNCTION_EXISTS(sio_open "sndio.h" sndio "" HAVE_LIBSNDIO)
|
2012-08-16 17:12:50 +00:00
|
|
|
IF(HAVE_LIBSNDIO)
|
2011-06-23 02:29:13 +00:00
|
|
|
SET(HAVE_SNDIO 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c)
|
2012-08-16 17:12:50 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} SndIO \(linked\),")
|
|
|
|
SET(EXTRA_LIBS sndio ${EXTRA_LIBS})
|
2011-06-23 02:29:13 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
IF(REQUIRE_SNDIO AND NOT HAVE_SNDIO)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend")
|
|
|
|
ENDIF()
|
|
|
|
|
2011-05-16 03:26:25 +00:00
|
|
|
# Check for MMDevApi backend
|
|
|
|
IF(HAVE_WINDOWS_H)
|
|
|
|
IF(MMDEVAPI)
|
|
|
|
CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
|
|
|
|
IF(HAVE_MMDEVICEAPI_H)
|
|
|
|
SET(HAVE_MMDEVAPI 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c)
|
2011-05-16 03:26:25 +00:00
|
|
|
|
|
|
|
SET(BACKENDS "${BACKENDS} MMDevApi,")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2011-05-18 12:34:21 +00:00
|
|
|
IF(REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend")
|
|
|
|
ENDIF()
|
2011-05-16 03:26:25 +00:00
|
|
|
|
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)
|
2011-07-23 07:48:19 +00:00
|
|
|
CHECK_SHARED_FUNCTION_EXISTS(DirectSoundCreate "dsound.h" dsound "" HAVE_LIBDSOUND)
|
2010-02-16 13:43:36 +00:00
|
|
|
IF(HAVE_LIBDSOUND OR HAVE_DLFCN_H OR WIN32)
|
2009-03-10 09:46:42 +00:00
|
|
|
SET(HAVE_DSOUND 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c)
|
2009-03-10 09:46:42 +00:00
|
|
|
|
2010-02-16 13:43:36 +00:00
|
|
|
IF(HAVE_DLFCN_H OR WIN32)
|
2009-03-10 09:46:42 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} DirectSound,")
|
|
|
|
ELSE()
|
|
|
|
SET(BACKENDS "${BACKENDS} DirectSound \(linked\),")
|
|
|
|
SET(EXTRA_LIBS dsound ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
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()
|
2011-05-18 12:34:21 +00:00
|
|
|
IF(REQUIRE_DSOUND AND NOT HAVE_DSOUND)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend")
|
|
|
|
ENDIF()
|
2010-07-17 07:37:54 +00:00
|
|
|
|
2008-11-16 12:39:12 +00:00
|
|
|
IF(HAVE_WINDOWS_H)
|
2007-11-23 03:34:40 +00:00
|
|
|
IF(WINMM)
|
2012-03-09 01:42:16 +00:00
|
|
|
CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0501)
|
2010-11-29 00:19:11 +00:00
|
|
|
IF(HAVE_MMSYSTEM_H AND HAVE_LIBWINMM)
|
|
|
|
SET(HAVE_WINMM 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
|
2010-11-29 00:19:11 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} WinMM,")
|
2007-11-14 02:02:18 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2011-05-18 12:34:21 +00:00
|
|
|
IF(REQUIRE_WINMM AND NOT HAVE_WINMM)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")
|
|
|
|
ENDIF()
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2009-03-10 07:55:29 +00:00
|
|
|
# Check PortAudio backend
|
|
|
|
IF(PORTAUDIO)
|
|
|
|
CHECK_INCLUDE_FILE(portaudio.h HAVE_PORTAUDIO_H)
|
|
|
|
IF(HAVE_PORTAUDIO_H)
|
2011-07-23 07:48:19 +00:00
|
|
|
CHECK_SHARED_FUNCTION_EXISTS(Pa_Initialize "portaudio.h" portaudio "" HAVE_LIBPORTAUDIO)
|
2010-02-16 13:43:36 +00:00
|
|
|
IF(HAVE_LIBPORTAUDIO OR HAVE_DLFCN_H OR WIN32)
|
2009-03-10 07:55:29 +00:00
|
|
|
SET(HAVE_PORTAUDIO 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c)
|
2010-02-16 13:43:36 +00:00
|
|
|
IF(HAVE_DLFCN_H OR WIN32)
|
2009-03-10 07:55:29 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} PortAudio,")
|
|
|
|
ELSE()
|
|
|
|
SET(BACKENDS "${BACKENDS} PortAudio \(linked\),")
|
|
|
|
SET(EXTRA_LIBS portaudio ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2011-05-18 12:34:21 +00:00
|
|
|
IF(REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend")
|
|
|
|
ENDIF()
|
2009-03-10 07:55:29 +00:00
|
|
|
|
2011-06-24 00:02:57 +00:00
|
|
|
# Check PulseAudio backend
|
2009-04-16 12:17:42 +00:00
|
|
|
IF(PULSEAUDIO)
|
|
|
|
CHECK_INCLUDE_FILE(pulse/pulseaudio.h HAVE_PULSE_PULSEAUDIO_H)
|
|
|
|
IF(HAVE_PULSE_PULSEAUDIO_H)
|
2011-07-23 07:48:19 +00:00
|
|
|
CHECK_SHARED_FUNCTION_EXISTS(pa_context_new "pulse/pulseaudio.h" pulse "" HAVE_LIBPULSE)
|
2010-02-16 13:43:36 +00:00
|
|
|
IF(HAVE_LIBPULSE OR HAVE_DLFCN_H OR WIN32)
|
2009-04-16 12:17:42 +00:00
|
|
|
SET(HAVE_PULSEAUDIO 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c)
|
2010-02-16 13:43:36 +00:00
|
|
|
IF(HAVE_DLFCN_H OR WIN32)
|
2009-05-19 13:35:12 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} PulseAudio,")
|
|
|
|
ELSE()
|
|
|
|
SET(BACKENDS "${BACKENDS} PulseAudio \(linked\),")
|
|
|
|
SET(EXTRA_LIBS pulse ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
2009-04-16 12:17:42 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2011-05-18 12:34:21 +00:00
|
|
|
IF(REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend")
|
|
|
|
ENDIF()
|
2009-04-16 12:17:42 +00:00
|
|
|
|
2011-03-15 11:58:56 +00:00
|
|
|
# Check CoreAudio backend
|
|
|
|
IF(COREAUDIO)
|
|
|
|
CHECK_INCLUDE_FILE(/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h HAVE_COREAUDIO_FRAMEWORK)
|
|
|
|
IF(HAVE_COREAUDIO_FRAMEWORK)
|
|
|
|
SET(HAVE_COREAUDIO 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c)
|
2011-03-15 11:58:56 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} CoreAudio,")
|
|
|
|
SET(EXTRA_LIBS /System/Library/Frameworks/CoreAudio.framework ${EXTRA_LIBS})
|
|
|
|
SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
|
|
|
|
SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
|
2012-01-23 11:45:04 +00:00
|
|
|
|
|
|
|
# Some versions of OSX may need the AudioToolbox framework. Add it if
|
|
|
|
# it's found.
|
|
|
|
FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
|
|
|
|
NAMES AudioToolbox
|
|
|
|
PATHS ~/Library/Frameworks
|
|
|
|
/Library/Frameworks
|
|
|
|
/System/Library/Frameworks
|
|
|
|
)
|
|
|
|
IF(AUDIOTOOLBOX_LIBRARY)
|
|
|
|
SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
2011-03-15 11:58:56 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2011-05-18 12:34:21 +00:00
|
|
|
IF(REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend")
|
|
|
|
ENDIF()
|
2011-03-15 11:58:56 +00:00
|
|
|
|
2011-06-12 11:41:42 +00:00
|
|
|
# Check for OpenSL (Android) backend
|
|
|
|
IF(OPENSL)
|
2011-09-20 22:43:00 +00:00
|
|
|
CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
|
2011-06-12 11:41:42 +00:00
|
|
|
IF(HAVE_SLES_OPENSLES_ANDROID_H)
|
2011-07-23 07:48:19 +00:00
|
|
|
CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
|
2011-06-12 11:41:42 +00:00
|
|
|
IF(HAVE_LIBOPENSLES)
|
|
|
|
SET(HAVE_OPENSL 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c)
|
2011-06-12 11:41:42 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} OpenSL,")
|
|
|
|
SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
IF(REQUIRE_OPENSL AND NOT HAVE_OPENSL)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
|
|
|
|
ENDIF()
|
|
|
|
|
2010-06-08 09:01:11 +00:00
|
|
|
# Optionally enable the Wave Writer backend
|
|
|
|
IF(WAVE)
|
|
|
|
SET(HAVE_WAVE 1)
|
2011-08-20 07:41:47 +00:00
|
|
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c)
|
2010-06-08 09:01:11 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} WaveFile,")
|
|
|
|
ENDIF()
|
|
|
|
|
2008-01-11 17:32:22 +00:00
|
|
|
# This is always available
|
2010-06-08 09:01:11 +00:00
|
|
|
SET(BACKENDS "${BACKENDS} Null")
|
2008-01-11 17:32:22 +00:00
|
|
|
|
2012-01-02 19:52:20 +00:00
|
|
|
IF(EXAMPLES)
|
2012-03-27 15:52:21 +00:00
|
|
|
# Might be able to use earlier versions, but these definitely work
|
2012-10-03 07:29:08 +00:00
|
|
|
PKG_CHECK_MODULES(FFMPEG libavcodec>=53.61.100 libavformat>=53.32.100 libavutil>=51.35.100)
|
2012-01-02 19:52:20 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2010-11-29 00:19:11 +00:00
|
|
|
IF(LIBTYPE STREQUAL "STATIC")
|
|
|
|
ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC)
|
|
|
|
SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS})
|
|
|
|
ENDIF()
|
|
|
|
|
2008-07-23 01:42:53 +00:00
|
|
|
# Needed for openal.pc.in
|
|
|
|
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
SET(exec_prefix "\${prefix}")
|
2010-04-11 19:42:47 +00:00
|
|
|
SET(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
|
2008-07-23 01:42:53 +00:00
|
|
|
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(
|
2009-12-09 15:36:06 +00:00
|
|
|
"${OpenAL_SOURCE_DIR}/openal.pc.in"
|
|
|
|
"${OpenAL_BINARY_DIR}/openal.pc"
|
2008-07-23 01:42:53 +00:00
|
|
|
@ONLY)
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2008-09-16 14:43:38 +00:00
|
|
|
# Build a library
|
|
|
|
ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS})
|
2010-03-23 06:09:04 +00:00
|
|
|
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES DEFINE_SYMBOL AL_BUILD_LIBRARY
|
2010-03-24 01:21:55 +00:00
|
|
|
COMPILE_FLAGS -DAL_ALEXT_PROTOTYPES
|
2011-02-06 10:39:22 +00:00
|
|
|
VERSION ${LIB_VERSION}.0
|
2007-12-24 00:27:05 +00:00
|
|
|
SOVERSION ${LIB_MAJOR_VERSION})
|
2010-11-29 00:19:11 +00:00
|
|
|
IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC")
|
2008-11-18 11:24:49 +00:00
|
|
|
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
|
2010-04-11 19:42:47 +00:00
|
|
|
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
|
|
|
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
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
|
2010-03-09 17:28:22 +00:00
|
|
|
include/AL/efx.h
|
2010-05-21 18:21:35 +00:00
|
|
|
include/AL/efx-creative.h
|
2012-01-20 06:30:12 +00:00
|
|
|
include/AL/efx-presets.h
|
2007-11-14 02:02:18 +00:00
|
|
|
DESTINATION include/AL
|
|
|
|
)
|
2009-12-09 15:36:06 +00:00
|
|
|
INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
|
2010-04-11 19:42:47 +00:00
|
|
|
DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2010-07-17 08:02:51 +00:00
|
|
|
|
|
|
|
MESSAGE(STATUS "")
|
|
|
|
MESSAGE(STATUS "Building OpenAL with support for the following backends:")
|
|
|
|
MESSAGE(STATUS " ${BACKENDS}")
|
|
|
|
MESSAGE(STATUS "")
|
2012-08-15 08:01:55 +00:00
|
|
|
MESSAGE(STATUS "Building with support for CPU extensions:")
|
|
|
|
MESSAGE(STATUS " ${CPU_EXTS}")
|
|
|
|
MESSAGE(STATUS "")
|
2010-07-17 08:02:51 +00:00
|
|
|
|
|
|
|
IF(WIN32)
|
|
|
|
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()
|
|
|
|
ENDIF()
|
|
|
|
|
2009-05-18 05:36:45 +00:00
|
|
|
# Install alsoft.conf configuration file
|
|
|
|
IF(ALSOFT_CONFIG)
|
|
|
|
INSTALL(FILES alsoftrc.sample
|
2012-11-05 12:14:05 +00:00
|
|
|
DESTINATION share/openal
|
2009-05-18 05:36:45 +00:00
|
|
|
)
|
2012-11-05 12:20:15 +00:00
|
|
|
MESSAGE(STATUS "Installing sample configuration")
|
2010-07-17 08:02:51 +00:00
|
|
|
MESSAGE(STATUS "")
|
2009-05-18 05:36:45 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2010-07-17 08:02:51 +00:00
|
|
|
IF(UTILS)
|
|
|
|
ADD_EXECUTABLE(openal-info utils/openal-info.c)
|
2008-05-19 01:40:53 +00:00
|
|
|
TARGET_LINK_LIBRARIES(openal-info ${LIBNAME})
|
2012-03-23 05:45:03 +00:00
|
|
|
|
|
|
|
ADD_EXECUTABLE(makehrtf utils/makehrtf.c)
|
|
|
|
IF(HAVE_LIBM)
|
|
|
|
TARGET_LINK_LIBRARIES(makehrtf m)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
INSTALL(TARGETS openal-info makehrtf
|
2008-06-05 02:40:52 +00:00
|
|
|
RUNTIME DESTINATION bin
|
2010-04-11 19:42:47 +00:00
|
|
|
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
|
|
|
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
2008-06-05 02:40:52 +00:00
|
|
|
)
|
2010-07-17 08:02:51 +00:00
|
|
|
MESSAGE(STATUS "Building utility programs")
|
|
|
|
MESSAGE(STATUS "")
|
2008-07-23 07:51:55 +00:00
|
|
|
ENDIF()
|
2012-01-01 20:36:41 +00:00
|
|
|
|
|
|
|
IF(EXAMPLES)
|
|
|
|
IF(FFMPEG_FOUND)
|
2012-10-14 08:55:39 +00:00
|
|
|
ADD_EXECUTABLE(alstream examples/common/alhelpers.c
|
|
|
|
examples/common/alffmpeg.c
|
|
|
|
examples/alstream.c)
|
2012-01-01 20:36:41 +00:00
|
|
|
TARGET_LINK_LIBRARIES(alstream ${FFMPEG_LIBRARIES} ${LIBNAME})
|
|
|
|
SET_TARGET_PROPERTIES(alstream PROPERTIES COMPILE_FLAGS "${FFMPEG_CFLAGS}")
|
2012-10-31 11:04:49 +00:00
|
|
|
|
|
|
|
ADD_EXECUTABLE(alreverb examples/common/alhelpers.c
|
|
|
|
examples/common/alffmpeg.c
|
|
|
|
examples/alreverb.c)
|
|
|
|
TARGET_LINK_LIBRARIES(alreverb ${FFMPEG_LIBRARIES} ${LIBNAME})
|
|
|
|
SET_TARGET_PROPERTIES(alreverb PROPERTIES COMPILE_FLAGS "${FFMPEG_CFLAGS}")
|
|
|
|
|
2012-11-01 05:39:57 +00:00
|
|
|
ADD_EXECUTABLE(allatency examples/common/alhelpers.c
|
|
|
|
examples/common/alffmpeg.c
|
|
|
|
examples/allatency.c)
|
|
|
|
TARGET_LINK_LIBRARIES(allatency ${FFMPEG_LIBRARIES} ${LIBNAME})
|
|
|
|
SET_TARGET_PROPERTIES(allatency PROPERTIES COMPILE_FLAGS "${FFMPEG_CFLAGS}")
|
|
|
|
|
|
|
|
INSTALL(TARGETS alstream alreverb allatency
|
2012-01-01 20:36:41 +00:00
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
|
|
|
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
|
|
|
)
|
|
|
|
|
|
|
|
MESSAGE(STATUS "Building ffmpeg example programs")
|
|
|
|
MESSAGE(STATUS "")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|