1 # CMake build file list for OpenAL
3 CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
7 IF(COMMAND CMAKE_POLICY)
8 CMAKE_POLICY(SET CMP0003 NEW)
9 CMAKE_POLICY(SET CMP0005 NEW)
11 CMAKE_POLICY(SET CMP0020 NEW)
14 CMAKE_POLICY(SET CMP0042 NEW)
17 CMAKE_POLICY(SET CMP0054 NEW)
19 ENDIF(COMMAND CMAKE_POLICY)
21 SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
23 INCLUDE(CheckFunctionExists)
24 INCLUDE(CheckLibraryExists)
25 INCLUDE(CheckSharedFunctionExists)
26 INCLUDE(CheckIncludeFile)
27 INCLUDE(CheckIncludeFiles)
28 INCLUDE(CheckSymbolExists)
29 INCLUDE(CheckCCompilerFlag)
30 INCLUDE(CheckCXXCompilerFlag)
31 INCLUDE(CheckCSourceCompiles)
32 INCLUDE(CheckTypeSize)
33 include(CheckStructHasMember)
34 include(CheckFileOffsetBits)
35 include(GNUInstallDirs)
37 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
40 OPTION(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON)
42 OPTION(ALSOFT_WERROR "Treat compile warnings as errors" OFF)
44 OPTION(ALSOFT_UTILS "Build and install utility programs" ON)
45 OPTION(ALSOFT_NO_CONFIG_UTIL "Disable building the alsoft-config utility" OFF)
47 OPTION(ALSOFT_EXAMPLES "Build and install example programs" ON)
48 OPTION(ALSOFT_TESTS "Build and install test programs" ON)
50 OPTION(ALSOFT_CONFIG "Install alsoft.conf sample configuration file" ON)
51 OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" ON)
52 OPTION(ALSOFT_AMBDEC_PRESETS "Install AmbDec preset files" ON)
53 OPTION(ALSOFT_INSTALL "Install headers and libraries" ON)
55 if(DEFINED SHARE_INSTALL_DIR)
56 message(WARNING "SHARE_INSTALL_DIR is deprecated. Use the variables provided by the GNUInstallDirs module instead")
57 set(CMAKE_INSTALL_DATADIR "${SHARE_INSTALL_DIR}")
60 if(DEFINED LIB_SUFFIX)
61 message(WARNING "LIB_SUFFIX is deprecated. Use the variables provided by the GNUInstallDirs module instead")
65 SET(CPP_DEFS ) # C pre-process, not C++
72 SET(CPP_DEFS ${CPP_DEFS} _WIN32 _WIN32_WINNT=0x0502)
74 OPTION(ALSOFT_BUILD_ROUTER "Build the router (EXPERIMENTAL; creates OpenAL32.dll and soft_oal.dll)" OFF)
76 # This option is mainly for static linking OpenAL Soft into another project
77 # that already defines the IDs. It is up to that project to ensure all
78 # required IDs are defined.
79 OPTION(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF)
82 OPTION(ALSOFT_BUILD_IMPORT_LIB "Build an import .lib using dlltool (requires sed)" ON)
85 SET(DLLTOOL "${HOST}-dlltool")
87 SET(DLLTOOL "dlltool")
94 # QNX's gcc do not uses /usr/include and /usr/lib pathes by default
95 IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
96 SET(INC_PATHS ${INC_PATHS} /usr/include)
97 SET(LINKER_FLAGS ${LINKER_FLAGS} -L/usr/lib)
104 SET(LIB_MAJOR_VERSION "1")
105 SET(LIB_MINOR_VERSION "18")
106 SET(LIB_REVISION "2")
107 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
113 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
114 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
117 CHECK_C_COMPILER_FLAG(-std=c11 HAVE_STD_C11)
119 SET(CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}")
121 CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
123 SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
127 CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD_CXX11)
129 SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
133 # Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions
134 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_DEFAULT)
135 IF(NOT HAVE_POSIX_MEMALIGN_DEFAULT)
136 SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
137 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600")
138 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_POSIX)
139 IF(NOT HAVE_POSIX_MEMALIGN_POSIX)
140 SET(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
142 SET(CPP_DEFS ${CPP_DEFS} _POSIX_C_SOURCE=200112L _XOPEN_SOURCE=600)
145 UNSET(OLD_REQUIRED_FLAGS)
148 # Set defines for large file support
149 CHECK_FILE_OFFSET_BITS()
150 IF(_FILE_OFFSET_BITS)
151 SET(CPP_DEFS ${CPP_DEFS} "_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
152 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
154 SET(CPP_DEFS ${CPP_DEFS} _LARGEFILE_SOURCE _LARGE_FILES)
155 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES")
157 # MSVC may need workarounds for C99 restrict and inline
159 # TODO: Once we truly require C99, these restrict and inline checks should go
161 CHECK_C_SOURCE_COMPILES("int *restrict foo;
162 int main() {return 0;}" HAVE_RESTRICT)
163 IF(NOT HAVE_RESTRICT)
164 SET(CPP_DEFS ${CPP_DEFS} "restrict=")
165 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Drestrict=")
168 CHECK_C_SOURCE_COMPILES("inline void foo(void) { }
169 int main() {return 0;}" HAVE_INLINE)
171 CHECK_C_SOURCE_COMPILES("__inline void foo(void) { }
172 int main() {return 0;}" HAVE___INLINE)
173 IF(NOT HAVE___INLINE)
174 MESSAGE(FATAL_ERROR "No inline keyword found, please report!")
177 SET(CPP_DEFS ${CPP_DEFS} inline=__inline)
178 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Dinline=__inline")
182 # Make sure we have C99-style inline semantics with GCC (4.3 or newer).
183 IF(CMAKE_COMPILER_IS_GNUCC)
184 SET(CMAKE_C_FLAGS "-fno-gnu89-inline ${CMAKE_C_FLAGS}")
186 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
187 # Force no inlining for the next test.
188 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -fno-inline")
190 CHECK_C_SOURCE_COMPILES("extern inline int foo() { return 0; }
191 int main() {return foo();}" INLINE_IS_C99)
192 IF(NOT INLINE_IS_C99)
193 MESSAGE(FATAL_ERROR "Your compiler does not seem to have C99 inline semantics!
194 Please update your compiler for better C99 compliance.")
197 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
200 # Check if we have a proper timespec declaration
201 CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
202 IF(HAVE_STRUCT_TIMESPEC)
203 # Define it here so we don't have to include config.h for it
204 SET(CPP_DEFS ${CPP_DEFS} HAVE_STRUCT_TIMESPEC)
207 # Some systems may need libatomic for C11 atomic functions to work
208 SET(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
209 SET(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES} atomic)
210 CHECK_C_SOURCE_COMPILES("#include <stdatomic.h>
211 int _Atomic foo = ATOMIC_VAR_INIT(0);
214 return atomic_fetch_add(&foo, 2);
217 IF(NOT HAVE_LIBATOMIC)
218 SET(CMAKE_REQUIRED_LIBRARIES "${OLD_REQUIRED_LIBRARIES}")
220 SET(EXTRA_LIBS atomic ${EXTRA_LIBS})
222 UNSET(OLD_REQUIRED_LIBRARIES)
224 # Include liblog for Android logging
225 CHECK_LIBRARY_EXISTS(log __android_log_print "" HAVE_LIBLOG)
227 SET(EXTRA_LIBS log ${EXTRA_LIBS})
228 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} log)
231 # Check if we have C99 bool
232 CHECK_C_SOURCE_COMPILES(
233 "int main(int argc, char *argv[])
236 ret = (argc > 1) ? 1 : 0;
241 # Check if we have C11 static_assert
242 CHECK_C_SOURCE_COMPILES(
245 _Static_assert(sizeof(int) == sizeof(int), \"What\");
248 HAVE_C11_STATIC_ASSERT)
250 # Check if we have C11 alignas
251 CHECK_C_SOURCE_COMPILES(
252 "_Alignas(16) int foo;
259 # Check if we have C11 _Atomic
260 CHECK_C_SOURCE_COMPILES(
261 "#include <stdatomic.h>
262 int _Atomic foo = ATOMIC_VAR_INIT(0);
265 atomic_fetch_add(&foo, 2);
270 # Add definitions, compiler switches, etc.
271 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_SOURCE_DIR}/common" "${OpenAL_BINARY_DIR}")
273 IF(NOT CMAKE_BUILD_TYPE)
274 SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
275 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
278 IF(NOT CMAKE_DEBUG_POSTFIX)
279 SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
280 "Library postfix for debug builds. Normally left blank."
285 SET(CPP_DEFS ${CPP_DEFS} _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
286 SET(C_FLAGS ${C_FLAGS} /wd4098)
289 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
291 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
294 MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
297 OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
298 IF(FORCE_STATIC_VCRT)
300 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
301 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
302 IF(${flag_var} MATCHES "/MD")
303 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
308 SET(C_FLAGS ${C_FLAGS} -Winline -Wall)
309 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
311 SET(C_FLAGS ${C_FLAGS} -Wextra)
315 SET(C_FLAGS ${C_FLAGS} -Werror)
318 # We want RelWithDebInfo to actually include debug stuff (define _DEBUG
320 FOREACH(flag_var CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
321 IF(${flag_var} MATCHES "-DNDEBUG")
322 STRING(REGEX REPLACE "-DNDEBUG" "-D_DEBUG" ${flag_var} "${${flag_var}}")
326 CHECK_C_COMPILER_FLAG(-fno-math-errno HAVE_FNO_MATH_ERRNO)
327 IF(HAVE_FNO_MATH_ERRNO)
328 SET(C_FLAGS ${C_FLAGS} -fno-math-errno)
331 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
332 int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
334 option(ALSOFT_STATIC_LIBGCC "Force -static-libgcc for static GCC runtimes" OFF)
335 if(ALSOFT_STATIC_LIBGCC)
336 set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
337 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -static-libgcc)
338 check_c_source_compiles(
344 HAVE_STATIC_LIBGCC_SWITCH
346 if(HAVE_STATIC_LIBGCC_SWITCH)
347 SET(LINKER_FLAGS ${LINKER_FLAGS} -static-libgcc)
349 set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
350 unset(OLD_REQUIRED_LIBRARIES)
354 # Set visibility/export options if available
356 SET(EXPORT_DECL "__declspec(dllexport)")
358 SET(ALIGN_DECL "__declspec(align(x))")
360 SET(ALIGN_DECL "__declspec(aligned(x))")
363 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
364 # Yes GCC, really don't accept visibility modes you don't support
365 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
367 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
368 int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
369 IF(HAVE_GCC_PROTECTED_VISIBILITY)
370 SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
372 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
373 int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
374 IF(HAVE_GCC_DEFAULT_VISIBILITY)
375 SET(EXPORT_DECL "__attribute__((visibility(\"default\")))")
379 IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
380 CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
381 IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
382 SET(C_FLAGS ${C_FLAGS} -fvisibility=hidden)
386 CHECK_C_SOURCE_COMPILES("int foo __attribute__((aligned(16)));
387 int main() {return 0;}" HAVE_ATTRIBUTE_ALIGNED)
388 IF(HAVE_ATTRIBUTE_ALIGNED)
389 SET(ALIGN_DECL "__attribute__((aligned(x)))")
392 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
395 CHECK_C_SOURCE_COMPILES("
399 ptr = __builtin_assume_aligned(ptr, 16);
401 }" HAVE___BUILTIN_ASSUME_ALIGNED)
402 IF(HAVE___BUILTIN_ASSUME_ALIGNED)
403 SET(ASSUME_ALIGNED_DECL "__builtin_assume_aligned(x, y)")
405 SET(ASSUME_ALIGNED_DECL "x")
411 SET(SSE4_1_SWITCH "")
412 SET(FPU_NEON_SWITCH "")
414 CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
416 SET(SSE_SWITCH "-msse")
418 CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
419 IF(HAVE_MSSE2_SWITCH)
420 SET(SSE2_SWITCH "-msse2")
422 CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH)
423 IF(HAVE_MSSE3_SWITCH)
424 SET(SSE3_SWITCH "-msse3")
426 CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH)
427 IF(HAVE_MSSE4_1_SWITCH)
428 SET(SSE4_1_SWITCH "-msse4.1")
430 CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH)
431 IF(HAVE_MFPU_NEON_SWITCH)
432 SET(FPU_NEON_SWITCH "-mfpu=neon")
436 IF(HAVE_MSSE_SWITCH AND CMAKE_SIZEOF_VOID_P MATCHES "4")
437 OPTION(ALSOFT_ENABLE_SSE_CODEGEN "Enable SSE code generation instead of x87 for 32-bit targets." TRUE)
438 IF(HAVE_MSSE2_SWITCH)
439 OPTION(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE)
442 IF(HAVE_MSSE2_SWITCH AND ALSOFT_ENABLE_SSE2_CODEGEN)
443 CHECK_C_COMPILER_FLAG("${SSE2_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE_2)
444 IF(ALSOFT_ENABLE_SSE2_CODEGEN AND HAVE_MFPMATH_SSE_2)
445 SET(C_FLAGS ${C_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
449 IF(ALSOFT_ENABLE_SSE_CODEGEN AND NOT FPMATH_SET)
450 CHECK_C_COMPILER_FLAG("${SSE_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE)
451 IF(ALSOFT_ENABLE_SSE_CODEGEN AND HAVE_MFPMATH_SSE)
452 SET(C_FLAGS ${C_FLAGS} ${SSE_SWITCH} -mfpmath=sse)
459 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
460 int main() {return 0;}" HAVE_GCC_FORMAT)
462 CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
463 CHECK_INCLUDE_FILE(stdalign.h HAVE_STDALIGN_H)
464 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
465 CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
466 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
467 CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
468 CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
469 CHECK_INCLUDE_FILE(sys/sysconf.h HAVE_SYS_SYSCONF_H)
470 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
471 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
472 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
473 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
474 IF(NOT HAVE_GUIDDEF_H)
475 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
478 # Some systems need libm for some of the following math functions to work
480 CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
482 SET(MATH_LIB ${MATH_LIB} m)
483 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
486 # Check for the dlopen API (for dynamicly loading backend libs)
488 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
490 SET(EXTRA_LIBS dl ${EXTRA_LIBS})
491 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
494 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
497 # Check for a cpuid intrinsic
499 CHECK_C_SOURCE_COMPILES("#include <cpuid.h>
502 unsigned int eax, ebx, ecx, edx;
503 return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
504 }" HAVE_GCC_GET_CPUID)
507 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
513 }" HAVE_CPUID_INTRINSIC)
514 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
517 unsigned long idx = 0;
518 _BitScanForward64(&idx, 1);
520 }" HAVE_BITSCANFORWARD64_INTRINSIC)
521 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
524 unsigned long idx = 0;
525 _BitScanForward(&idx, 1);
527 }" HAVE_BITSCANFORWARD_INTRINSIC)
530 CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF)
531 CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
532 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
533 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
534 CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH)
535 CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
536 CHECK_SYMBOL_EXISTS(modff math.h HAVE_MODFF)
537 CHECK_SYMBOL_EXISTS(log2f math.h HAVE_LOG2F)
538 CHECK_SYMBOL_EXISTS(cbrtf math.h HAVE_CBRTF)
541 CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
542 CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
545 CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
546 CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
547 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
548 IF(NOT HAVE_STRCASECMP)
549 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
550 IF(NOT HAVE__STRICMP)
551 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
554 SET(CPP_DEFS ${CPP_DEFS} strcasecmp=_stricmp)
557 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
558 IF(NOT HAVE_STRNCASECMP)
559 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
560 IF(NOT HAVE__STRNICMP)
561 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
564 SET(CPP_DEFS ${CPP_DEFS} strncasecmp=_strnicmp)
567 CHECK_SYMBOL_EXISTS(strnlen string.h HAVE_STRNLEN)
568 CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
569 IF(NOT HAVE_SNPRINTF)
570 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
571 IF(NOT HAVE__SNPRINTF)
572 MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
575 SET(CPP_DEFS ${CPP_DEFS} snprintf=_snprintf)
578 CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
579 IF(NOT HAVE_ISFINITE)
580 CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
582 CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE)
584 MESSAGE(FATAL_ERROR "No isfinite function found, please report!")
586 SET(CPP_DEFS ${CPP_DEFS} isfinite=_finite)
588 SET(CPP_DEFS ${CPP_DEFS} isfinite=finite)
592 CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
594 CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN)
596 MESSAGE(FATAL_ERROR "No isnan function found, please report!")
599 SET(CPP_DEFS ${CPP_DEFS} isnan=_isnan)
603 # Check if we have Windows headers
604 SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
605 SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
606 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
607 SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
608 UNSET(OLD_REQUIRED_DEFINITIONS)
610 IF(NOT HAVE_WINDOWS_H)
611 CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
612 IF(NOT HAVE_GETTIMEOFDAY)
613 MESSAGE(FATAL_ERROR "No timing function found!")
616 CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
617 IF(NOT HAVE_NANOSLEEP)
618 MESSAGE(FATAL_ERROR "No sleep function found!")
621 # We need pthreads outside of Windows
622 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
623 IF(NOT HAVE_PTHREAD_H)
624 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
626 # Some systems need pthread_np.h to get recursive mutexes
627 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
629 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
631 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
632 SET(C_FLAGS ${C_FLAGS} -pthread)
633 SET(LINKER_FLAGS ${LINKER_FLAGS} -pthread)
636 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
638 SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
641 CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
643 IF(HAVE_PTHREAD_NP_H)
644 CHECK_SYMBOL_EXISTS(pthread_setname_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SETNAME_NP)
645 IF(NOT HAVE_PTHREAD_SETNAME_NP)
646 CHECK_SYMBOL_EXISTS(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
648 CHECK_C_SOURCE_COMPILES("
650 #include <pthread_np.h>
653 pthread_setname_np(\"testname\");
656 PTHREAD_SETNAME_NP_ONE_PARAM
658 CHECK_C_SOURCE_COMPILES("
660 #include <pthread_np.h>
663 pthread_setname_np(pthread_self(), \"%s\", \"testname\");
666 PTHREAD_SETNAME_NP_THREE_PARAMS
669 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
671 CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
672 IF(NOT HAVE_PTHREAD_SETNAME_NP)
673 CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
675 CHECK_C_SOURCE_COMPILES("
679 pthread_setname_np(\"testname\");
682 PTHREAD_SETNAME_NP_ONE_PARAM
684 CHECK_C_SOURCE_COMPILES("
688 pthread_setname_np(pthread_self(), \"%s\", \"testname\");
691 PTHREAD_SETNAME_NP_THREE_PARAMS
694 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
697 CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK)
699 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
701 SET(EXTRA_LIBS rt ${EXTRA_LIBS})
705 CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_GETOPT)
707 # Check for a 64-bit type
708 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
709 IF(NOT HAVE_STDINT_H)
711 CHECK_C_SOURCE_COMPILES("#define _WIN32_WINNT 0x0502
714 int main() {return 0;}" HAVE___INT64)
717 IF(NOT SIZEOF_LONG MATCHES "8")
718 IF(NOT SIZEOF_LONG_LONG MATCHES "8")
719 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
738 common/static_assert.h
745 OpenAL32/Include/bs2b.h
746 OpenAL32/Include/alMain.h
747 OpenAL32/Include/alu.h
749 OpenAL32/Include/alAuxEffectSlot.h
750 OpenAL32/alAuxEffectSlot.c
751 OpenAL32/Include/alBuffer.h
753 OpenAL32/Include/alEffect.h
755 OpenAL32/Include/alError.h
757 OpenAL32/alExtension.c
758 OpenAL32/Include/alFilter.h
760 OpenAL32/Include/alListener.h
761 OpenAL32/alListener.c
762 OpenAL32/Include/alSource.h
766 OpenAL32/Include/sample_cvt.h
767 OpenAL32/sample_cvt.c
782 Alc/effects/autowah.c
784 Alc/effects/compressor.c
785 Alc/effects/dedicated.c
786 Alc/effects/distortion.c
788 Alc/effects/equalizer.c
789 Alc/effects/fshifter.c
790 Alc/effects/modulator.c
792 Alc/effects/pshifter.c
798 Alc/filters/splitter.c
799 Alc/filters/splitter.h
823 SET(CPU_EXTS "Default")
838 SET(HAVE_PORTAUDIO 0)
839 SET(HAVE_PULSEAUDIO 0)
840 SET(HAVE_COREAUDIO 0)
845 # Check for SSE support
846 OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
847 CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
849 OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
850 IF(ALSOFT_CPUEXT_SSE)
851 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
853 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse.c)
855 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse.c PROPERTIES
856 COMPILE_FLAGS "${SSE_SWITCH}")
858 SET(CPU_EXTS "${CPU_EXTS}, SSE")
862 IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
863 MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
866 OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
867 CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
869 OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
870 IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
871 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
873 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse2.c)
875 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse2.c PROPERTIES
876 COMPILE_FLAGS "${SSE2_SWITCH}")
878 SET(CPU_EXTS "${CPU_EXTS}, SSE2")
882 IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
883 MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
886 OPTION(ALSOFT_REQUIRE_SSE3 "Require SSE3 support" OFF)
887 CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}")
889 OPTION(ALSOFT_CPUEXT_SSE3 "Enable SSE3 support" ON)
890 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE3)
891 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
893 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse3.c)
895 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse3.c PROPERTIES
896 COMPILE_FLAGS "${SSE3_SWITCH}")
898 SET(CPU_EXTS "${CPU_EXTS}, SSE3")
902 IF(ALSOFT_REQUIRE_SSE3 AND NOT HAVE_SSE3)
903 MESSAGE(FATAL_ERROR "Failed to enable required SSE3 CPU extensions")
906 OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
907 CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
909 OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
910 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1)
911 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
913 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse41.c)
915 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse41.c PROPERTIES
916 COMPILE_FLAGS "${SSE4_1_SWITCH}")
918 SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
922 IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
923 MESSAGE(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
926 # Check for ARM Neon support
927 OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
928 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H ${FPU_NEON_SWITCH})
930 OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON)
931 IF(ALSOFT_CPUEXT_NEON)
933 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_neon.c)
935 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_neon.c PROPERTIES
936 COMPILE_FLAGS "${FPU_NEON_SWITCH}")
938 SET(CPU_EXTS "${CPU_EXTS}, Neon")
941 IF(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
942 MESSAGE(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
946 IF(WIN32 OR HAVE_DLFCN_H)
948 MACRO(ADD_BACKEND_LIBS _LIBS)
951 SET(IS_LINKED " (linked)")
952 MACRO(ADD_BACKEND_LIBS _LIBS)
953 SET(EXTRA_LIBS ${_LIBS} ${EXTRA_LIBS})
958 SET(ALC_OBJS ${ALC_OBJS}
961 # Default backends, always available
962 Alc/backends/loopback.c
967 OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
970 OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
971 IF(ALSOFT_BACKEND_ALSA)
973 SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
974 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c)
975 ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
976 SET(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS})
979 IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
980 MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend")
984 OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
987 OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
988 IF(ALSOFT_BACKEND_OSS)
990 SET(BACKENDS "${BACKENDS} OSS,")
991 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
993 SET(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS})
995 SET(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS})
998 IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
999 MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend")
1002 # Check Solaris backend
1003 OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
1004 FIND_PACKAGE(AudioIO)
1006 OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
1007 IF(ALSOFT_BACKEND_SOLARIS)
1009 SET(BACKENDS "${BACKENDS} Solaris,")
1010 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
1011 SET(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS})
1014 IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
1015 MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend")
1018 # Check SndIO backend
1019 OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
1020 FIND_PACKAGE(SoundIO)
1022 OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
1023 IF(ALSOFT_BACKEND_SNDIO)
1025 SET(BACKENDS "${BACKENDS} SndIO (linked),")
1026 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c)
1027 SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
1028 SET(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS})
1031 IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
1032 MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend")
1036 OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF)
1039 OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON)
1040 IF(ALSOFT_BACKEND_QSA)
1042 SET(BACKENDS "${BACKENDS} QSA (linked),")
1043 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c)
1044 SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
1045 SET(INC_PATHS ${INC_PATHS} ${QSA_INCLUDE_DIRS})
1048 IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA)
1049 MESSAGE(FATAL_ERROR "Failed to enabled required QSA backend")
1052 # Check Windows-only backends
1053 OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
1054 OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
1055 OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF)
1057 SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
1058 SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
1060 # Check MMSystem backend
1061 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
1063 CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
1065 OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
1066 IF(ALSOFT_BACKEND_WINMM)
1068 SET(BACKENDS "${BACKENDS} WinMM,")
1069 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
1070 SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
1075 # Check DSound backend
1076 FIND_PACKAGE(DSound)
1078 OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
1079 IF(ALSOFT_BACKEND_DSOUND)
1081 SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
1082 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c)
1083 ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
1084 SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS})
1088 # Check for WASAPI backend
1089 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
1090 IF(HAVE_MMDEVICEAPI_H)
1091 OPTION(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON)
1092 IF(ALSOFT_BACKEND_WASAPI)
1094 SET(BACKENDS "${BACKENDS} WASAPI,")
1095 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wasapi.c)
1099 SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
1100 UNSET(OLD_REQUIRED_DEFINITIONS)
1102 IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
1103 MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")
1105 IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND)
1106 MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend")
1108 IF(ALSOFT_REQUIRE_WASAPI AND NOT HAVE_WASAPI)
1109 MESSAGE(FATAL_ERROR "Failed to enabled required WASAPI backend")
1112 # Check PortAudio backend
1113 OPTION(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
1114 FIND_PACKAGE(PortAudio)
1116 OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
1117 IF(ALSOFT_BACKEND_PORTAUDIO)
1118 SET(HAVE_PORTAUDIO 1)
1119 SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
1120 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c)
1121 ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
1122 SET(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS})
1125 IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
1126 MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend")
1129 # Check PulseAudio backend
1130 OPTION(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
1131 FIND_PACKAGE(PulseAudio)
1132 IF(PULSEAUDIO_FOUND)
1133 OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
1134 IF(ALSOFT_BACKEND_PULSEAUDIO)
1135 SET(HAVE_PULSEAUDIO 1)
1136 SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
1137 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c)
1138 ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
1139 SET(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS})
1142 IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
1143 MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend")
1146 # Check JACK backend
1147 OPTION(ALSOFT_REQUIRE_JACK "Require JACK backend" OFF)
1150 OPTION(ALSOFT_BACKEND_JACK "Enable JACK backend" ON)
1151 IF(ALSOFT_BACKEND_JACK)
1153 SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
1154 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.c)
1155 ADD_BACKEND_LIBS(${JACK_LIBRARIES})
1156 SET(INC_PATHS ${INC_PATHS} ${JACK_INCLUDE_DIRS})
1159 IF(ALSOFT_REQUIRE_JACK AND NOT HAVE_JACK)
1160 MESSAGE(FATAL_ERROR "Failed to enabled required JACK backend")
1163 # Check CoreAudio backend
1164 OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
1165 FIND_LIBRARY(COREAUDIO_FRAMEWORK
1167 PATHS /System/Library/Frameworks
1169 IF(COREAUDIO_FRAMEWORK)
1170 OPTION(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
1171 IF(ALSOFT_BACKEND_COREAUDIO)
1172 SET(HAVE_COREAUDIO 1)
1173 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c)
1174 SET(BACKENDS "${BACKENDS} CoreAudio,")
1175 SET(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${EXTRA_LIBS})
1176 SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
1177 SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
1179 # Some versions of OSX may need the AudioToolbox framework. Add it if
1181 FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
1183 PATHS ~/Library/Frameworks
1185 /System/Library/Frameworks
1187 IF(AUDIOTOOLBOX_LIBRARY)
1188 SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
1192 IF(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
1193 MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend")
1196 # Check for OpenSL (Android) backend
1197 OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
1198 CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
1199 IF(HAVE_SLES_OPENSLES_ANDROID_H)
1200 CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
1201 IF(HAVE_LIBOPENSLES)
1202 OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
1203 IF(ALSOFT_BACKEND_OPENSL)
1205 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c)
1206 SET(BACKENDS "${BACKENDS} OpenSL,")
1207 SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
1211 IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
1212 MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
1215 # Check for SDL2 backend
1216 OPTION(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF)
1219 # Off by default, since it adds a runtime dependency
1220 OPTION(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF)
1221 IF(ALSOFT_BACKEND_SDL2)
1223 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sdl2.c)
1224 SET(BACKENDS "${BACKENDS} SDL2,")
1225 SET(EXTRA_LIBS ${SDL2_LIBRARY} ${EXTRA_LIBS})
1226 SET(INC_PATHS ${INC_PATHS} ${SDL2_INCLUDE_DIR})
1229 IF(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND)
1230 MESSAGE(FATAL_ERROR "Failed to enabled required SDL2 backend")
1233 # Optionally enable the Wave Writer backend
1234 OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
1235 IF(ALSOFT_BACKEND_WAVE)
1237 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c)
1238 SET(BACKENDS "${BACKENDS} WaveFile,")
1241 # This is always available
1242 SET(BACKENDS "${BACKENDS} Null")
1246 IF(GIT_FOUND AND EXISTS "${OpenAL_SOURCE_DIR}/.git")
1247 # Get the current working branch and its latest abbreviated commit hash
1248 ADD_CUSTOM_TARGET(build_version
1249 ${CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE}
1250 -D LIB_VERSION=${LIB_VERSION}
1251 -D SRC=${OpenAL_SOURCE_DIR}/version.h.in
1252 -D DST=${OpenAL_BINARY_DIR}/version.h
1253 -P ${OpenAL_SOURCE_DIR}/version.cmake
1254 WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
1258 SET(GIT_BRANCH "UNKNOWN")
1259 SET(GIT_COMMIT_HASH "unknown")
1261 "${OpenAL_SOURCE_DIR}/version.h.in"
1262 "${OpenAL_BINARY_DIR}/version.h")
1265 SET(NATIVE_SRC_DIR "${OpenAL_SOURCE_DIR}/native-tools/")
1266 SET(NATIVE_BIN_DIR "${OpenAL_BINARY_DIR}/native-tools/")
1267 FILE(MAKE_DIRECTORY "${NATIVE_BIN_DIR}")
1269 SET(BIN2H_COMMAND "${NATIVE_BIN_DIR}bin2h")
1270 SET(BSINCGEN_COMMAND "${NATIVE_BIN_DIR}bsincgen")
1271 ADD_CUSTOM_COMMAND(OUTPUT "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1272 COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "${NATIVE_SRC_DIR}"
1273 COMMAND ${CMAKE_COMMAND} -E remove "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1274 COMMAND ${CMAKE_COMMAND} --build . --config "Release"
1275 WORKING_DIRECTORY "${NATIVE_BIN_DIR}"
1276 DEPENDS "${NATIVE_SRC_DIR}CMakeLists.txt"
1277 IMPLICIT_DEPENDS C "${NATIVE_SRC_DIR}bin2h.c"
1278 C "${NATIVE_SRC_DIR}bsincgen.c"
1281 ADD_CUSTOM_TARGET(native-tools
1282 DEPENDS "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1286 option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" OFF)
1287 if(ALSOFT_EMBED_HRTF_DATA)
1288 MACRO(make_hrtf_header FILENAME VARNAME)
1289 SET(infile "${OpenAL_SOURCE_DIR}/hrtf/${FILENAME}")
1290 SET(outfile "${OpenAL_BINARY_DIR}/${FILENAME}.h")
1292 ADD_CUSTOM_COMMAND(OUTPUT "${outfile}"
1293 COMMAND "${BIN2H_COMMAND}" "${infile}" "${outfile}" ${VARNAME}
1294 DEPENDS native-tools "${infile}"
1297 SET(ALC_OBJS ${ALC_OBJS} "${outfile}")
1300 make_hrtf_header(default-44100.mhr "hrtf_default_44100")
1301 make_hrtf_header(default-48000.mhr "hrtf_default_48000")
1304 ADD_CUSTOM_COMMAND(OUTPUT "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1305 COMMAND "${BSINCGEN_COMMAND}" "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1306 DEPENDS native-tools "${NATIVE_SRC_DIR}bsincgen.c"
1309 SET(ALC_OBJS ${ALC_OBJS} "${OpenAL_BINARY_DIR}/bsinc_inc.h")
1312 IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL)
1313 add_subdirectory(utils/alsoft-config)
1320 FIND_PACKAGE(SDL_sound)
1321 FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE)
1326 SET(LIBNAME "openal")
1328 SET(LIBNAME "OpenAL32")
1331 # Needed for openal.pc.in
1332 SET(prefix ${CMAKE_INSTALL_PREFIX})
1333 SET(exec_prefix "\${prefix}")
1334 SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
1335 SET(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
1336 SET(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
1337 SET(PACKAGE_VERSION "${LIB_VERSION}")
1338 SET(PKG_CONFIG_CFLAGS )
1339 SET(PKG_CONFIG_PRIVATE_LIBS )
1340 IF(LIBTYPE STREQUAL "STATIC")
1341 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC)
1342 FOREACH(FLAG ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
1343 # If this is already a linker flag, or is a full path+file, add it
1344 # as-is. Otherwise, it's a name intended to be dressed as -lname.
1345 IF(FLAG MATCHES "^-.*" OR EXISTS "${FLAG}")
1346 SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} ${FLAG}")
1348 SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} -l${FLAG}")
1355 "${OpenAL_SOURCE_DIR}/config.h.in"
1356 "${OpenAL_BINARY_DIR}/config.h")
1358 "${OpenAL_SOURCE_DIR}/openal.pc.in"
1359 "${OpenAL_BINARY_DIR}/openal.pc"
1363 # Add a static library with common functions used by multiple targets
1364 ADD_LIBRARY(common STATIC ${COMMON_OBJS})
1365 TARGET_COMPILE_DEFINITIONS(common PRIVATE ${CPP_DEFS})
1366 TARGET_COMPILE_OPTIONS(common PRIVATE ${C_FLAGS})
1370 SET(IMPL_TARGET OpenAL)
1374 # Build main library
1375 IF(LIBTYPE STREQUAL "STATIC")
1376 SET(CPP_DEFS ${CPP_DEFS} AL_LIBTYPE_STATIC)
1377 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
1378 SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS)
1380 ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
1382 # Make sure to compile the common code with PIC, since it'll be linked into
1383 # shared libs that needs it.
1384 SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE)
1385 SET(COMMON_LIB common)
1389 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "/SUBSYSTEM:WINDOWS")
1390 ELSEIF(CMAKE_COMPILER_IS_GNUCC)
1391 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "-mwindows")
1395 IF(WIN32 AND ALSOFT_BUILD_ROUTER)
1396 ADD_LIBRARY(OpenAL SHARED router/router.c router/router.h router/alc.c router/al.c)
1397 TARGET_COMPILE_DEFINITIONS(OpenAL
1398 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1399 TARGET_COMPILE_OPTIONS(OpenAL PRIVATE ${C_FLAGS})
1400 TARGET_LINK_LIBRARIES(OpenAL PRIVATE ${LINKER_FLAGS} ${COMMON_LIB})
1401 SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "")
1402 SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME})
1403 IF(TARGET build_version)
1404 ADD_DEPENDENCIES(OpenAL build_version)
1408 SET(LIBNAME "soft_oal")
1409 SET(IMPL_TARGET soft_oal)
1412 ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS})
1414 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "")
1417 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME}
1418 VERSION ${LIB_VERSION}
1419 SOVERSION ${LIB_MAJOR_VERSION}
1421 TARGET_COMPILE_DEFINITIONS(${IMPL_TARGET}
1422 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1423 TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET}
1424 PRIVATE "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc" ${INC_PATHS})
1425 TARGET_COMPILE_OPTIONS(${IMPL_TARGET} PRIVATE ${C_FLAGS})
1426 TARGET_LINK_LIBRARIES(${IMPL_TARGET}
1427 PRIVATE ${LINKER_FLAGS} ${COMMON_LIB} ${EXTRA_LIBS} ${MATH_LIB})
1428 IF(TARGET build_version)
1429 ADD_DEPENDENCIES(${IMPL_TARGET} build_version)
1432 IF(WIN32 AND MINGW AND ALSOFT_BUILD_IMPORT_LIB AND NOT LIBTYPE STREQUAL "STATIC")
1433 FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable")
1434 FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable")
1435 IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE)
1437 IF(NOT SED_EXECUTABLE)
1438 MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation")
1440 IF(NOT DLLTOOL_EXECUTABLE)
1441 MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation")
1444 SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS
1445 " -Wl,--output-def,OpenAL32.def")
1446 ADD_CUSTOM_COMMAND(TARGET OpenAL POST_BUILD
1447 COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def
1448 COMMAND "${DLLTOOL_EXECUTABLE}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll
1449 COMMENT "Stripping ordinals from OpenAL32.def and generating OpenAL32.lib..."
1456 INSTALL(TARGETS OpenAL EXPORT OpenAL
1457 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1458 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1459 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1460 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL
1462 EXPORT(TARGETS OpenAL
1464 FILE OpenALConfig.cmake)
1465 INSTALL(EXPORT OpenAL
1466 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL
1468 FILE OpenALConfig.cmake)
1469 INSTALL(FILES include/AL/al.h
1473 include/AL/efx-creative.h
1474 include/AL/efx-presets.h
1475 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/AL
1477 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
1478 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
1480 INSTALL(TARGETS soft_oal
1481 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1489 message(STATUS "Building DLL router")
1493 MESSAGE(STATUS "Building OpenAL with support for the following backends:")
1494 MESSAGE(STATUS " ${BACKENDS}")
1496 MESSAGE(STATUS "Building with support for CPU extensions:")
1497 MESSAGE(STATUS " ${CPU_EXTS}")
1500 MESSAGE(STATUS "Building with SSE${FPMATH_SET} codegen")
1506 MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
1507 MESSAGE(STATUS " This is probably NOT what you want!")
1512 if(ALSOFT_EMBED_HRTF_DATA)
1513 message(STATUS "Embedding HRTF datasets")
1517 # Install alsoft.conf configuration file
1519 INSTALL(FILES alsoftrc.sample
1520 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal
1522 MESSAGE(STATUS "Installing sample configuration")
1526 # Install HRTF definitions
1527 IF(ALSOFT_HRTF_DEFS)
1528 INSTALL(FILES hrtf/default-44100.mhr
1529 hrtf/default-48000.mhr
1530 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/hrtf
1532 MESSAGE(STATUS "Installing HRTF definitions")
1536 # Install AmbDec presets
1537 IF(ALSOFT_AMBDEC_PRESETS)
1538 INSTALL(FILES presets/3D7.1.ambdec
1539 presets/hexagon.ambdec
1540 presets/itu5.1.ambdec
1541 presets/itu5.1-nocenter.ambdec
1542 presets/rectangle.ambdec
1543 presets/square.ambdec
1545 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/presets
1547 MESSAGE(STATUS "Installing AmbDec presets")
1552 ADD_EXECUTABLE(openal-info utils/openal-info.c)
1553 TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS})
1554 TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL)
1556 SET(MAKEHRTF_SRCS utils/makehrtf.c)
1558 SET(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c utils/getopt.h)
1560 ADD_EXECUTABLE(makehrtf ${MAKEHRTF_SRCS})
1561 TARGET_COMPILE_DEFINITIONS(makehrtf PRIVATE ${CPP_DEFS})
1562 TARGET_COMPILE_OPTIONS(makehrtf PRIVATE ${C_FLAGS})
1564 TARGET_LINK_LIBRARIES(makehrtf PRIVATE ${LINKER_FLAGS} m)
1568 INSTALL(TARGETS openal-info makehrtf
1569 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1570 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1571 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1575 MESSAGE(STATUS "Building utility programs")
1576 IF(TARGET alsoft-config)
1577 MESSAGE(STATUS "Building configuration program")
1583 SET(TEST_COMMON_OBJS examples/common/alhelpers.c)
1585 ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS})
1586 TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS})
1587 TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS})
1588 TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB})
1591 INSTALL(TARGETS altonegen
1592 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1593 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1594 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1598 MESSAGE(STATUS "Building test programs")
1603 ADD_EXECUTABLE(alrecord examples/alrecord.c)
1604 TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS})
1605 TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS})
1606 TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL)
1609 INSTALL(TARGETS alrecord
1610 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1611 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1612 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1616 MESSAGE(STATUS "Building example programs")
1620 # Add a static library with common functions used by multiple targets
1621 ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c)
1622 TARGET_COMPILE_DEFINITIONS(ex-common PRIVATE ${CPP_DEFS})
1623 TARGET_COMPILE_OPTIONS(ex-common PRIVATE ${C_FLAGS})
1625 ADD_EXECUTABLE(alplay examples/alplay.c)
1626 TARGET_COMPILE_DEFINITIONS(alplay PRIVATE ${CPP_DEFS})
1627 TARGET_INCLUDE_DIRECTORIES(alplay
1628 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1629 TARGET_COMPILE_OPTIONS(alplay PRIVATE ${C_FLAGS})
1630 TARGET_LINK_LIBRARIES(alplay
1631 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1634 ADD_EXECUTABLE(alstream examples/alstream.c)
1635 TARGET_COMPILE_DEFINITIONS(alstream PRIVATE ${CPP_DEFS})
1636 TARGET_INCLUDE_DIRECTORIES(alstream
1637 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1638 TARGET_COMPILE_OPTIONS(alstream PRIVATE ${C_FLAGS})
1639 TARGET_LINK_LIBRARIES(alstream
1640 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1643 ADD_EXECUTABLE(alreverb examples/alreverb.c)
1644 TARGET_COMPILE_DEFINITIONS(alreverb PRIVATE ${CPP_DEFS})
1645 TARGET_INCLUDE_DIRECTORIES(alreverb
1646 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1647 TARGET_COMPILE_OPTIONS(alreverb PRIVATE ${C_FLAGS})
1648 TARGET_LINK_LIBRARIES(alreverb
1649 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1652 ADD_EXECUTABLE(almultireverb examples/almultireverb.c)
1653 TARGET_COMPILE_DEFINITIONS(almultireverb PRIVATE ${CPP_DEFS})
1654 TARGET_INCLUDE_DIRECTORIES(almultireverb
1655 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1656 TARGET_COMPILE_OPTIONS(almultireverb PRIVATE ${C_FLAGS})
1657 TARGET_LINK_LIBRARIES(almultireverb
1658 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1661 ADD_EXECUTABLE(allatency examples/allatency.c)
1662 TARGET_COMPILE_DEFINITIONS(allatency PRIVATE ${CPP_DEFS})
1663 TARGET_INCLUDE_DIRECTORIES(allatency
1664 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1665 TARGET_COMPILE_OPTIONS(allatency PRIVATE ${C_FLAGS})
1666 TARGET_LINK_LIBRARIES(allatency
1667 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1670 ADD_EXECUTABLE(alloopback examples/alloopback.c)
1671 TARGET_COMPILE_DEFINITIONS(alloopback PRIVATE ${CPP_DEFS})
1672 TARGET_INCLUDE_DIRECTORIES(alloopback
1673 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1674 TARGET_COMPILE_OPTIONS(alloopback PRIVATE ${C_FLAGS})
1675 TARGET_LINK_LIBRARIES(alloopback
1676 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1679 ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
1680 TARGET_COMPILE_DEFINITIONS(alhrtf PRIVATE ${CPP_DEFS})
1681 TARGET_INCLUDE_DIRECTORIES(alhrtf
1682 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1683 TARGET_COMPILE_OPTIONS(alhrtf PRIVATE ${C_FLAGS})
1684 TARGET_LINK_LIBRARIES(alhrtf
1685 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1689 INSTALL(TARGETS alplay alstream alreverb almultireverb allatency alloopback alhrtf
1690 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1691 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1692 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1696 MESSAGE(STATUS "Building SDL_sound example programs")
1702 IF(AVFORMAT_VERSION VERSION_LESS "57.56.101")
1703 MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 57.56.101)")
1706 IF(AVCODEC_VERSION VERSION_LESS "57.64.101")
1707 MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 57.64.101)")
1710 IF(AVUTIL_VERSION VERSION_LESS "55.34.101")
1711 MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 55.34.101)")
1714 IF(SWSCALE_VERSION VERSION_LESS "4.2.100")
1715 MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 4.2.100)")
1718 IF(SWRESAMPLE_VERSION VERSION_LESS "2.3.100")
1719 MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 2.3.100)")
1724 ADD_EXECUTABLE(alffplay examples/alffplay.cpp)
1725 TARGET_COMPILE_DEFINITIONS(alffplay PRIVATE ${CPP_DEFS})
1726 TARGET_INCLUDE_DIRECTORIES(alffplay
1727 PRIVATE ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
1728 TARGET_COMPILE_OPTIONS(alffplay PRIVATE ${C_FLAGS})
1729 TARGET_LINK_LIBRARIES(alffplay
1730 PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} common OpenAL)
1733 INSTALL(TARGETS alffplay
1734 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1735 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1736 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1739 MESSAGE(STATUS "Building SDL+FFmpeg example programs")