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)
20 CMAKE_POLICY(SET CMP0075 NEW)
22 ENDIF(COMMAND CMAKE_POLICY)
24 SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
26 INCLUDE(CheckFunctionExists)
27 INCLUDE(CheckLibraryExists)
28 INCLUDE(CheckSharedFunctionExists)
29 INCLUDE(CheckIncludeFile)
30 INCLUDE(CheckIncludeFiles)
31 INCLUDE(CheckSymbolExists)
32 INCLUDE(CheckCCompilerFlag)
33 INCLUDE(CheckCXXCompilerFlag)
34 INCLUDE(CheckCSourceCompiles)
35 INCLUDE(CheckCXXSourceCompiles)
36 INCLUDE(CheckTypeSize)
37 include(CheckStructHasMember)
38 include(CheckFileOffsetBits)
39 include(GNUInstallDirs)
41 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
44 OPTION(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON)
46 OPTION(ALSOFT_WERROR "Treat compile warnings as errors" OFF)
48 OPTION(ALSOFT_UTILS "Build and install utility programs" ON)
49 OPTION(ALSOFT_NO_CONFIG_UTIL "Disable building the alsoft-config utility" OFF)
51 OPTION(ALSOFT_EXAMPLES "Build and install example programs" ON)
52 OPTION(ALSOFT_TESTS "Build and install test programs" ON)
54 OPTION(ALSOFT_CONFIG "Install alsoft.conf sample configuration file" ON)
55 OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" ON)
56 OPTION(ALSOFT_AMBDEC_PRESETS "Install AmbDec preset files" ON)
57 OPTION(ALSOFT_INSTALL "Install headers and libraries" ON)
59 if(DEFINED SHARE_INSTALL_DIR)
60 message(WARNING "SHARE_INSTALL_DIR is deprecated. Use the variables provided by the GNUInstallDirs module instead")
61 set(CMAKE_INSTALL_DATADIR "${SHARE_INSTALL_DIR}")
64 if(DEFINED LIB_SUFFIX)
65 message(WARNING "LIB_SUFFIX is deprecated. Use the variables provided by the GNUInstallDirs module instead")
69 SET(CPP_DEFS ) # C pre-process, not C++
76 SET(CPP_DEFS ${CPP_DEFS} _WIN32 _WIN32_WINNT=0x0502)
78 OPTION(ALSOFT_BUILD_ROUTER "Build the router (EXPERIMENTAL; creates OpenAL32.dll and soft_oal.dll)" OFF)
80 # This option is mainly for static linking OpenAL Soft into another project
81 # that already defines the IDs. It is up to that project to ensure all
82 # required IDs are defined.
83 OPTION(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF)
86 OPTION(ALSOFT_BUILD_IMPORT_LIB "Build an import .lib using dlltool (requires sed)" ON)
89 SET(DLLTOOL "${HOST}-dlltool")
91 SET(DLLTOOL "dlltool")
98 # QNX's gcc do not uses /usr/include and /usr/lib pathes by default
99 IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
100 SET(INC_PATHS ${INC_PATHS} /usr/include)
101 SET(LINKER_FLAGS ${LINKER_FLAGS} -L/usr/lib)
108 SET(LIB_MAJOR_VERSION "1")
109 SET(LIB_MINOR_VERSION "19")
110 SET(LIB_REVISION "1")
111 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
117 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
118 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
121 CHECK_C_COMPILER_FLAG(-std=c11 HAVE_STD_C11)
123 SET(CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}")
125 CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
127 SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
131 CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD_CXX11)
133 SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
137 # Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions
138 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_DEFAULT)
139 IF(NOT HAVE_POSIX_MEMALIGN_DEFAULT)
140 SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
141 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600")
142 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_POSIX)
143 IF(NOT HAVE_POSIX_MEMALIGN_POSIX)
144 SET(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
146 SET(CPP_DEFS ${CPP_DEFS} _POSIX_C_SOURCE=200112L _XOPEN_SOURCE=600)
149 UNSET(OLD_REQUIRED_FLAGS)
152 # Set defines for large file support. Don't set this for Android targets. See:
153 # https://android-developers.googleblog.com/2017/09/introducing-android-native-development.html
155 CHECK_FILE_OFFSET_BITS()
156 IF(_FILE_OFFSET_BITS)
157 SET(CPP_DEFS ${CPP_DEFS} "_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
158 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
160 SET(CPP_DEFS ${CPP_DEFS} _LARGEFILE_SOURCE _LARGE_FILES)
161 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES")
164 # C99 has restrict, but C++ does not, so we can only utilize __restrict.
166 CHECK_C_SOURCE_COMPILES("int *__restrict foo;
167 int main() {return 0;}" HAVE___RESTRICT)
169 SET(RESTRICT_DECL "__restrict")
172 # MSVC may need workarounds for C99 inline
174 # TODO: Once we truly require C99, this inline check should go away.
175 CHECK_C_SOURCE_COMPILES("inline void foo(void) { }
176 int main() {return 0;}" HAVE_INLINE)
178 CHECK_C_SOURCE_COMPILES("__inline void foo(void) { }
179 int main() {return 0;}" HAVE___INLINE)
180 IF(NOT HAVE___INLINE)
181 MESSAGE(FATAL_ERROR "No inline keyword found, please report!")
184 SET(CPP_DEFS ${CPP_DEFS} inline=__inline)
185 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Dinline=__inline")
189 # Make sure we have C99-style inline semantics with GCC (4.3 or newer).
190 IF(CMAKE_COMPILER_IS_GNUCC)
191 SET(CMAKE_C_FLAGS "-fno-gnu89-inline ${CMAKE_C_FLAGS}")
193 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
194 # Force no inlining for the next test.
195 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -fno-inline")
197 CHECK_C_SOURCE_COMPILES("extern inline int foo() { return 0; }
198 int main() {return foo();}" INLINE_IS_C99)
199 IF(NOT INLINE_IS_C99)
200 MESSAGE(FATAL_ERROR "Your compiler does not seem to have C99 inline semantics!
201 Please update your compiler for better C99 compliance.")
204 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
207 # Check if we have a proper timespec declaration
208 CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
209 IF(HAVE_STRUCT_TIMESPEC)
210 # Define it here so we don't have to include config.h for it
211 SET(CPP_DEFS ${CPP_DEFS} HAVE_STRUCT_TIMESPEC)
214 # Some systems may need libatomic for C11 atomic functions to work
215 SET(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
216 SET(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES} atomic)
217 CHECK_C_SOURCE_COMPILES("#include <stdatomic.h>
218 int _Atomic foo = ATOMIC_VAR_INIT(0);
221 return atomic_fetch_add(&foo, 2);
224 IF(NOT HAVE_LIBATOMIC)
225 SET(CMAKE_REQUIRED_LIBRARIES "${OLD_REQUIRED_LIBRARIES}")
227 SET(EXTRA_LIBS atomic ${EXTRA_LIBS})
229 UNSET(OLD_REQUIRED_LIBRARIES)
231 # Include liblog for Android logging
232 CHECK_LIBRARY_EXISTS(log __android_log_print "" HAVE_LIBLOG)
234 SET(EXTRA_LIBS log ${EXTRA_LIBS})
235 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} log)
238 # Add definitions, compiler switches, etc.
239 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_SOURCE_DIR}/common" "${OpenAL_BINARY_DIR}")
241 IF(NOT CMAKE_BUILD_TYPE)
242 SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
243 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
246 IF(NOT CMAKE_DEBUG_POSTFIX)
247 SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
248 "Library postfix for debug builds. Normally left blank."
253 SET(CPP_DEFS ${CPP_DEFS} _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE NOMINMAX)
254 SET(C_FLAGS ${C_FLAGS} /wd4098 /wd4200)
257 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
259 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
262 MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
265 OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
266 IF(FORCE_STATIC_VCRT)
268 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
269 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
270 IF(${flag_var} MATCHES "/MD")
271 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
276 SET(C_FLAGS ${C_FLAGS} -Winline -Wall)
277 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
279 SET(C_FLAGS ${C_FLAGS} -Wextra)
283 SET(C_FLAGS ${C_FLAGS} -Werror)
286 # We want RelWithDebInfo to actually include debug stuff (define _DEBUG
288 FOREACH(flag_var CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
289 IF(${flag_var} MATCHES "-DNDEBUG")
290 STRING(REGEX REPLACE "-DNDEBUG" "-D_DEBUG" ${flag_var} "${${flag_var}}")
294 CHECK_C_COMPILER_FLAG(-fno-math-errno HAVE_FNO_MATH_ERRNO)
295 IF(HAVE_FNO_MATH_ERRNO)
296 SET(C_FLAGS ${C_FLAGS} -fno-math-errno)
299 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
300 int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
302 option(ALSOFT_STATIC_LIBGCC "Force -static-libgcc for static GCC runtimes" OFF)
303 if(ALSOFT_STATIC_LIBGCC)
304 set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
305 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -static-libgcc)
306 check_c_source_compiles(
312 HAVE_STATIC_LIBGCC_SWITCH
314 set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
315 unset(OLD_REQUIRED_LIBRARIES)
317 if(NOT HAVE_STATIC_LIBGCC_SWITCH)
318 message(FATAL_ERROR "Cannot static link libgcc")
320 set(LINKER_FLAGS ${LINKER_FLAGS} -static-libgcc)
323 option(ALSOFT_STATIC_STDCXX "Static link libstdc++" OFF)
324 if(ALSOFT_STATIC_STDCXX)
325 set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
326 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,--push-state,-Bstatic,-lstdc++,--pop-state")
327 check_cxx_source_compiles(
333 HAVE_STATIC_LIBSTDCXX_SWITCH
335 set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
336 unset(OLD_REQUIRED_LIBRARIES)
338 if(NOT HAVE_STATIC_LIBSTDCXX_SWITCH)
339 message(FATAL_ERROR "Cannot static link libstdc++")
341 set(LINKER_FLAGS ${LINKER_FLAGS} "-Wl,--push-state,-Bstatic,-lstdc++,--pop-state")
345 option(ALSOFT_STATIC_WINPTHREAD "Static link libwinpthread" OFF)
346 if(ALSOFT_STATIC_WINPTHREAD)
347 set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
348 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,--push-state,-Bstatic,-lwinpthread,--pop-state")
349 check_cxx_source_compiles(
355 HAVE_STATIC_LIBWINPTHREAD_SWITCH
357 set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
358 unset(OLD_REQUIRED_LIBRARIES)
360 if(NOT HAVE_STATIC_LIBWINPTHREAD_SWITCH)
361 message(FATAL_ERROR "Cannot static link libwinpthread")
363 set(LINKER_FLAGS ${LINKER_FLAGS} "-Wl,--push-state,-Bstatic,-lwinpthread,--pop-state")
368 # Set visibility/export options if available
370 SET(EXPORT_DECL "__declspec(dllexport)")
372 SET(ALIGN_DECL "__declspec(align(x))")
374 SET(ALIGN_DECL "__declspec(aligned(x))")
377 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
378 # Yes GCC, really don't accept visibility modes you don't support
379 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
381 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
382 int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
383 IF(HAVE_GCC_PROTECTED_VISIBILITY)
384 SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
386 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
387 int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
388 IF(HAVE_GCC_DEFAULT_VISIBILITY)
389 SET(EXPORT_DECL "__attribute__((visibility(\"default\")))")
393 IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
394 CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
395 IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
396 SET(C_FLAGS ${C_FLAGS} -fvisibility=hidden)
400 CHECK_C_SOURCE_COMPILES("int foo __attribute__((aligned(16)));
401 int main() {return 0;}" HAVE_ATTRIBUTE_ALIGNED)
402 IF(HAVE_ATTRIBUTE_ALIGNED)
403 SET(ALIGN_DECL "__attribute__((aligned(x)))")
406 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
412 SET(SSE4_1_SWITCH "")
413 SET(FPU_NEON_SWITCH "")
415 CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
417 SET(SSE_SWITCH "-msse")
419 CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
420 IF(HAVE_MSSE2_SWITCH)
421 SET(SSE2_SWITCH "-msse2")
423 CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH)
424 IF(HAVE_MSSE3_SWITCH)
425 SET(SSE3_SWITCH "-msse3")
427 CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH)
428 IF(HAVE_MSSE4_1_SWITCH)
429 SET(SSE4_1_SWITCH "-msse4.1")
431 CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH)
432 IF(HAVE_MFPU_NEON_SWITCH)
433 SET(FPU_NEON_SWITCH "-mfpu=neon")
437 IF(CMAKE_SIZEOF_VOID_P MATCHES "4")
438 IF(SSE_SWITCH OR MSVC)
439 OPTION(ALSOFT_ENABLE_SSE_CODEGEN "Enable SSE code generation instead of x87 for 32-bit targets." TRUE)
441 IF(SSE2_SWITCH OR MSVC)
442 OPTION(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE)
445 IF(ALSOFT_ENABLE_SSE2_CODEGEN)
447 CHECK_C_COMPILER_FLAG("${SSE2_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE_2)
448 IF(HAVE_MFPMATH_SSE_2)
449 SET(C_FLAGS ${C_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
453 CHECK_C_COMPILER_FLAG("/arch:SSE2" HAVE_ARCH_SSE2)
455 SET(C_FLAGS ${C_FLAGS} "/arch:SSE2")
460 IF(ALSOFT_ENABLE_SSE_CODEGEN AND NOT FPMATH_SET)
462 CHECK_C_COMPILER_FLAG("${SSE_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE)
464 SET(C_FLAGS ${C_FLAGS} ${SSE_SWITCH} -mfpmath=sse)
468 CHECK_C_COMPILER_FLAG("/arch:SSE" HAVE_ARCH_SSE)
470 SET(C_FLAGS ${C_FLAGS} "/arch:SSE")
478 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
479 int main() {return 0;}" HAVE_GCC_FORMAT)
481 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
482 CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
483 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
484 CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
485 CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
486 CHECK_INCLUDE_FILE(sys/sysconf.h HAVE_SYS_SYSCONF_H)
487 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
488 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
489 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
490 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
491 IF(NOT HAVE_GUIDDEF_H)
492 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
495 # Some systems need libm for some of the following math functions to work
497 CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
499 SET(MATH_LIB ${MATH_LIB} m)
500 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
503 # Check for the dlopen API (for dynamicly loading backend libs)
505 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
507 SET(EXTRA_LIBS dl ${EXTRA_LIBS})
508 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
511 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
514 # Check for a cpuid intrinsic
516 CHECK_C_SOURCE_COMPILES("#include <cpuid.h>
519 unsigned int eax, ebx, ecx, edx;
520 return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
521 }" HAVE_GCC_GET_CPUID)
524 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
530 }" HAVE_CPUID_INTRINSIC)
531 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
534 unsigned long idx = 0;
535 _BitScanForward64(&idx, 1);
537 }" HAVE_BITSCANFORWARD64_INTRINSIC)
538 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
541 unsigned long idx = 0;
542 _BitScanForward(&idx, 1);
544 }" HAVE_BITSCANFORWARD_INTRINSIC)
547 CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF)
548 CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
549 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
550 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
551 CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH)
554 CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
555 CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
558 CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
559 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
560 IF(NOT HAVE_STRCASECMP)
561 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
562 IF(NOT HAVE__STRICMP)
563 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
566 SET(CPP_DEFS ${CPP_DEFS} strcasecmp=_stricmp)
569 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
570 IF(NOT HAVE_STRNCASECMP)
571 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
572 IF(NOT HAVE__STRNICMP)
573 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
576 SET(CPP_DEFS ${CPP_DEFS} strncasecmp=_strnicmp)
580 # Check if we have Windows headers
581 SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
582 SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
583 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
584 SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
585 UNSET(OLD_REQUIRED_DEFINITIONS)
587 IF(NOT HAVE_WINDOWS_H)
588 CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
589 IF(NOT HAVE_GETTIMEOFDAY)
590 MESSAGE(FATAL_ERROR "No timing function found!")
593 CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
594 IF(NOT HAVE_NANOSLEEP)
595 MESSAGE(FATAL_ERROR "No sleep function found!")
598 # We need pthreads outside of Windows
599 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
600 IF(NOT HAVE_PTHREAD_H)
601 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
603 # Some systems need pthread_np.h to get recursive mutexes
604 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
606 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
608 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
609 SET(C_FLAGS ${C_FLAGS} -pthread)
610 SET(LINKER_FLAGS ${LINKER_FLAGS} -pthread)
613 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
615 SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
618 CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
620 IF(HAVE_PTHREAD_NP_H)
621 CHECK_SYMBOL_EXISTS(pthread_setname_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SETNAME_NP)
622 IF(NOT HAVE_PTHREAD_SETNAME_NP)
623 CHECK_SYMBOL_EXISTS(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
625 CHECK_C_SOURCE_COMPILES("
627 #include <pthread_np.h>
630 pthread_setname_np(\"testname\");
633 PTHREAD_SETNAME_NP_ONE_PARAM
635 CHECK_C_SOURCE_COMPILES("
637 #include <pthread_np.h>
640 pthread_setname_np(pthread_self(), \"%s\", \"testname\");
643 PTHREAD_SETNAME_NP_THREE_PARAMS
646 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
648 CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
649 IF(NOT HAVE_PTHREAD_SETNAME_NP)
650 CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
652 CHECK_C_SOURCE_COMPILES("
656 pthread_setname_np(\"testname\");
659 PTHREAD_SETNAME_NP_ONE_PARAM
661 CHECK_C_SOURCE_COMPILES("
665 pthread_setname_np(pthread_self(), \"%s\", \"testname\");
668 PTHREAD_SETNAME_NP_THREE_PARAMS
671 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
674 CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK)
676 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
678 SET(EXTRA_LIBS rt ${EXTRA_LIBS})
682 CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_GETOPT)
684 # Check for a 64-bit type
685 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
686 IF(NOT HAVE_STDINT_H)
688 CHECK_C_SOURCE_COMPILES("#define _WIN32_WINNT 0x0502
691 int main() {return 0;}" HAVE___INT64)
694 IF(NOT SIZEOF_LONG MATCHES "8")
695 IF(NOT SIZEOF_LONG_LONG MATCHES "8")
696 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
717 OpenAL32/Include/alMain.h
718 OpenAL32/Include/alu.h
720 OpenAL32/Include/alAuxEffectSlot.h
721 OpenAL32/alAuxEffectSlot.cpp
722 OpenAL32/Include/alBuffer.h
723 OpenAL32/alBuffer.cpp
724 OpenAL32/Include/alEffect.h
725 OpenAL32/alEffect.cpp
726 OpenAL32/Include/alError.h
728 OpenAL32/alExtension.cpp
729 OpenAL32/Include/alFilter.h
730 OpenAL32/alFilter.cpp
731 OpenAL32/Include/alListener.h
732 OpenAL32/alListener.cpp
733 OpenAL32/Include/alSource.h
734 OpenAL32/alSource.cpp
737 OpenAL32/Include/sample_cvt.h
738 OpenAL32/sample_cvt.cpp
755 Alc/effects/autowah.cpp
756 Alc/effects/chorus.cpp
757 Alc/effects/compressor.cpp
758 Alc/effects/dedicated.cpp
759 Alc/effects/distortion.cpp
761 Alc/effects/equalizer.cpp
762 Alc/effects/fshifter.cpp
763 Alc/effects/modulator.cpp
765 Alc/effects/pshifter.cpp
766 Alc/effects/reverb.cpp
768 Alc/filters/filter.cpp
771 Alc/filters/splitter.cpp
772 Alc/filters/splitter.h
791 Alc/mixer/mixer_c.cpp
795 SET(CPU_EXTS "Default")
810 SET(HAVE_PORTAUDIO 0)
811 SET(HAVE_PULSEAUDIO 0)
812 SET(HAVE_COREAUDIO 0)
817 # Check for SSE support
818 OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
819 CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
821 OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
822 IF(ALSOFT_CPUEXT_SSE)
824 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse.cpp)
826 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse.cpp PROPERTIES
827 COMPILE_FLAGS "${SSE_SWITCH}")
829 SET(CPU_EXTS "${CPU_EXTS}, SSE")
832 IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
833 MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
836 OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
837 CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
839 OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
840 IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
842 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse2.cpp)
844 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse2.cpp PROPERTIES
845 COMPILE_FLAGS "${SSE2_SWITCH}")
847 SET(CPU_EXTS "${CPU_EXTS}, SSE2")
850 IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
851 MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
854 OPTION(ALSOFT_REQUIRE_SSE3 "Require SSE3 support" OFF)
855 CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}")
857 OPTION(ALSOFT_CPUEXT_SSE3 "Enable SSE3 support" ON)
858 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE3)
860 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse3.cpp)
862 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse3.cpp PROPERTIES
863 COMPILE_FLAGS "${SSE3_SWITCH}")
865 SET(CPU_EXTS "${CPU_EXTS}, SSE3")
868 IF(ALSOFT_REQUIRE_SSE3 AND NOT HAVE_SSE3)
869 MESSAGE(FATAL_ERROR "Failed to enable required SSE3 CPU extensions")
872 OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
873 CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
875 OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
876 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1)
878 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse41.cpp)
880 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse41.cpp PROPERTIES
881 COMPILE_FLAGS "${SSE4_1_SWITCH}")
883 SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
886 IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
887 MESSAGE(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
890 # Check for ARM Neon support
891 OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
892 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H ${FPU_NEON_SWITCH})
894 OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON)
895 IF(ALSOFT_CPUEXT_NEON)
897 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_neon.cpp)
899 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_neon.cpp PROPERTIES
900 COMPILE_FLAGS "${FPU_NEON_SWITCH}")
902 SET(CPU_EXTS "${CPU_EXTS}, Neon")
905 IF(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
906 MESSAGE(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
910 IF(WIN32 OR HAVE_DLFCN_H)
912 MACRO(ADD_BACKEND_LIBS _LIBS)
915 SET(IS_LINKED " (linked)")
916 MACRO(ADD_BACKEND_LIBS _LIBS)
917 SET(EXTRA_LIBS ${_LIBS} ${EXTRA_LIBS})
922 SET(ALC_OBJS ${ALC_OBJS}
923 Alc/backends/base.cpp
925 # Default backends, always available
926 Alc/backends/loopback.cpp
927 Alc/backends/loopback.h
928 Alc/backends/null.cpp
933 OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
936 OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
937 IF(ALSOFT_BACKEND_ALSA)
939 SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
940 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.cpp Alc/backends/alsa.h)
941 ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
942 SET(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS})
945 IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
946 MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend")
950 OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
953 OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
954 IF(ALSOFT_BACKEND_OSS)
956 SET(BACKENDS "${BACKENDS} OSS,")
957 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.cpp Alc/backends/oss.h)
959 SET(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS})
961 SET(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS})
964 IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
965 MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend")
968 # Check Solaris backend
969 OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
970 FIND_PACKAGE(AudioIO)
972 OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
973 IF(ALSOFT_BACKEND_SOLARIS)
975 SET(BACKENDS "${BACKENDS} Solaris,")
976 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.cpp Alc/backends/solaris.h)
977 SET(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS})
980 IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
981 MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend")
984 # Check SndIO backend
985 OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
986 FIND_PACKAGE(SoundIO)
988 OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
989 IF(ALSOFT_BACKEND_SNDIO)
991 SET(BACKENDS "${BACKENDS} SndIO (linked),")
992 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.cpp Alc/backends/sndio.h)
993 SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
994 SET(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS})
997 IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
998 MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend")
1002 OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF)
1005 OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON)
1006 IF(ALSOFT_BACKEND_QSA)
1008 SET(BACKENDS "${BACKENDS} QSA (linked),")
1009 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.cpp Alc/backends/qsa.h)
1010 SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
1011 SET(INC_PATHS ${INC_PATHS} ${QSA_INCLUDE_DIRS})
1014 IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA)
1015 MESSAGE(FATAL_ERROR "Failed to enabled required QSA backend")
1018 # Check Windows-only backends
1019 OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
1020 OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
1021 OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF)
1023 SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
1024 SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
1026 # Check MMSystem backend
1027 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
1029 CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
1031 OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
1032 IF(ALSOFT_BACKEND_WINMM)
1034 SET(BACKENDS "${BACKENDS} WinMM,")
1035 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.cpp Alc/backends/winmm.h)
1036 SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
1041 # Check DSound backend
1042 FIND_PACKAGE(DSound)
1044 OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
1045 IF(ALSOFT_BACKEND_DSOUND)
1047 SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
1048 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.cpp Alc/backends/dsound.h)
1049 ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
1050 SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS})
1054 # Check for WASAPI backend
1055 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
1056 IF(HAVE_MMDEVICEAPI_H)
1057 OPTION(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON)
1058 IF(ALSOFT_BACKEND_WASAPI)
1060 SET(BACKENDS "${BACKENDS} WASAPI,")
1061 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wasapi.cpp Alc/backends/wasapi.h)
1065 SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
1066 UNSET(OLD_REQUIRED_DEFINITIONS)
1068 IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
1069 MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")
1071 IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND)
1072 MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend")
1074 IF(ALSOFT_REQUIRE_WASAPI AND NOT HAVE_WASAPI)
1075 MESSAGE(FATAL_ERROR "Failed to enabled required WASAPI backend")
1078 # Check PortAudio backend
1079 OPTION(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
1080 FIND_PACKAGE(PortAudio)
1082 OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
1083 IF(ALSOFT_BACKEND_PORTAUDIO)
1084 SET(HAVE_PORTAUDIO 1)
1085 SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
1086 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.cpp Alc/backends/portaudio.h)
1087 ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
1088 SET(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS})
1091 IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
1092 MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend")
1095 # Check PulseAudio backend
1096 OPTION(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
1097 FIND_PACKAGE(PulseAudio)
1098 IF(PULSEAUDIO_FOUND)
1099 OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
1100 IF(ALSOFT_BACKEND_PULSEAUDIO)
1101 SET(HAVE_PULSEAUDIO 1)
1102 SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
1103 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.cpp Alc/backends/pulseaudio.h)
1104 ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
1105 SET(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS})
1108 IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
1109 MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend")
1112 # Check JACK backend
1113 OPTION(ALSOFT_REQUIRE_JACK "Require JACK backend" OFF)
1116 OPTION(ALSOFT_BACKEND_JACK "Enable JACK backend" ON)
1117 IF(ALSOFT_BACKEND_JACK)
1119 SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
1120 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.cpp Alc/backends/jack.h)
1121 ADD_BACKEND_LIBS(${JACK_LIBRARIES})
1122 SET(INC_PATHS ${INC_PATHS} ${JACK_INCLUDE_DIRS})
1125 IF(ALSOFT_REQUIRE_JACK AND NOT HAVE_JACK)
1126 MESSAGE(FATAL_ERROR "Failed to enabled required JACK backend")
1129 # Check CoreAudio backend
1130 OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
1131 FIND_LIBRARY(COREAUDIO_FRAMEWORK
1133 PATHS /System/Library/Frameworks
1135 IF(COREAUDIO_FRAMEWORK)
1136 OPTION(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
1137 IF(ALSOFT_BACKEND_COREAUDIO)
1138 SET(HAVE_COREAUDIO 1)
1139 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.cpp Alc/backends/coreaudio.h)
1140 SET(BACKENDS "${BACKENDS} CoreAudio,")
1141 SET(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${EXTRA_LIBS})
1142 SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
1143 SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
1145 # Some versions of OSX may need the AudioToolbox framework. Add it if
1147 FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
1149 PATHS ~/Library/Frameworks
1151 /System/Library/Frameworks
1153 IF(AUDIOTOOLBOX_LIBRARY)
1154 SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
1158 IF(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
1159 MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend")
1162 # Check for OpenSL (Android) backend
1163 OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
1164 CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
1165 IF(HAVE_SLES_OPENSLES_ANDROID_H)
1166 CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
1167 IF(HAVE_LIBOPENSLES)
1168 OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
1169 IF(ALSOFT_BACKEND_OPENSL)
1171 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.cpp Alc/backends/opensl.h)
1172 SET(BACKENDS "${BACKENDS} OpenSL,")
1173 SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
1177 IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
1178 MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
1181 # Check for SDL2 backend
1182 OPTION(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF)
1185 # Off by default, since it adds a runtime dependency
1186 OPTION(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF)
1187 IF(ALSOFT_BACKEND_SDL2)
1189 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sdl2.cpp Alc/backends/sdl2.h)
1190 SET(BACKENDS "${BACKENDS} SDL2,")
1191 SET(EXTRA_LIBS ${SDL2_LIBRARY} ${EXTRA_LIBS})
1192 SET(INC_PATHS ${INC_PATHS} ${SDL2_INCLUDE_DIR})
1195 IF(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND)
1196 MESSAGE(FATAL_ERROR "Failed to enabled required SDL2 backend")
1199 # Optionally enable the Wave Writer backend
1200 OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
1201 IF(ALSOFT_BACKEND_WAVE)
1203 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.cpp Alc/backends/wave.h)
1204 SET(BACKENDS "${BACKENDS} WaveFile,")
1207 # This is always available
1208 SET(BACKENDS "${BACKENDS} Null")
1212 IF(GIT_FOUND AND EXISTS "${OpenAL_SOURCE_DIR}/.git")
1213 # Get the current working branch and its latest abbreviated commit hash
1214 ADD_CUSTOM_TARGET(build_version
1215 ${CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE}
1216 -D LIB_VERSION=${LIB_VERSION}
1217 -D SRC=${OpenAL_SOURCE_DIR}/version.h.in
1218 -D DST=${OpenAL_BINARY_DIR}/version.h
1219 -P ${OpenAL_SOURCE_DIR}/version.cmake
1220 WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
1224 SET(GIT_BRANCH "UNKNOWN")
1225 SET(GIT_COMMIT_HASH "unknown")
1227 "${OpenAL_SOURCE_DIR}/version.h.in"
1228 "${OpenAL_BINARY_DIR}/version.h")
1231 SET(NATIVE_SRC_DIR "${OpenAL_SOURCE_DIR}/native-tools/")
1232 SET(NATIVE_BIN_DIR "${OpenAL_BINARY_DIR}/native-tools/")
1233 FILE(MAKE_DIRECTORY "${NATIVE_BIN_DIR}")
1235 SET(BIN2H_COMMAND "${NATIVE_BIN_DIR}bin2h")
1236 SET(BSINCGEN_COMMAND "${NATIVE_BIN_DIR}bsincgen")
1237 ADD_CUSTOM_COMMAND(OUTPUT "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1238 COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "${NATIVE_SRC_DIR}"
1239 COMMAND ${CMAKE_COMMAND} -E remove "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1240 COMMAND ${CMAKE_COMMAND} --build . --config "Release"
1241 WORKING_DIRECTORY "${NATIVE_BIN_DIR}"
1242 DEPENDS "${NATIVE_SRC_DIR}CMakeLists.txt"
1243 IMPLICIT_DEPENDS C "${NATIVE_SRC_DIR}bin2h.c"
1244 C "${NATIVE_SRC_DIR}bsincgen.c"
1247 ADD_CUSTOM_TARGET(native-tools
1248 DEPENDS "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1252 option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" ON)
1253 if(ALSOFT_EMBED_HRTF_DATA)
1254 MACRO(make_hrtf_header FILENAME VARNAME)
1255 SET(infile "${OpenAL_SOURCE_DIR}/hrtf/${FILENAME}")
1256 SET(outfile "${OpenAL_BINARY_DIR}/${FILENAME}.h")
1258 ADD_CUSTOM_COMMAND(OUTPUT "${outfile}"
1259 COMMAND "${BIN2H_COMMAND}" "${infile}" "${outfile}" ${VARNAME}
1260 DEPENDS native-tools "${infile}"
1263 SET(ALC_OBJS ${ALC_OBJS} "${outfile}")
1266 make_hrtf_header(default-44100.mhr "hrtf_default_44100")
1267 make_hrtf_header(default-48000.mhr "hrtf_default_48000")
1270 ADD_CUSTOM_COMMAND(OUTPUT "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1271 COMMAND "${BSINCGEN_COMMAND}" "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1272 DEPENDS native-tools "${NATIVE_SRC_DIR}bsincgen.c"
1275 SET(ALC_OBJS ${ALC_OBJS} "${OpenAL_BINARY_DIR}/bsinc_inc.h")
1278 IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL)
1279 add_subdirectory(utils/alsoft-config)
1286 FIND_PACKAGE(SDL_sound)
1287 FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE)
1292 SET(LIBNAME "openal")
1294 SET(LIBNAME "OpenAL32")
1297 # Needed for openal.pc.in
1298 SET(prefix ${CMAKE_INSTALL_PREFIX})
1299 SET(exec_prefix "\${prefix}")
1300 SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
1301 SET(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
1302 SET(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
1303 SET(PACKAGE_VERSION "${LIB_VERSION}")
1304 SET(PKG_CONFIG_CFLAGS )
1305 SET(PKG_CONFIG_PRIVATE_LIBS )
1306 IF(LIBTYPE STREQUAL "STATIC")
1307 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC)
1308 FOREACH(FLAG ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
1309 # If this is already a linker flag, or is a full path+file, add it
1310 # as-is. Otherwise, it's a name intended to be dressed as -lname.
1311 IF(FLAG MATCHES "^-.*" OR EXISTS "${FLAG}")
1312 SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} ${FLAG}")
1314 SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} -l${FLAG}")
1321 "${OpenAL_SOURCE_DIR}/config.h.in"
1322 "${OpenAL_BINARY_DIR}/config.h")
1324 "${OpenAL_SOURCE_DIR}/openal.pc.in"
1325 "${OpenAL_BINARY_DIR}/openal.pc"
1329 # Add a static library with common functions used by multiple targets
1330 ADD_LIBRARY(common STATIC ${COMMON_OBJS})
1331 TARGET_COMPILE_DEFINITIONS(common PRIVATE ${CPP_DEFS})
1332 TARGET_COMPILE_OPTIONS(common PRIVATE ${C_FLAGS})
1336 SET(IMPL_TARGET OpenAL)
1340 # Build main library
1341 IF(LIBTYPE STREQUAL "STATIC")
1342 SET(CPP_DEFS ${CPP_DEFS} AL_LIBTYPE_STATIC)
1343 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
1344 SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS)
1346 ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
1348 # Make sure to compile the common code with PIC, since it'll be linked into
1349 # shared libs that needs it.
1350 SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE)
1351 SET(COMMON_LIB common)
1355 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "/SUBSYSTEM:WINDOWS")
1356 ELSEIF(CMAKE_COMPILER_IS_GNUCC)
1357 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "-mwindows")
1361 IF(WIN32 AND ALSOFT_BUILD_ROUTER)
1362 ADD_LIBRARY(OpenAL SHARED router/router.cpp router/router.h router/alc.cpp router/al.cpp)
1363 TARGET_COMPILE_DEFINITIONS(OpenAL
1364 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1365 TARGET_COMPILE_OPTIONS(OpenAL PRIVATE ${C_FLAGS})
1366 TARGET_LINK_LIBRARIES(OpenAL PRIVATE ${COMMON_LIB} ${LINKER_FLAGS})
1367 SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "")
1368 SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME})
1369 IF(TARGET build_version)
1370 ADD_DEPENDENCIES(OpenAL build_version)
1374 SET(LIBNAME "soft_oal")
1375 SET(IMPL_TARGET soft_oal)
1378 ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS})
1380 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "")
1383 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME}
1384 VERSION ${LIB_VERSION}
1385 SOVERSION ${LIB_MAJOR_VERSION}
1387 TARGET_COMPILE_DEFINITIONS(${IMPL_TARGET}
1388 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1389 TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET}
1390 PRIVATE "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc" ${INC_PATHS})
1391 TARGET_COMPILE_OPTIONS(${IMPL_TARGET} PRIVATE ${C_FLAGS})
1392 TARGET_LINK_LIBRARIES(${IMPL_TARGET}
1393 PRIVATE ${COMMON_LIB} ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
1394 IF(TARGET build_version)
1395 ADD_DEPENDENCIES(${IMPL_TARGET} build_version)
1398 IF(WIN32 AND MINGW AND ALSOFT_BUILD_IMPORT_LIB AND NOT LIBTYPE STREQUAL "STATIC")
1399 FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable")
1400 FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable")
1401 IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE)
1403 IF(NOT SED_EXECUTABLE)
1404 MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation")
1406 IF(NOT DLLTOOL_EXECUTABLE)
1407 MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation")
1410 SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS
1411 " -Wl,--output-def,OpenAL32.def")
1412 ADD_CUSTOM_COMMAND(TARGET OpenAL POST_BUILD
1413 COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def
1414 COMMAND "${DLLTOOL_EXECUTABLE}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll
1415 COMMENT "Stripping ordinals from OpenAL32.def and generating OpenAL32.lib..."
1422 INSTALL(TARGETS OpenAL EXPORT OpenAL
1423 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1424 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1425 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1426 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL
1428 EXPORT(TARGETS OpenAL
1430 FILE OpenALConfig.cmake)
1431 INSTALL(EXPORT OpenAL
1432 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL
1434 FILE OpenALConfig.cmake)
1435 INSTALL(FILES include/AL/al.h
1439 include/AL/efx-creative.h
1440 include/AL/efx-presets.h
1441 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/AL
1443 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
1444 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
1446 INSTALL(TARGETS soft_oal
1447 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1455 message(STATUS "Building DLL router")
1459 MESSAGE(STATUS "Building OpenAL with support for the following backends:")
1460 MESSAGE(STATUS " ${BACKENDS}")
1462 MESSAGE(STATUS "Building with support for CPU extensions:")
1463 MESSAGE(STATUS " ${CPU_EXTS}")
1466 MESSAGE(STATUS "Building with SSE${FPMATH_SET} codegen")
1472 MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
1473 MESSAGE(STATUS " This is probably NOT what you want!")
1478 if(ALSOFT_EMBED_HRTF_DATA)
1479 message(STATUS "Embedding HRTF datasets")
1483 # Install alsoft.conf configuration file
1485 INSTALL(FILES alsoftrc.sample
1486 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal
1488 MESSAGE(STATUS "Installing sample configuration")
1492 # Install HRTF definitions
1493 IF(ALSOFT_HRTF_DEFS)
1494 INSTALL(FILES hrtf/default-44100.mhr
1495 hrtf/default-48000.mhr
1496 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/hrtf
1498 MESSAGE(STATUS "Installing HRTF definitions")
1502 # Install AmbDec presets
1503 IF(ALSOFT_AMBDEC_PRESETS)
1504 INSTALL(FILES presets/3D7.1.ambdec
1505 presets/hexagon.ambdec
1506 presets/itu5.1.ambdec
1507 presets/itu5.1-nocenter.ambdec
1508 presets/rectangle.ambdec
1509 presets/square.ambdec
1511 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/presets
1513 MESSAGE(STATUS "Installing AmbDec presets")
1518 ADD_EXECUTABLE(openal-info utils/openal-info.c)
1519 TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS})
1520 TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL)
1522 SET(MAKEHRTF_SRCS utils/makehrtf.c)
1524 SET(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c utils/getopt.h)
1526 ADD_EXECUTABLE(makehrtf ${MAKEHRTF_SRCS})
1527 TARGET_COMPILE_DEFINITIONS(makehrtf PRIVATE ${CPP_DEFS})
1528 TARGET_COMPILE_OPTIONS(makehrtf PRIVATE ${C_FLAGS})
1530 TARGET_LINK_LIBRARIES(makehrtf PRIVATE ${LINKER_FLAGS} m)
1534 INSTALL(TARGETS openal-info makehrtf
1535 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1536 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1537 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1541 MESSAGE(STATUS "Building utility programs")
1542 IF(TARGET alsoft-config)
1543 MESSAGE(STATUS "Building configuration program")
1549 SET(TEST_COMMON_OBJS examples/common/alhelpers.c)
1551 ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS})
1552 TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS})
1553 TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS})
1554 TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB})
1557 INSTALL(TARGETS altonegen
1558 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1559 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1560 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1564 MESSAGE(STATUS "Building test programs")
1569 # Add a static library with common functions used by multiple targets
1570 ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c)
1571 TARGET_COMPILE_DEFINITIONS(ex-common PRIVATE ${CPP_DEFS})
1572 TARGET_COMPILE_OPTIONS(ex-common PRIVATE ${C_FLAGS})
1574 ADD_EXECUTABLE(alrecord examples/alrecord.c)
1575 TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS})
1576 TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS})
1577 TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} ex-common common OpenAL)
1580 INSTALL(TARGETS alrecord
1581 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1582 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1583 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1587 MESSAGE(STATUS "Building example programs")
1591 ADD_EXECUTABLE(alplay examples/alplay.c)
1592 TARGET_COMPILE_DEFINITIONS(alplay PRIVATE ${CPP_DEFS})
1593 TARGET_INCLUDE_DIRECTORIES(alplay
1594 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1595 TARGET_COMPILE_OPTIONS(alplay PRIVATE ${C_FLAGS})
1596 TARGET_LINK_LIBRARIES(alplay
1597 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1600 ADD_EXECUTABLE(alstream examples/alstream.c)
1601 TARGET_COMPILE_DEFINITIONS(alstream PRIVATE ${CPP_DEFS})
1602 TARGET_INCLUDE_DIRECTORIES(alstream
1603 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1604 TARGET_COMPILE_OPTIONS(alstream PRIVATE ${C_FLAGS})
1605 TARGET_LINK_LIBRARIES(alstream
1606 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1609 ADD_EXECUTABLE(alreverb examples/alreverb.c)
1610 TARGET_COMPILE_DEFINITIONS(alreverb PRIVATE ${CPP_DEFS})
1611 TARGET_INCLUDE_DIRECTORIES(alreverb
1612 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1613 TARGET_COMPILE_OPTIONS(alreverb PRIVATE ${C_FLAGS})
1614 TARGET_LINK_LIBRARIES(alreverb
1615 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1618 ADD_EXECUTABLE(almultireverb examples/almultireverb.c)
1619 TARGET_COMPILE_DEFINITIONS(almultireverb PRIVATE ${CPP_DEFS})
1620 TARGET_INCLUDE_DIRECTORIES(almultireverb
1621 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1622 TARGET_COMPILE_OPTIONS(almultireverb PRIVATE ${C_FLAGS})
1623 TARGET_LINK_LIBRARIES(almultireverb
1624 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1627 ADD_EXECUTABLE(allatency examples/allatency.c)
1628 TARGET_COMPILE_DEFINITIONS(allatency PRIVATE ${CPP_DEFS})
1629 TARGET_INCLUDE_DIRECTORIES(allatency
1630 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1631 TARGET_COMPILE_OPTIONS(allatency PRIVATE ${C_FLAGS})
1632 TARGET_LINK_LIBRARIES(allatency
1633 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1636 ADD_EXECUTABLE(alloopback examples/alloopback.c)
1637 TARGET_COMPILE_DEFINITIONS(alloopback PRIVATE ${CPP_DEFS})
1638 TARGET_INCLUDE_DIRECTORIES(alloopback
1639 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1640 TARGET_COMPILE_OPTIONS(alloopback PRIVATE ${C_FLAGS})
1641 TARGET_LINK_LIBRARIES(alloopback
1642 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1645 ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
1646 TARGET_COMPILE_DEFINITIONS(alhrtf PRIVATE ${CPP_DEFS})
1647 TARGET_INCLUDE_DIRECTORIES(alhrtf
1648 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1649 TARGET_COMPILE_OPTIONS(alhrtf PRIVATE ${C_FLAGS})
1650 TARGET_LINK_LIBRARIES(alhrtf
1651 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1655 INSTALL(TARGETS alplay alstream alreverb almultireverb allatency alloopback alhrtf
1656 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1657 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1658 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1662 MESSAGE(STATUS "Building SDL_sound example programs")
1668 IF(AVFORMAT_VERSION VERSION_LESS "57.56.101")
1669 MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 57.56.101)")
1672 IF(AVCODEC_VERSION VERSION_LESS "57.64.101")
1673 MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 57.64.101)")
1676 IF(AVUTIL_VERSION VERSION_LESS "55.34.101")
1677 MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 55.34.101)")
1680 IF(SWSCALE_VERSION VERSION_LESS "4.2.100")
1681 MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 4.2.100)")
1684 IF(SWRESAMPLE_VERSION VERSION_LESS "2.3.100")
1685 MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 2.3.100)")
1690 ADD_EXECUTABLE(alffplay examples/alffplay.cpp)
1691 TARGET_COMPILE_DEFINITIONS(alffplay PRIVATE ${CPP_DEFS})
1692 TARGET_INCLUDE_DIRECTORIES(alffplay
1693 PRIVATE ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
1694 TARGET_COMPILE_OPTIONS(alffplay PRIVATE ${C_FLAGS})
1695 TARGET_LINK_LIBRARIES(alffplay
1696 PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} ex-common common
1700 INSTALL(TARGETS alffplay
1701 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1702 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1703 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1706 MESSAGE(STATUS "Building SDL+FFmpeg example programs")