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 "19")
106 SET(LIB_REVISION "0")
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(CMAKE_SIZEOF_VOID_P MATCHES "4")
437 IF(SSE_SWITCH OR MSVC)
438 OPTION(ALSOFT_ENABLE_SSE_CODEGEN "Enable SSE code generation instead of x87 for 32-bit targets." TRUE)
440 IF(SSE2_SWITCH OR MSVC)
441 OPTION(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE)
444 IF(ALSOFT_ENABLE_SSE2_CODEGEN)
446 CHECK_C_COMPILER_FLAG("${SSE2_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE_2)
447 IF(HAVE_MFPMATH_SSE_2)
448 SET(C_FLAGS ${C_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
452 CHECK_C_COMPILER_FLAG("/arch:SSE2" HAVE_ARCH_SSE2)
454 SET(C_FLAGS ${C_FLAGS} "/arch:SSE2")
459 IF(ALSOFT_ENABLE_SSE_CODEGEN AND NOT FPMATH_SET)
461 CHECK_C_COMPILER_FLAG("${SSE_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE)
463 SET(C_FLAGS ${C_FLAGS} ${SSE_SWITCH} -mfpmath=sse)
467 CHECK_C_COMPILER_FLAG("/arch:SSE" HAVE_ARCH_SSE)
469 SET(C_FLAGS ${C_FLAGS} "/arch:SSE")
477 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
478 int main() {return 0;}" HAVE_GCC_FORMAT)
480 CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
481 CHECK_INCLUDE_FILE(stdalign.h HAVE_STDALIGN_H)
482 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
483 CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
484 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
485 CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
486 CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
487 CHECK_INCLUDE_FILE(sys/sysconf.h HAVE_SYS_SYSCONF_H)
488 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
489 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
490 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
491 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
492 IF(NOT HAVE_GUIDDEF_H)
493 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
496 # Some systems need libm for some of the following math functions to work
498 CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
500 SET(MATH_LIB ${MATH_LIB} m)
501 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
504 # Check for the dlopen API (for dynamicly loading backend libs)
506 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
508 SET(EXTRA_LIBS dl ${EXTRA_LIBS})
509 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
512 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
515 # Check for a cpuid intrinsic
517 CHECK_C_SOURCE_COMPILES("#include <cpuid.h>
520 unsigned int eax, ebx, ecx, edx;
521 return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
522 }" HAVE_GCC_GET_CPUID)
525 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
531 }" HAVE_CPUID_INTRINSIC)
532 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
535 unsigned long idx = 0;
536 _BitScanForward64(&idx, 1);
538 }" HAVE_BITSCANFORWARD64_INTRINSIC)
539 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
542 unsigned long idx = 0;
543 _BitScanForward(&idx, 1);
545 }" HAVE_BITSCANFORWARD_INTRINSIC)
548 CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF)
549 CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
550 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
551 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
552 CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH)
553 CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
554 CHECK_SYMBOL_EXISTS(modff math.h HAVE_MODFF)
555 CHECK_SYMBOL_EXISTS(log2f math.h HAVE_LOG2F)
556 CHECK_SYMBOL_EXISTS(cbrtf math.h HAVE_CBRTF)
557 CHECK_SYMBOL_EXISTS(copysignf math.h HAVE_COPYSIGNF)
560 CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
561 CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
564 CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
565 CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
566 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
567 IF(NOT HAVE_STRCASECMP)
568 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
569 IF(NOT HAVE__STRICMP)
570 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
573 SET(CPP_DEFS ${CPP_DEFS} strcasecmp=_stricmp)
576 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
577 IF(NOT HAVE_STRNCASECMP)
578 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
579 IF(NOT HAVE__STRNICMP)
580 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
583 SET(CPP_DEFS ${CPP_DEFS} strncasecmp=_strnicmp)
586 CHECK_SYMBOL_EXISTS(strnlen string.h HAVE_STRNLEN)
587 CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
588 IF(NOT HAVE_SNPRINTF)
589 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
590 IF(NOT HAVE__SNPRINTF)
591 MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
594 SET(CPP_DEFS ${CPP_DEFS} snprintf=_snprintf)
597 CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
598 IF(NOT HAVE_ISFINITE)
599 CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
601 CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE)
603 MESSAGE(FATAL_ERROR "No isfinite function found, please report!")
605 SET(CPP_DEFS ${CPP_DEFS} isfinite=_finite)
607 SET(CPP_DEFS ${CPP_DEFS} isfinite=finite)
611 CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
613 CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN)
615 MESSAGE(FATAL_ERROR "No isnan function found, please report!")
618 SET(CPP_DEFS ${CPP_DEFS} isnan=_isnan)
622 # Check if we have Windows headers
623 SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
624 SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
625 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
626 SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
627 UNSET(OLD_REQUIRED_DEFINITIONS)
629 IF(NOT HAVE_WINDOWS_H)
630 CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
631 IF(NOT HAVE_GETTIMEOFDAY)
632 MESSAGE(FATAL_ERROR "No timing function found!")
635 CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
636 IF(NOT HAVE_NANOSLEEP)
637 MESSAGE(FATAL_ERROR "No sleep function found!")
640 # We need pthreads outside of Windows
641 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
642 IF(NOT HAVE_PTHREAD_H)
643 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
645 # Some systems need pthread_np.h to get recursive mutexes
646 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
648 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
650 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
651 SET(C_FLAGS ${C_FLAGS} -pthread)
652 SET(LINKER_FLAGS ${LINKER_FLAGS} -pthread)
655 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
657 SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
660 CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
662 IF(HAVE_PTHREAD_NP_H)
663 CHECK_SYMBOL_EXISTS(pthread_setname_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SETNAME_NP)
664 IF(NOT HAVE_PTHREAD_SETNAME_NP)
665 CHECK_SYMBOL_EXISTS(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
667 CHECK_C_SOURCE_COMPILES("
669 #include <pthread_np.h>
672 pthread_setname_np(\"testname\");
675 PTHREAD_SETNAME_NP_ONE_PARAM
677 CHECK_C_SOURCE_COMPILES("
679 #include <pthread_np.h>
682 pthread_setname_np(pthread_self(), \"%s\", \"testname\");
685 PTHREAD_SETNAME_NP_THREE_PARAMS
688 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
690 CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
691 IF(NOT HAVE_PTHREAD_SETNAME_NP)
692 CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
694 CHECK_C_SOURCE_COMPILES("
698 pthread_setname_np(\"testname\");
701 PTHREAD_SETNAME_NP_ONE_PARAM
703 CHECK_C_SOURCE_COMPILES("
707 pthread_setname_np(pthread_self(), \"%s\", \"testname\");
710 PTHREAD_SETNAME_NP_THREE_PARAMS
713 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
716 CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK)
718 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
720 SET(EXTRA_LIBS rt ${EXTRA_LIBS})
724 CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_GETOPT)
726 # Check for a 64-bit type
727 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
728 IF(NOT HAVE_STDINT_H)
730 CHECK_C_SOURCE_COMPILES("#define _WIN32_WINNT 0x0502
733 int main() {return 0;}" HAVE___INT64)
736 IF(NOT SIZEOF_LONG MATCHES "8")
737 IF(NOT SIZEOF_LONG_LONG MATCHES "8")
738 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
757 common/static_assert.h
764 OpenAL32/Include/bs2b.h
765 OpenAL32/Include/alMain.h
766 OpenAL32/Include/alu.h
768 OpenAL32/Include/alAuxEffectSlot.h
769 OpenAL32/alAuxEffectSlot.c
770 OpenAL32/Include/alBuffer.h
772 OpenAL32/Include/alEffect.h
774 OpenAL32/Include/alError.h
776 OpenAL32/alExtension.c
777 OpenAL32/Include/alFilter.h
779 OpenAL32/Include/alListener.h
780 OpenAL32/alListener.c
781 OpenAL32/Include/alSource.h
785 OpenAL32/Include/sample_cvt.h
786 OpenAL32/sample_cvt.c
801 Alc/effects/autowah.c
803 Alc/effects/compressor.c
804 Alc/effects/dedicated.c
805 Alc/effects/distortion.c
807 Alc/effects/equalizer.c
808 Alc/effects/fshifter.c
809 Alc/effects/modulator.c
811 Alc/effects/pshifter.c
817 Alc/filters/splitter.c
818 Alc/filters/splitter.h
842 SET(CPU_EXTS "Default")
857 SET(HAVE_PORTAUDIO 0)
858 SET(HAVE_PULSEAUDIO 0)
859 SET(HAVE_COREAUDIO 0)
864 # Check for SSE support
865 OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
866 CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
868 OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
869 IF(ALSOFT_CPUEXT_SSE)
870 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
872 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse.c)
874 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse.c PROPERTIES
875 COMPILE_FLAGS "${SSE_SWITCH}")
877 SET(CPU_EXTS "${CPU_EXTS}, SSE")
881 IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
882 MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
885 OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
886 CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
888 OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
889 IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
890 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
892 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse2.c)
894 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse2.c PROPERTIES
895 COMPILE_FLAGS "${SSE2_SWITCH}")
897 SET(CPU_EXTS "${CPU_EXTS}, SSE2")
901 IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
902 MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
905 OPTION(ALSOFT_REQUIRE_SSE3 "Require SSE3 support" OFF)
906 CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}")
908 OPTION(ALSOFT_CPUEXT_SSE3 "Enable SSE3 support" ON)
909 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE3)
910 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
912 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse3.c)
914 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse3.c PROPERTIES
915 COMPILE_FLAGS "${SSE3_SWITCH}")
917 SET(CPU_EXTS "${CPU_EXTS}, SSE3")
921 IF(ALSOFT_REQUIRE_SSE3 AND NOT HAVE_SSE3)
922 MESSAGE(FATAL_ERROR "Failed to enable required SSE3 CPU extensions")
925 OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
926 CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
928 OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
929 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1)
930 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
932 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse41.c)
934 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse41.c PROPERTIES
935 COMPILE_FLAGS "${SSE4_1_SWITCH}")
937 SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
941 IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
942 MESSAGE(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
945 # Check for ARM Neon support
946 OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
947 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H ${FPU_NEON_SWITCH})
949 OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON)
950 IF(ALSOFT_CPUEXT_NEON)
952 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_neon.c)
954 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_neon.c PROPERTIES
955 COMPILE_FLAGS "${FPU_NEON_SWITCH}")
957 SET(CPU_EXTS "${CPU_EXTS}, Neon")
960 IF(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
961 MESSAGE(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
965 IF(WIN32 OR HAVE_DLFCN_H)
967 MACRO(ADD_BACKEND_LIBS _LIBS)
970 SET(IS_LINKED " (linked)")
971 MACRO(ADD_BACKEND_LIBS _LIBS)
972 SET(EXTRA_LIBS ${_LIBS} ${EXTRA_LIBS})
977 SET(ALC_OBJS ${ALC_OBJS}
980 # Default backends, always available
981 Alc/backends/loopback.c
986 OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
989 OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
990 IF(ALSOFT_BACKEND_ALSA)
992 SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
993 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c)
994 ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
995 SET(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS})
998 IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
999 MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend")
1003 OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
1006 OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
1007 IF(ALSOFT_BACKEND_OSS)
1009 SET(BACKENDS "${BACKENDS} OSS,")
1010 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
1012 SET(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS})
1014 SET(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS})
1017 IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
1018 MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend")
1021 # Check Solaris backend
1022 OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
1023 FIND_PACKAGE(AudioIO)
1025 OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
1026 IF(ALSOFT_BACKEND_SOLARIS)
1028 SET(BACKENDS "${BACKENDS} Solaris,")
1029 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
1030 SET(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS})
1033 IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
1034 MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend")
1037 # Check SndIO backend
1038 OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
1039 FIND_PACKAGE(SoundIO)
1041 OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
1042 IF(ALSOFT_BACKEND_SNDIO)
1044 SET(BACKENDS "${BACKENDS} SndIO (linked),")
1045 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c)
1046 SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
1047 SET(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS})
1050 IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
1051 MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend")
1055 OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF)
1058 OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON)
1059 IF(ALSOFT_BACKEND_QSA)
1061 SET(BACKENDS "${BACKENDS} QSA (linked),")
1062 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c)
1063 SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
1064 SET(INC_PATHS ${INC_PATHS} ${QSA_INCLUDE_DIRS})
1067 IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA)
1068 MESSAGE(FATAL_ERROR "Failed to enabled required QSA backend")
1071 # Check Windows-only backends
1072 OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
1073 OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
1074 OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF)
1076 SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
1077 SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
1079 # Check MMSystem backend
1080 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
1082 CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
1084 OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
1085 IF(ALSOFT_BACKEND_WINMM)
1087 SET(BACKENDS "${BACKENDS} WinMM,")
1088 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
1089 SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
1094 # Check DSound backend
1095 FIND_PACKAGE(DSound)
1097 OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
1098 IF(ALSOFT_BACKEND_DSOUND)
1100 SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
1101 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c)
1102 ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
1103 SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS})
1107 # Check for WASAPI backend
1108 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
1109 IF(HAVE_MMDEVICEAPI_H)
1110 OPTION(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON)
1111 IF(ALSOFT_BACKEND_WASAPI)
1113 SET(BACKENDS "${BACKENDS} WASAPI,")
1114 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wasapi.c)
1118 SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
1119 UNSET(OLD_REQUIRED_DEFINITIONS)
1121 IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
1122 MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")
1124 IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND)
1125 MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend")
1127 IF(ALSOFT_REQUIRE_WASAPI AND NOT HAVE_WASAPI)
1128 MESSAGE(FATAL_ERROR "Failed to enabled required WASAPI backend")
1131 # Check PortAudio backend
1132 OPTION(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
1133 FIND_PACKAGE(PortAudio)
1135 OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
1136 IF(ALSOFT_BACKEND_PORTAUDIO)
1137 SET(HAVE_PORTAUDIO 1)
1138 SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
1139 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c)
1140 ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
1141 SET(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS})
1144 IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
1145 MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend")
1148 # Check PulseAudio backend
1149 OPTION(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
1150 FIND_PACKAGE(PulseAudio)
1151 IF(PULSEAUDIO_FOUND)
1152 OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
1153 IF(ALSOFT_BACKEND_PULSEAUDIO)
1154 SET(HAVE_PULSEAUDIO 1)
1155 SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
1156 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c)
1157 ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
1158 SET(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS})
1161 IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
1162 MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend")
1165 # Check JACK backend
1166 OPTION(ALSOFT_REQUIRE_JACK "Require JACK backend" OFF)
1169 OPTION(ALSOFT_BACKEND_JACK "Enable JACK backend" ON)
1170 IF(ALSOFT_BACKEND_JACK)
1172 SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
1173 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.c)
1174 ADD_BACKEND_LIBS(${JACK_LIBRARIES})
1175 SET(INC_PATHS ${INC_PATHS} ${JACK_INCLUDE_DIRS})
1178 IF(ALSOFT_REQUIRE_JACK AND NOT HAVE_JACK)
1179 MESSAGE(FATAL_ERROR "Failed to enabled required JACK backend")
1182 # Check CoreAudio backend
1183 OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
1184 FIND_LIBRARY(COREAUDIO_FRAMEWORK
1186 PATHS /System/Library/Frameworks
1188 IF(COREAUDIO_FRAMEWORK)
1189 OPTION(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
1190 IF(ALSOFT_BACKEND_COREAUDIO)
1191 SET(HAVE_COREAUDIO 1)
1192 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c)
1193 SET(BACKENDS "${BACKENDS} CoreAudio,")
1194 SET(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${EXTRA_LIBS})
1195 SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
1196 SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
1198 # Some versions of OSX may need the AudioToolbox framework. Add it if
1200 FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
1202 PATHS ~/Library/Frameworks
1204 /System/Library/Frameworks
1206 IF(AUDIOTOOLBOX_LIBRARY)
1207 SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
1211 IF(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
1212 MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend")
1215 # Check for OpenSL (Android) backend
1216 OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
1217 CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
1218 IF(HAVE_SLES_OPENSLES_ANDROID_H)
1219 CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
1220 IF(HAVE_LIBOPENSLES)
1221 OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
1222 IF(ALSOFT_BACKEND_OPENSL)
1224 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c)
1225 SET(BACKENDS "${BACKENDS} OpenSL,")
1226 SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
1230 IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
1231 MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
1234 # Check for SDL2 backend
1235 OPTION(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF)
1238 # Off by default, since it adds a runtime dependency
1239 OPTION(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF)
1240 IF(ALSOFT_BACKEND_SDL2)
1242 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sdl2.c)
1243 SET(BACKENDS "${BACKENDS} SDL2,")
1244 SET(EXTRA_LIBS ${SDL2_LIBRARY} ${EXTRA_LIBS})
1245 SET(INC_PATHS ${INC_PATHS} ${SDL2_INCLUDE_DIR})
1248 IF(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND)
1249 MESSAGE(FATAL_ERROR "Failed to enabled required SDL2 backend")
1252 # Optionally enable the Wave Writer backend
1253 OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
1254 IF(ALSOFT_BACKEND_WAVE)
1256 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c)
1257 SET(BACKENDS "${BACKENDS} WaveFile,")
1260 # This is always available
1261 SET(BACKENDS "${BACKENDS} Null")
1265 IF(GIT_FOUND AND EXISTS "${OpenAL_SOURCE_DIR}/.git")
1266 # Get the current working branch and its latest abbreviated commit hash
1267 ADD_CUSTOM_TARGET(build_version
1268 ${CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE}
1269 -D LIB_VERSION=${LIB_VERSION}
1270 -D SRC=${OpenAL_SOURCE_DIR}/version.h.in
1271 -D DST=${OpenAL_BINARY_DIR}/version.h
1272 -P ${OpenAL_SOURCE_DIR}/version.cmake
1273 WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
1277 SET(GIT_BRANCH "UNKNOWN")
1278 SET(GIT_COMMIT_HASH "unknown")
1280 "${OpenAL_SOURCE_DIR}/version.h.in"
1281 "${OpenAL_BINARY_DIR}/version.h")
1284 SET(NATIVE_SRC_DIR "${OpenAL_SOURCE_DIR}/native-tools/")
1285 SET(NATIVE_BIN_DIR "${OpenAL_BINARY_DIR}/native-tools/")
1286 FILE(MAKE_DIRECTORY "${NATIVE_BIN_DIR}")
1288 SET(BIN2H_COMMAND "${NATIVE_BIN_DIR}bin2h")
1289 SET(BSINCGEN_COMMAND "${NATIVE_BIN_DIR}bsincgen")
1290 ADD_CUSTOM_COMMAND(OUTPUT "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1291 COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "${NATIVE_SRC_DIR}"
1292 COMMAND ${CMAKE_COMMAND} -E remove "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1293 COMMAND ${CMAKE_COMMAND} --build . --config "Release"
1294 WORKING_DIRECTORY "${NATIVE_BIN_DIR}"
1295 DEPENDS "${NATIVE_SRC_DIR}CMakeLists.txt"
1296 IMPLICIT_DEPENDS C "${NATIVE_SRC_DIR}bin2h.c"
1297 C "${NATIVE_SRC_DIR}bsincgen.c"
1300 ADD_CUSTOM_TARGET(native-tools
1301 DEPENDS "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1305 option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" ON)
1306 if(ALSOFT_EMBED_HRTF_DATA)
1307 MACRO(make_hrtf_header FILENAME VARNAME)
1308 SET(infile "${OpenAL_SOURCE_DIR}/hrtf/${FILENAME}")
1309 SET(outfile "${OpenAL_BINARY_DIR}/${FILENAME}.h")
1311 ADD_CUSTOM_COMMAND(OUTPUT "${outfile}"
1312 COMMAND "${BIN2H_COMMAND}" "${infile}" "${outfile}" ${VARNAME}
1313 DEPENDS native-tools "${infile}"
1316 SET(ALC_OBJS ${ALC_OBJS} "${outfile}")
1319 make_hrtf_header(default-44100.mhr "hrtf_default_44100")
1320 make_hrtf_header(default-48000.mhr "hrtf_default_48000")
1323 ADD_CUSTOM_COMMAND(OUTPUT "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1324 COMMAND "${BSINCGEN_COMMAND}" "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1325 DEPENDS native-tools "${NATIVE_SRC_DIR}bsincgen.c"
1328 SET(ALC_OBJS ${ALC_OBJS} "${OpenAL_BINARY_DIR}/bsinc_inc.h")
1331 IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL)
1332 add_subdirectory(utils/alsoft-config)
1339 FIND_PACKAGE(SDL_sound)
1340 FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE)
1345 SET(LIBNAME "openal")
1347 SET(LIBNAME "OpenAL32")
1350 # Needed for openal.pc.in
1351 SET(prefix ${CMAKE_INSTALL_PREFIX})
1352 SET(exec_prefix "\${prefix}")
1353 SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
1354 SET(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
1355 SET(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
1356 SET(PACKAGE_VERSION "${LIB_VERSION}")
1357 SET(PKG_CONFIG_CFLAGS )
1358 SET(PKG_CONFIG_PRIVATE_LIBS )
1359 IF(LIBTYPE STREQUAL "STATIC")
1360 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC)
1361 FOREACH(FLAG ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
1362 # If this is already a linker flag, or is a full path+file, add it
1363 # as-is. Otherwise, it's a name intended to be dressed as -lname.
1364 IF(FLAG MATCHES "^-.*" OR EXISTS "${FLAG}")
1365 SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} ${FLAG}")
1367 SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} -l${FLAG}")
1374 "${OpenAL_SOURCE_DIR}/config.h.in"
1375 "${OpenAL_BINARY_DIR}/config.h")
1377 "${OpenAL_SOURCE_DIR}/openal.pc.in"
1378 "${OpenAL_BINARY_DIR}/openal.pc"
1382 # Add a static library with common functions used by multiple targets
1383 ADD_LIBRARY(common STATIC ${COMMON_OBJS})
1384 TARGET_COMPILE_DEFINITIONS(common PRIVATE ${CPP_DEFS})
1385 TARGET_COMPILE_OPTIONS(common PRIVATE ${C_FLAGS})
1389 SET(IMPL_TARGET OpenAL)
1393 # Build main library
1394 IF(LIBTYPE STREQUAL "STATIC")
1395 SET(CPP_DEFS ${CPP_DEFS} AL_LIBTYPE_STATIC)
1396 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
1397 SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS)
1399 ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
1401 # Make sure to compile the common code with PIC, since it'll be linked into
1402 # shared libs that needs it.
1403 SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE)
1404 SET(COMMON_LIB common)
1408 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "/SUBSYSTEM:WINDOWS")
1409 ELSEIF(CMAKE_COMPILER_IS_GNUCC)
1410 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "-mwindows")
1414 IF(WIN32 AND ALSOFT_BUILD_ROUTER)
1415 ADD_LIBRARY(OpenAL SHARED router/router.c router/router.h router/alc.c router/al.c)
1416 TARGET_COMPILE_DEFINITIONS(OpenAL
1417 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1418 TARGET_COMPILE_OPTIONS(OpenAL PRIVATE ${C_FLAGS})
1419 TARGET_LINK_LIBRARIES(OpenAL PRIVATE ${LINKER_FLAGS} ${COMMON_LIB})
1420 SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "")
1421 SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME})
1422 IF(TARGET build_version)
1423 ADD_DEPENDENCIES(OpenAL build_version)
1427 SET(LIBNAME "soft_oal")
1428 SET(IMPL_TARGET soft_oal)
1431 ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS})
1433 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "")
1436 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME}
1437 VERSION ${LIB_VERSION}
1438 SOVERSION ${LIB_MAJOR_VERSION}
1440 TARGET_COMPILE_DEFINITIONS(${IMPL_TARGET}
1441 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1442 TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET}
1443 PRIVATE "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc" ${INC_PATHS})
1444 TARGET_COMPILE_OPTIONS(${IMPL_TARGET} PRIVATE ${C_FLAGS})
1445 TARGET_LINK_LIBRARIES(${IMPL_TARGET}
1446 PRIVATE ${LINKER_FLAGS} ${COMMON_LIB} ${EXTRA_LIBS} ${MATH_LIB})
1447 IF(TARGET build_version)
1448 ADD_DEPENDENCIES(${IMPL_TARGET} build_version)
1451 IF(WIN32 AND MINGW AND ALSOFT_BUILD_IMPORT_LIB AND NOT LIBTYPE STREQUAL "STATIC")
1452 FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable")
1453 FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable")
1454 IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE)
1456 IF(NOT SED_EXECUTABLE)
1457 MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation")
1459 IF(NOT DLLTOOL_EXECUTABLE)
1460 MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation")
1463 SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS
1464 " -Wl,--output-def,OpenAL32.def")
1465 ADD_CUSTOM_COMMAND(TARGET OpenAL POST_BUILD
1466 COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def
1467 COMMAND "${DLLTOOL_EXECUTABLE}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll
1468 COMMENT "Stripping ordinals from OpenAL32.def and generating OpenAL32.lib..."
1475 INSTALL(TARGETS OpenAL EXPORT OpenAL
1476 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1477 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1478 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1479 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL
1481 EXPORT(TARGETS OpenAL
1483 FILE OpenALConfig.cmake)
1484 INSTALL(EXPORT OpenAL
1485 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL
1487 FILE OpenALConfig.cmake)
1488 INSTALL(FILES include/AL/al.h
1492 include/AL/efx-creative.h
1493 include/AL/efx-presets.h
1494 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/AL
1496 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
1497 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
1499 INSTALL(TARGETS soft_oal
1500 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1508 message(STATUS "Building DLL router")
1512 MESSAGE(STATUS "Building OpenAL with support for the following backends:")
1513 MESSAGE(STATUS " ${BACKENDS}")
1515 MESSAGE(STATUS "Building with support for CPU extensions:")
1516 MESSAGE(STATUS " ${CPU_EXTS}")
1519 MESSAGE(STATUS "Building with SSE${FPMATH_SET} codegen")
1525 MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
1526 MESSAGE(STATUS " This is probably NOT what you want!")
1531 if(ALSOFT_EMBED_HRTF_DATA)
1532 message(STATUS "Embedding HRTF datasets")
1536 # Install alsoft.conf configuration file
1538 INSTALL(FILES alsoftrc.sample
1539 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal
1541 MESSAGE(STATUS "Installing sample configuration")
1545 # Install HRTF definitions
1546 IF(ALSOFT_HRTF_DEFS)
1547 INSTALL(FILES hrtf/default-44100.mhr
1548 hrtf/default-48000.mhr
1549 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/hrtf
1551 MESSAGE(STATUS "Installing HRTF definitions")
1555 # Install AmbDec presets
1556 IF(ALSOFT_AMBDEC_PRESETS)
1557 INSTALL(FILES presets/3D7.1.ambdec
1558 presets/hexagon.ambdec
1559 presets/itu5.1.ambdec
1560 presets/itu5.1-nocenter.ambdec
1561 presets/rectangle.ambdec
1562 presets/square.ambdec
1564 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/presets
1566 MESSAGE(STATUS "Installing AmbDec presets")
1571 ADD_EXECUTABLE(openal-info utils/openal-info.c)
1572 TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS})
1573 TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL)
1575 SET(MAKEHRTF_SRCS utils/makehrtf.c)
1577 SET(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c utils/getopt.h)
1579 ADD_EXECUTABLE(makehrtf ${MAKEHRTF_SRCS})
1580 TARGET_COMPILE_DEFINITIONS(makehrtf PRIVATE ${CPP_DEFS})
1581 TARGET_COMPILE_OPTIONS(makehrtf PRIVATE ${C_FLAGS})
1583 TARGET_LINK_LIBRARIES(makehrtf PRIVATE ${LINKER_FLAGS} m)
1587 INSTALL(TARGETS openal-info makehrtf
1588 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1589 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1590 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1594 MESSAGE(STATUS "Building utility programs")
1595 IF(TARGET alsoft-config)
1596 MESSAGE(STATUS "Building configuration program")
1602 SET(TEST_COMMON_OBJS examples/common/alhelpers.c)
1604 ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS})
1605 TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS})
1606 TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS})
1607 TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB})
1610 INSTALL(TARGETS altonegen
1611 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1612 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1613 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1617 MESSAGE(STATUS "Building test programs")
1622 ADD_EXECUTABLE(alrecord examples/alrecord.c)
1623 TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS})
1624 TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS})
1625 TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL)
1628 INSTALL(TARGETS alrecord
1629 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1630 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1631 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1635 MESSAGE(STATUS "Building example programs")
1639 # Add a static library with common functions used by multiple targets
1640 ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c)
1641 TARGET_COMPILE_DEFINITIONS(ex-common PRIVATE ${CPP_DEFS})
1642 TARGET_COMPILE_OPTIONS(ex-common PRIVATE ${C_FLAGS})
1644 ADD_EXECUTABLE(alplay examples/alplay.c)
1645 TARGET_COMPILE_DEFINITIONS(alplay PRIVATE ${CPP_DEFS})
1646 TARGET_INCLUDE_DIRECTORIES(alplay
1647 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1648 TARGET_COMPILE_OPTIONS(alplay PRIVATE ${C_FLAGS})
1649 TARGET_LINK_LIBRARIES(alplay
1650 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1653 ADD_EXECUTABLE(alstream examples/alstream.c)
1654 TARGET_COMPILE_DEFINITIONS(alstream PRIVATE ${CPP_DEFS})
1655 TARGET_INCLUDE_DIRECTORIES(alstream
1656 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1657 TARGET_COMPILE_OPTIONS(alstream PRIVATE ${C_FLAGS})
1658 TARGET_LINK_LIBRARIES(alstream
1659 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1662 ADD_EXECUTABLE(alreverb examples/alreverb.c)
1663 TARGET_COMPILE_DEFINITIONS(alreverb PRIVATE ${CPP_DEFS})
1664 TARGET_INCLUDE_DIRECTORIES(alreverb
1665 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1666 TARGET_COMPILE_OPTIONS(alreverb PRIVATE ${C_FLAGS})
1667 TARGET_LINK_LIBRARIES(alreverb
1668 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1671 ADD_EXECUTABLE(almultireverb examples/almultireverb.c)
1672 TARGET_COMPILE_DEFINITIONS(almultireverb PRIVATE ${CPP_DEFS})
1673 TARGET_INCLUDE_DIRECTORIES(almultireverb
1674 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1675 TARGET_COMPILE_OPTIONS(almultireverb PRIVATE ${C_FLAGS})
1676 TARGET_LINK_LIBRARIES(almultireverb
1677 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1680 ADD_EXECUTABLE(allatency examples/allatency.c)
1681 TARGET_COMPILE_DEFINITIONS(allatency PRIVATE ${CPP_DEFS})
1682 TARGET_INCLUDE_DIRECTORIES(allatency
1683 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1684 TARGET_COMPILE_OPTIONS(allatency PRIVATE ${C_FLAGS})
1685 TARGET_LINK_LIBRARIES(allatency
1686 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1689 ADD_EXECUTABLE(alloopback examples/alloopback.c)
1690 TARGET_COMPILE_DEFINITIONS(alloopback PRIVATE ${CPP_DEFS})
1691 TARGET_INCLUDE_DIRECTORIES(alloopback
1692 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1693 TARGET_COMPILE_OPTIONS(alloopback PRIVATE ${C_FLAGS})
1694 TARGET_LINK_LIBRARIES(alloopback
1695 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1698 ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
1699 TARGET_COMPILE_DEFINITIONS(alhrtf PRIVATE ${CPP_DEFS})
1700 TARGET_INCLUDE_DIRECTORIES(alhrtf
1701 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1702 TARGET_COMPILE_OPTIONS(alhrtf PRIVATE ${C_FLAGS})
1703 TARGET_LINK_LIBRARIES(alhrtf
1704 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1708 INSTALL(TARGETS alplay alstream alreverb almultireverb allatency alloopback alhrtf
1709 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1710 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1711 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1715 MESSAGE(STATUS "Building SDL_sound example programs")
1721 IF(AVFORMAT_VERSION VERSION_LESS "57.56.101")
1722 MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 57.56.101)")
1725 IF(AVCODEC_VERSION VERSION_LESS "57.64.101")
1726 MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 57.64.101)")
1729 IF(AVUTIL_VERSION VERSION_LESS "55.34.101")
1730 MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 55.34.101)")
1733 IF(SWSCALE_VERSION VERSION_LESS "4.2.100")
1734 MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 4.2.100)")
1737 IF(SWRESAMPLE_VERSION VERSION_LESS "2.3.100")
1738 MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 2.3.100)")
1743 ADD_EXECUTABLE(alffplay examples/alffplay.cpp)
1744 TARGET_COMPILE_DEFINITIONS(alffplay PRIVATE ${CPP_DEFS})
1745 TARGET_INCLUDE_DIRECTORIES(alffplay
1746 PRIVATE ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
1747 TARGET_COMPILE_OPTIONS(alffplay PRIVATE ${C_FLAGS})
1748 TARGET_LINK_LIBRARIES(alffplay
1749 PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} common OpenAL)
1752 INSTALL(TARGETS alffplay
1753 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1754 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1755 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1758 MESSAGE(STATUS "Building SDL+FFmpeg example programs")