1 # CMake build file list for OpenAL
3 CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
7 IF(COMMAND CMAKE_POLICY)
8 CMAKE_POLICY(SET CMP0003 NEW)
9 CMAKE_POLICY(SET CMP0005 NEW)
11 CMAKE_POLICY(SET CMP0020 NEW)
14 CMAKE_POLICY(SET CMP0042 NEW)
17 CMAKE_POLICY(SET CMP0054 NEW)
19 ENDIF(COMMAND CMAKE_POLICY)
21 SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
23 INCLUDE(CheckFunctionExists)
24 INCLUDE(CheckLibraryExists)
25 INCLUDE(CheckSharedFunctionExists)
26 INCLUDE(CheckIncludeFile)
27 INCLUDE(CheckIncludeFiles)
28 INCLUDE(CheckSymbolExists)
29 INCLUDE(CheckCCompilerFlag)
30 INCLUDE(CheckCXXCompilerFlag)
31 INCLUDE(CheckCSourceCompiles)
32 INCLUDE(CheckTypeSize)
33 include(CheckStructHasMember)
34 include(CheckFileOffsetBits)
35 include(GNUInstallDirs)
37 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
40 OPTION(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON)
42 OPTION(ALSOFT_WERROR "Treat compile warnings as errors" OFF)
44 OPTION(ALSOFT_UTILS "Build and install utility programs" ON)
45 OPTION(ALSOFT_NO_CONFIG_UTIL "Disable building the alsoft-config utility" OFF)
47 OPTION(ALSOFT_EXAMPLES "Build and install example programs" ON)
48 OPTION(ALSOFT_TESTS "Build and install test programs" ON)
50 OPTION(ALSOFT_CONFIG "Install alsoft.conf sample configuration file" ON)
51 OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" ON)
52 OPTION(ALSOFT_AMBDEC_PRESETS "Install AmbDec preset files" ON)
53 OPTION(ALSOFT_INSTALL "Install headers and libraries" ON)
55 if(DEFINED SHARE_INSTALL_DIR)
56 message(WARNING "SHARE_INSTALL_DIR is deprecated. Use the variables provided by the GNUInstallDirs module instead")
57 set(CMAKE_INSTALL_DATADIR "${SHARE_INSTALL_DIR}")
60 if(DEFINED LIB_SUFFIX)
61 message(WARNING "LIB_SUFFIX is deprecated. Use the variables provided by the GNUInstallDirs module instead")
65 SET(CPP_DEFS ) # C pre-process, not C++
72 SET(CPP_DEFS ${CPP_DEFS} _WIN32 _WIN32_WINNT=0x0502)
74 OPTION(ALSOFT_BUILD_ROUTER "Build the router (EXPERIMENTAL; creates OpenAL32.dll and soft_oal.dll)" OFF)
76 # This option is mainly for static linking OpenAL Soft into another project
77 # that already defines the IDs. It is up to that project to ensure all
78 # required IDs are defined.
79 OPTION(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF)
82 OPTION(ALSOFT_BUILD_IMPORT_LIB "Build an import .lib using dlltool (requires sed)" ON)
85 SET(DLLTOOL "${HOST}-dlltool")
87 SET(DLLTOOL "dlltool")
94 # QNX's gcc do not uses /usr/include and /usr/lib pathes by default
95 IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
96 SET(INC_PATHS ${INC_PATHS} /usr/include)
97 SET(LINKER_FLAGS ${LINKER_FLAGS} -L/usr/lib)
104 SET(LIB_MAJOR_VERSION "1")
105 SET(LIB_MINOR_VERSION "18")
106 SET(LIB_REVISION "2")
107 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
113 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
114 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
117 CHECK_C_COMPILER_FLAG(-std=c11 HAVE_STD_C11)
119 SET(CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}")
121 CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
123 SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
127 CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD_CXX11)
129 SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
133 # Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions
134 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_DEFAULT)
135 IF(NOT HAVE_POSIX_MEMALIGN_DEFAULT)
136 SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
137 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600")
138 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_POSIX)
139 IF(NOT HAVE_POSIX_MEMALIGN_POSIX)
140 SET(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
142 SET(CPP_DEFS ${CPP_DEFS} _POSIX_C_SOURCE=200112L _XOPEN_SOURCE=600)
145 UNSET(OLD_REQUIRED_FLAGS)
148 # Set defines for large file support
149 CHECK_FILE_OFFSET_BITS()
150 IF(_FILE_OFFSET_BITS)
151 SET(CPP_DEFS ${CPP_DEFS} "_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
152 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
154 SET(CPP_DEFS ${CPP_DEFS} _LARGEFILE_SOURCE _LARGE_FILES)
155 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES")
157 # MSVC may need workarounds for C99 restrict and inline
159 # TODO: Once we truly require C99, these restrict and inline checks should go
161 CHECK_C_SOURCE_COMPILES("int *restrict foo;
162 int main() {return 0;}" HAVE_RESTRICT)
163 IF(NOT HAVE_RESTRICT)
164 SET(CPP_DEFS ${CPP_DEFS} "restrict=")
165 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Drestrict=")
168 CHECK_C_SOURCE_COMPILES("inline void foo(void) { }
169 int main() {return 0;}" HAVE_INLINE)
171 CHECK_C_SOURCE_COMPILES("__inline void foo(void) { }
172 int main() {return 0;}" HAVE___INLINE)
173 IF(NOT HAVE___INLINE)
174 MESSAGE(FATAL_ERROR "No inline keyword found, please report!")
177 SET(CPP_DEFS ${CPP_DEFS} inline=__inline)
178 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Dinline=__inline")
182 # Make sure we have C99-style inline semantics with GCC (4.3 or newer).
183 IF(CMAKE_COMPILER_IS_GNUCC)
184 SET(CMAKE_C_FLAGS "-fno-gnu89-inline ${CMAKE_C_FLAGS}")
186 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
187 # Force no inlining for the next test.
188 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -fno-inline")
190 CHECK_C_SOURCE_COMPILES("extern inline int foo() { return 0; }
191 int main() {return foo();}" INLINE_IS_C99)
192 IF(NOT INLINE_IS_C99)
193 MESSAGE(FATAL_ERROR "Your compiler does not seem to have C99 inline semantics!
194 Please update your compiler for better C99 compliance.")
197 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
200 # Check if we have a proper timespec declaration
201 CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
202 IF(HAVE_STRUCT_TIMESPEC)
203 # Define it here so we don't have to include config.h for it
204 SET(CPP_DEFS ${CPP_DEFS} HAVE_STRUCT_TIMESPEC)
207 # Some systems may need libatomic for C11 atomic functions to work
208 SET(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
209 SET(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES} atomic)
210 CHECK_C_SOURCE_COMPILES("#include <stdatomic.h>
211 int _Atomic foo = ATOMIC_VAR_INIT(0);
214 return atomic_fetch_add(&foo, 2);
217 IF(NOT HAVE_LIBATOMIC)
218 SET(CMAKE_REQUIRED_LIBRARIES "${OLD_REQUIRED_LIBRARIES}")
220 SET(EXTRA_LIBS atomic ${EXTRA_LIBS})
222 UNSET(OLD_REQUIRED_LIBRARIES)
224 # Include liblog for Android logging
225 CHECK_LIBRARY_EXISTS(log __android_log_print "" HAVE_LIBLOG)
227 SET(EXTRA_LIBS log ${EXTRA_LIBS})
228 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} log)
231 # Check if we have C99 bool
232 CHECK_C_SOURCE_COMPILES(
233 "int main(int argc, char *argv[])
236 ret = (argc > 1) ? 1 : 0;
241 # Check if we have C11 static_assert
242 CHECK_C_SOURCE_COMPILES(
245 _Static_assert(sizeof(int) == sizeof(int), \"What\");
248 HAVE_C11_STATIC_ASSERT)
250 # Check if we have C11 alignas
251 CHECK_C_SOURCE_COMPILES(
252 "_Alignas(16) int foo;
259 # Check if we have C11 _Atomic
260 CHECK_C_SOURCE_COMPILES(
261 "#include <stdatomic.h>
262 int _Atomic foo = ATOMIC_VAR_INIT(0);
265 atomic_fetch_add(&foo, 2);
270 # Add definitions, compiler switches, etc.
271 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_SOURCE_DIR}/common" "${OpenAL_BINARY_DIR}")
273 IF(NOT CMAKE_BUILD_TYPE)
274 SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
275 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
278 IF(NOT CMAKE_DEBUG_POSTFIX)
279 SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
280 "Library postfix for debug builds. Normally left blank."
285 SET(CPP_DEFS ${CPP_DEFS} _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
286 SET(C_FLAGS ${C_FLAGS} /wd4098)
289 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
291 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
294 MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
297 OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
298 IF(FORCE_STATIC_VCRT)
300 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
301 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
302 IF(${flag_var} MATCHES "/MD")
303 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
308 SET(C_FLAGS ${C_FLAGS} -Winline -Wall)
309 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
311 SET(C_FLAGS ${C_FLAGS} -Wextra)
315 SET(C_FLAGS ${C_FLAGS} -Werror)
318 # We want RelWithDebInfo to actually include debug stuff (define _DEBUG
320 FOREACH(flag_var CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
321 IF(${flag_var} MATCHES "-DNDEBUG")
322 STRING(REGEX REPLACE "-DNDEBUG" "-D_DEBUG" ${flag_var} "${${flag_var}}")
326 CHECK_C_COMPILER_FLAG(-fno-math-errno HAVE_FNO_MATH_ERRNO)
327 IF(HAVE_FNO_MATH_ERRNO)
328 SET(C_FLAGS ${C_FLAGS} -fno-math-errno)
331 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
332 int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
334 option(ALSOFT_STATIC_LIBGCC "Force -static-libgcc for static GCC runtimes" OFF)
335 if(ALSOFT_STATIC_LIBGCC)
336 set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
337 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -static-libgcc)
338 check_c_source_compiles(
344 HAVE_STATIC_LIBGCC_SWITCH
346 if(HAVE_STATIC_LIBGCC_SWITCH)
347 SET(LINKER_FLAGS ${LINKER_FLAGS} -static-libgcc)
349 set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
350 unset(OLD_REQUIRED_LIBRARIES)
354 # Set visibility/export options if available
356 SET(EXPORT_DECL "__declspec(dllexport)")
358 SET(ALIGN_DECL "__declspec(align(x))")
360 SET(ALIGN_DECL "__declspec(aligned(x))")
363 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
364 # Yes GCC, really don't accept visibility modes you don't support
365 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
367 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
368 int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
369 IF(HAVE_GCC_PROTECTED_VISIBILITY)
370 SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
372 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
373 int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
374 IF(HAVE_GCC_DEFAULT_VISIBILITY)
375 SET(EXPORT_DECL "__attribute__((visibility(\"default\")))")
379 IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
380 CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
381 IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
382 SET(C_FLAGS ${C_FLAGS} -fvisibility=hidden)
386 CHECK_C_SOURCE_COMPILES("int foo __attribute__((aligned(16)));
387 int main() {return 0;}" HAVE_ATTRIBUTE_ALIGNED)
388 IF(HAVE_ATTRIBUTE_ALIGNED)
389 SET(ALIGN_DECL "__attribute__((aligned(x)))")
392 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
395 CHECK_C_SOURCE_COMPILES("
399 ptr = __builtin_assume_aligned(ptr, 16);
401 }" HAVE___BUILTIN_ASSUME_ALIGNED)
402 IF(HAVE___BUILTIN_ASSUME_ALIGNED)
403 SET(ASSUME_ALIGNED_DECL "__builtin_assume_aligned(x, y)")
405 SET(ASSUME_ALIGNED_DECL "x")
411 SET(SSE4_1_SWITCH "")
412 SET(FPU_NEON_SWITCH "")
414 CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
416 SET(SSE_SWITCH "-msse")
418 CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
419 IF(HAVE_MSSE2_SWITCH)
420 SET(SSE2_SWITCH "-msse2")
422 CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH)
423 IF(HAVE_MSSE3_SWITCH)
424 SET(SSE3_SWITCH "-msse3")
426 CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH)
427 IF(HAVE_MSSE4_1_SWITCH)
428 SET(SSE4_1_SWITCH "-msse4.1")
430 CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH)
431 IF(HAVE_MFPU_NEON_SWITCH)
432 SET(FPU_NEON_SWITCH "-mfpu=neon")
435 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
436 int main() {return 0;}" HAVE_GCC_FORMAT)
438 CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
439 CHECK_INCLUDE_FILE(stdalign.h HAVE_STDALIGN_H)
440 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
441 CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
442 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
443 CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
444 CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
445 CHECK_INCLUDE_FILE(sys/sysconf.h HAVE_SYS_SYSCONF_H)
446 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
447 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
448 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
449 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
450 IF(NOT HAVE_GUIDDEF_H)
451 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
454 # Some systems need libm for some of the following math functions to work
456 CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
458 SET(MATH_LIB ${MATH_LIB} m)
459 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
462 # Check for the dlopen API (for dynamicly loading backend libs)
464 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
466 SET(EXTRA_LIBS dl ${EXTRA_LIBS})
467 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
470 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
473 # Check for a cpuid intrinsic
475 CHECK_C_SOURCE_COMPILES("#include <cpuid.h>
478 unsigned int eax, ebx, ecx, edx;
479 return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
480 }" HAVE_GCC_GET_CPUID)
483 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
489 }" HAVE_CPUID_INTRINSIC)
490 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
493 unsigned long idx = 0;
494 _BitScanForward64(&idx, 1);
496 }" HAVE_BITSCANFORWARD64_INTRINSIC)
497 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
500 unsigned long idx = 0;
501 _BitScanForward(&idx, 1);
503 }" HAVE_BITSCANFORWARD_INTRINSIC)
506 CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF)
507 CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
508 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
509 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
510 CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
511 CHECK_SYMBOL_EXISTS(modff math.h HAVE_MODFF)
512 CHECK_SYMBOL_EXISTS(log2f math.h HAVE_LOG2F)
513 CHECK_SYMBOL_EXISTS(cbrtf math.h HAVE_CBRTF)
516 CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
517 CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
520 CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
521 CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
522 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
523 IF(NOT HAVE_STRCASECMP)
524 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
525 IF(NOT HAVE__STRICMP)
526 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
529 SET(CPP_DEFS ${CPP_DEFS} strcasecmp=_stricmp)
532 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
533 IF(NOT HAVE_STRNCASECMP)
534 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
535 IF(NOT HAVE__STRNICMP)
536 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
539 SET(CPP_DEFS ${CPP_DEFS} strncasecmp=_strnicmp)
542 CHECK_SYMBOL_EXISTS(strnlen string.h HAVE_STRNLEN)
543 CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
544 IF(NOT HAVE_SNPRINTF)
545 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
546 IF(NOT HAVE__SNPRINTF)
547 MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
550 SET(CPP_DEFS ${CPP_DEFS} snprintf=_snprintf)
553 CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
554 IF(NOT HAVE_ISFINITE)
555 CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
557 CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE)
559 MESSAGE(FATAL_ERROR "No isfinite function found, please report!")
561 SET(CPP_DEFS ${CPP_DEFS} isfinite=_finite)
563 SET(CPP_DEFS ${CPP_DEFS} isfinite=finite)
567 CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
569 CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN)
571 MESSAGE(FATAL_ERROR "No isnan function found, please report!")
574 SET(CPP_DEFS ${CPP_DEFS} isnan=_isnan)
578 # Check if we have Windows headers
579 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502)
580 IF(NOT HAVE_WINDOWS_H)
581 CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
582 IF(NOT HAVE_GETTIMEOFDAY)
583 MESSAGE(FATAL_ERROR "No timing function found!")
586 CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
587 IF(NOT HAVE_NANOSLEEP)
588 MESSAGE(FATAL_ERROR "No sleep function found!")
591 # We need pthreads outside of Windows
592 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
593 IF(NOT HAVE_PTHREAD_H)
594 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
596 # Some systems need pthread_np.h to get recursive mutexes
597 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
599 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
601 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
602 SET(C_FLAGS ${C_FLAGS} -pthread)
603 SET(LINKER_FLAGS ${LINKER_FLAGS} -pthread)
606 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
608 SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
611 CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
613 IF(HAVE_PTHREAD_NP_H)
614 CHECK_SYMBOL_EXISTS(pthread_setname_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SETNAME_NP)
615 IF(NOT HAVE_PTHREAD_SETNAME_NP)
616 CHECK_SYMBOL_EXISTS(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
618 CHECK_C_SOURCE_COMPILES("
620 #include <pthread_np.h>
623 pthread_setname_np(\"testname\");
626 PTHREAD_SETNAME_NP_ONE_PARAM
628 CHECK_C_SOURCE_COMPILES("
630 #include <pthread_np.h>
633 pthread_setname_np(pthread_self(), \"%s\", \"testname\");
636 PTHREAD_SETNAME_NP_THREE_PARAMS
639 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
641 CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
642 IF(NOT HAVE_PTHREAD_SETNAME_NP)
643 CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
645 CHECK_C_SOURCE_COMPILES("
649 pthread_setname_np(\"testname\");
652 PTHREAD_SETNAME_NP_ONE_PARAM
654 CHECK_C_SOURCE_COMPILES("
658 pthread_setname_np(pthread_self(), \"%s\", \"testname\");
661 PTHREAD_SETNAME_NP_THREE_PARAMS
664 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
667 CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK)
669 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
671 SET(EXTRA_LIBS rt ${EXTRA_LIBS})
675 CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_GETOPT)
677 # Check for a 64-bit type
678 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
679 IF(NOT HAVE_STDINT_H)
681 CHECK_C_SOURCE_COMPILES("#define _WIN32_WINNT 0x0502
684 int main() {return 0;}" HAVE___INT64)
687 IF(NOT SIZEOF_LONG MATCHES "8")
688 IF(NOT SIZEOF_LONG_LONG MATCHES "8")
689 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
696 SET(COMMON_OBJS common/almalloc.c
702 SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c
706 OpenAL32/alExtension.c
708 OpenAL32/alListener.c
712 OpenAL32/sample_cvt.c
714 SET(ALC_OBJS Alc/ALc.c
722 Alc/effects/compressor.c
723 Alc/effects/dedicated.c
724 Alc/effects/distortion.c
726 Alc/effects/equalizer.c
727 Alc/effects/modulator.c
742 SET(CPU_EXTS "Default")
757 SET(HAVE_PORTAUDIO 0)
758 SET(HAVE_PULSEAUDIO 0)
759 SET(HAVE_COREAUDIO 0)
764 # Check for SSE support
765 OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
766 CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
768 OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
769 IF(ALSOFT_CPUEXT_SSE)
770 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
772 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse.c)
774 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse.c PROPERTIES
775 COMPILE_FLAGS "${SSE_SWITCH}")
777 SET(CPU_EXTS "${CPU_EXTS}, SSE")
781 IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
782 MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
785 OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
786 CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
788 OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
789 IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
790 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
792 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse2.c)
794 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse2.c PROPERTIES
795 COMPILE_FLAGS "${SSE2_SWITCH}")
797 SET(CPU_EXTS "${CPU_EXTS}, SSE2")
801 IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
802 MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
805 OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE3 support" OFF)
806 CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}")
808 OPTION(ALSOFT_CPUEXT_SSE3 "Enable SSE3 support" ON)
809 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE3)
810 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
812 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse3.c)
814 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse3.c PROPERTIES
815 COMPILE_FLAGS "${SSE3_SWITCH}")
817 SET(CPU_EXTS "${CPU_EXTS}, SSE3")
821 IF(ALSOFT_REQUIRE_SSE3 AND NOT HAVE_SSE3)
822 MESSAGE(FATAL_ERROR "Failed to enable required SSE3 CPU extensions")
825 OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
826 CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
828 OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
829 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1)
830 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
832 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse41.c)
834 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse41.c PROPERTIES
835 COMPILE_FLAGS "${SSE4_1_SWITCH}")
837 SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
841 IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
842 MESSAGE(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
845 # Check for ARM Neon support
846 OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
847 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H ${FPU_NEON_SWITCH})
849 OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON)
850 IF(ALSOFT_CPUEXT_NEON)
852 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_neon.c)
854 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_neon.c PROPERTIES
855 COMPILE_FLAGS "${FPU_NEON_SWITCH}")
857 SET(CPU_EXTS "${CPU_EXTS}, Neon")
860 IF(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
861 MESSAGE(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
865 IF(WIN32 OR HAVE_DLFCN_H)
867 MACRO(ADD_BACKEND_LIBS _LIBS)
870 SET(IS_LINKED " (linked)")
871 MACRO(ADD_BACKEND_LIBS _LIBS)
872 SET(EXTRA_LIBS ${_LIBS} ${EXTRA_LIBS})
877 SET(ALC_OBJS ${ALC_OBJS}
879 # Default backends, always available
880 Alc/backends/loopback.c
885 OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
888 OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
889 IF(ALSOFT_BACKEND_ALSA)
891 SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
892 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c)
893 ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
894 SET(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS})
897 IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
898 MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend")
902 OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
905 OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
906 IF(ALSOFT_BACKEND_OSS)
908 SET(BACKENDS "${BACKENDS} OSS,")
909 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
911 SET(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS})
913 SET(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS})
916 IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
917 MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend")
920 # Check Solaris backend
921 OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
922 FIND_PACKAGE(AudioIO)
924 OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
925 IF(ALSOFT_BACKEND_SOLARIS)
927 SET(BACKENDS "${BACKENDS} Solaris,")
928 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
929 SET(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS})
932 IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
933 MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend")
936 # Check SndIO backend
937 OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
938 FIND_PACKAGE(SoundIO)
940 OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
941 IF(ALSOFT_BACKEND_SNDIO)
943 SET(BACKENDS "${BACKENDS} SndIO (linked),")
944 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c)
945 SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
946 SET(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS})
949 IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
950 MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend")
954 OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF)
957 OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON)
958 IF(ALSOFT_BACKEND_QSA)
960 SET(BACKENDS "${BACKENDS} QSA (linked),")
961 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c)
962 SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
963 SET(INC_PATHS ${INC_PATHS} ${QSA_INCLUDE_DIRS})
966 IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA)
967 MESSAGE(FATAL_ERROR "Failed to enabled required QSA backend")
970 # Check Windows-only backends
971 OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
972 OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
973 OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF)
975 # Check MMSystem backend
976 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
978 CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
980 OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
981 IF(ALSOFT_BACKEND_WINMM)
983 SET(BACKENDS "${BACKENDS} WinMM,")
984 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
985 SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
990 # Check DSound backend
993 OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
994 IF(ALSOFT_BACKEND_DSOUND)
996 SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
997 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c)
998 ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
999 SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS})
1003 # Check for MMDevApi backend
1004 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
1005 IF(HAVE_MMDEVICEAPI_H)
1006 OPTION(ALSOFT_BACKEND_MMDEVAPI "Enable MMDevApi backend" ON)
1007 IF(ALSOFT_BACKEND_MMDEVAPI)
1008 SET(HAVE_MMDEVAPI 1)
1009 SET(BACKENDS "${BACKENDS} MMDevApi,")
1010 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c)
1014 IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
1015 MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")
1017 IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND)
1018 MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend")
1020 IF(ALSOFT_REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI)
1021 MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend")
1024 # Check PortAudio backend
1025 OPTION(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
1026 FIND_PACKAGE(PortAudio)
1028 OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
1029 IF(ALSOFT_BACKEND_PORTAUDIO)
1030 SET(HAVE_PORTAUDIO 1)
1031 SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
1032 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c)
1033 ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
1034 SET(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS})
1037 IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
1038 MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend")
1041 # Check PulseAudio backend
1042 OPTION(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
1043 FIND_PACKAGE(PulseAudio)
1044 IF(PULSEAUDIO_FOUND)
1045 OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
1046 IF(ALSOFT_BACKEND_PULSEAUDIO)
1047 SET(HAVE_PULSEAUDIO 1)
1048 SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
1049 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c)
1050 ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
1051 SET(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS})
1054 IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
1055 MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend")
1058 # Check JACK backend
1059 OPTION(ALSOFT_REQUIRE_JACK "Require JACK backend" OFF)
1062 OPTION(ALSOFT_BACKEND_JACK "Enable JACK backend" ON)
1063 IF(ALSOFT_BACKEND_JACK)
1065 SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
1066 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.c)
1067 ADD_BACKEND_LIBS(${JACK_LIBRARIES})
1068 SET(INC_PATHS ${INC_PATHS} ${JACK_INCLUDE_DIRS})
1071 IF(ALSOFT_REQUIRE_JACK AND NOT HAVE_JACK)
1072 MESSAGE(FATAL_ERROR "Failed to enabled required JACK backend")
1075 # Check CoreAudio backend
1076 OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
1077 FIND_LIBRARY(COREAUDIO_FRAMEWORK
1079 PATHS /System/Library/Frameworks
1081 IF(COREAUDIO_FRAMEWORK)
1082 OPTION(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
1083 IF(ALSOFT_BACKEND_COREAUDIO)
1084 SET(HAVE_COREAUDIO 1)
1085 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c)
1086 SET(BACKENDS "${BACKENDS} CoreAudio,")
1087 SET(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${EXTRA_LIBS})
1088 SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
1089 SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
1091 # Some versions of OSX may need the AudioToolbox framework. Add it if
1093 FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
1095 PATHS ~/Library/Frameworks
1097 /System/Library/Frameworks
1099 IF(AUDIOTOOLBOX_LIBRARY)
1100 SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
1104 IF(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
1105 MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend")
1108 # Check for OpenSL (Android) backend
1109 OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
1110 CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
1111 IF(HAVE_SLES_OPENSLES_ANDROID_H)
1112 CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
1113 IF(HAVE_LIBOPENSLES)
1114 OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
1115 IF(ALSOFT_BACKEND_OPENSL)
1117 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c)
1118 SET(BACKENDS "${BACKENDS} OpenSL,")
1119 SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
1123 IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
1124 MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
1127 # Check for SDL2 backend
1128 OPTION(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF)
1131 # Off by default, since it adds a runtime dependency
1132 OPTION(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF)
1133 IF(ALSOFT_BACKEND_SDL2)
1135 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sdl2.c)
1136 SET(BACKENDS "${BACKENDS} SDL2,")
1137 SET(EXTRA_LIBS ${SDL2_LIBRARY} ${EXTRA_LIBS})
1140 IF(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND)
1141 MESSAGE(FATAL_ERROR "Failed to enabled required SDL2 backend")
1144 # Optionally enable the Wave Writer backend
1145 OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
1146 IF(ALSOFT_BACKEND_WAVE)
1148 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c)
1149 SET(BACKENDS "${BACKENDS} WaveFile,")
1152 # This is always available
1153 SET(BACKENDS "${BACKENDS} Null")
1157 IF(GIT_FOUND AND EXISTS "${OpenAL_SOURCE_DIR}/.git")
1158 # Get the current working branch and its latest abbreviated commit hash
1159 ADD_CUSTOM_TARGET(build_version
1160 ${CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE}
1161 -D LIB_VERSION=${LIB_VERSION}
1162 -D SRC=${OpenAL_SOURCE_DIR}/version.h.in
1163 -D DST=${OpenAL_BINARY_DIR}/version.h
1164 -P ${OpenAL_SOURCE_DIR}/version.cmake
1165 WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
1169 SET(GIT_BRANCH "UNKNOWN")
1170 SET(GIT_COMMIT_HASH "unknown")
1172 "${OpenAL_SOURCE_DIR}/version.h.in"
1173 "${OpenAL_BINARY_DIR}/version.h")
1176 SET(NATIVE_SRC_DIR "${OpenAL_SOURCE_DIR}/native-tools/")
1177 SET(NATIVE_BIN_DIR "${OpenAL_BINARY_DIR}/native-tools/")
1178 FILE(MAKE_DIRECTORY "${NATIVE_BIN_DIR}")
1180 SET(BIN2H_COMMAND "${NATIVE_BIN_DIR}bin2h")
1181 SET(BSINCGEN_COMMAND "${NATIVE_BIN_DIR}bsincgen")
1182 ADD_CUSTOM_COMMAND(OUTPUT "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1183 COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "${NATIVE_SRC_DIR}"
1184 COMMAND ${CMAKE_COMMAND} -E remove "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1185 COMMAND ${CMAKE_COMMAND} --build . --config "Release"
1186 WORKING_DIRECTORY "${NATIVE_BIN_DIR}"
1187 DEPENDS "${NATIVE_SRC_DIR}CMakeLists.txt"
1188 IMPLICIT_DEPENDS C "${NATIVE_SRC_DIR}bin2h.c"
1189 C "${NATIVE_SRC_DIR}bsincgen.c"
1192 ADD_CUSTOM_TARGET(native-tools
1193 DEPENDS "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1197 option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" OFF)
1198 if(ALSOFT_EMBED_HRTF_DATA)
1199 MACRO(make_hrtf_header FILENAME VARNAME)
1200 SET(infile "${OpenAL_SOURCE_DIR}/hrtf/${FILENAME}")
1201 SET(outfile "${OpenAL_BINARY_DIR}/${FILENAME}.h")
1203 ADD_CUSTOM_COMMAND(OUTPUT "${outfile}"
1204 COMMAND "${BIN2H_COMMAND}" "${infile}" "${outfile}" ${VARNAME}
1205 DEPENDS native-tools "${infile}"
1208 SET(ALC_OBJS ${ALC_OBJS} "${outfile}")
1211 make_hrtf_header(default-44100.mhr "hrtf_default_44100")
1212 make_hrtf_header(default-48000.mhr "hrtf_default_48000")
1215 ADD_CUSTOM_COMMAND(OUTPUT "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1216 COMMAND "${BSINCGEN_COMMAND}" "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1217 DEPENDS native-tools "${NATIVE_SRC_DIR}bsincgen.c"
1220 SET(ALC_OBJS ${ALC_OBJS} "${OpenAL_BINARY_DIR}/bsinc_inc.h")
1223 IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL)
1224 add_subdirectory(utils/alsoft-config)
1231 FIND_PACKAGE(SDL_sound)
1232 FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE)
1237 SET(LIBNAME "openal")
1239 SET(LIBNAME "OpenAL32")
1242 # Needed for openal.pc.in
1243 SET(prefix ${CMAKE_INSTALL_PREFIX})
1244 SET(exec_prefix "\${prefix}")
1245 SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
1246 SET(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
1247 SET(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
1248 SET(PACKAGE_VERSION "${LIB_VERSION}")
1249 IF(LIBTYPE STREQUAL "STATIC")
1250 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS})
1255 "${OpenAL_SOURCE_DIR}/config.h.in"
1256 "${OpenAL_BINARY_DIR}/config.h")
1258 "${OpenAL_SOURCE_DIR}/openal.pc.in"
1259 "${OpenAL_BINARY_DIR}/openal.pc"
1263 # Add a static library with common functions used by multiple targets
1264 ADD_LIBRARY(common STATIC ${COMMON_OBJS})
1265 TARGET_COMPILE_DEFINITIONS(common PRIVATE ${CPP_DEFS})
1266 TARGET_COMPILE_OPTIONS(common PRIVATE ${C_FLAGS})
1270 SET(IMPL_TARGET OpenAL)
1274 # Build main library
1275 IF(LIBTYPE STREQUAL "STATIC")
1276 SET(CPP_DEFS ${CPP_DEFS} AL_LIBTYPE_STATIC)
1277 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
1278 SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS)
1280 ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
1282 # Make sure to compile the common code with PIC, since it'll be linked into
1283 # shared libs that needs it.
1284 SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE)
1285 SET(COMMON_LIB common)
1289 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "/SUBSYSTEM:WINDOWS")
1290 ELSEIF(CMAKE_COMPILER_IS_GNUCC)
1291 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "-mwindows")
1295 IF(WIN32 AND ALSOFT_BUILD_ROUTER)
1296 ADD_LIBRARY(OpenAL SHARED router/router.c router/alc.c router/al.c)
1297 TARGET_COMPILE_DEFINITIONS(OpenAL
1298 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1299 TARGET_COMPILE_OPTIONS(OpenAL PRIVATE ${C_FLAGS})
1300 TARGET_LINK_LIBRARIES(OpenAL PRIVATE ${LINKER_FLAGS} ${COMMON_LIB})
1301 SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "")
1302 SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME})
1303 IF(TARGET build_version)
1304 ADD_DEPENDENCIES(OpenAL build_version)
1308 SET(LIBNAME "soft_oal")
1309 SET(IMPL_TARGET soft_oal)
1312 ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS})
1314 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "")
1317 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME}
1318 VERSION ${LIB_VERSION}
1319 SOVERSION ${LIB_MAJOR_VERSION}
1321 TARGET_COMPILE_DEFINITIONS(${IMPL_TARGET}
1322 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1323 TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET}
1324 PRIVATE "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc" ${INC_PATHS})
1325 TARGET_COMPILE_OPTIONS(${IMPL_TARGET} PRIVATE ${C_FLAGS})
1326 TARGET_LINK_LIBRARIES(${IMPL_TARGET}
1327 PRIVATE ${LINKER_FLAGS} ${COMMON_LIB} ${EXTRA_LIBS} ${MATH_LIB})
1328 IF(TARGET build_version)
1329 ADD_DEPENDENCIES(${IMPL_TARGET} build_version)
1332 IF(WIN32 AND MINGW AND ALSOFT_BUILD_IMPORT_LIB AND NOT LIBTYPE STREQUAL "STATIC")
1333 FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable")
1334 FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable")
1335 IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE)
1337 IF(NOT SED_EXECUTABLE)
1338 MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation")
1340 IF(NOT DLLTOOL_EXECUTABLE)
1341 MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation")
1344 SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS
1345 " -Wl,--output-def,OpenAL32.def")
1346 ADD_CUSTOM_COMMAND(TARGET OpenAL POST_BUILD
1347 COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def
1348 COMMAND "${DLLTOOL_EXECUTABLE}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll
1349 COMMENT "Stripping ordinals from OpenAL32.def and generating OpenAL32.lib..."
1356 INSTALL(TARGETS OpenAL EXPORT OpenAL
1357 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1358 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1359 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1360 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL
1362 EXPORT(TARGETS OpenAL
1364 FILE OpenALConfig.cmake)
1365 INSTALL(EXPORT OpenAL
1366 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL
1368 FILE OpenALConfig.cmake)
1369 INSTALL(FILES include/AL/al.h
1373 include/AL/efx-creative.h
1374 include/AL/efx-presets.h
1375 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/AL
1377 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
1378 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
1380 INSTALL(TARGETS soft_oal
1381 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1389 message(STATUS "Building DLL router")
1393 MESSAGE(STATUS "Building OpenAL with support for the following backends:")
1394 MESSAGE(STATUS " ${BACKENDS}")
1396 MESSAGE(STATUS "Building with support for CPU extensions:")
1397 MESSAGE(STATUS " ${CPU_EXTS}")
1402 MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
1403 MESSAGE(STATUS " This is probably NOT what you want!")
1408 if(ALSOFT_EMBED_HRTF_DATA)
1409 message(STATUS "Embedding HRTF datasets")
1413 # Install alsoft.conf configuration file
1415 INSTALL(FILES alsoftrc.sample
1416 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal
1418 MESSAGE(STATUS "Installing sample configuration")
1422 # Install HRTF definitions
1423 IF(ALSOFT_HRTF_DEFS)
1424 INSTALL(FILES hrtf/default-44100.mhr
1425 hrtf/default-48000.mhr
1426 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/hrtf
1428 MESSAGE(STATUS "Installing HRTF definitions")
1432 # Install AmbDec presets
1433 IF(ALSOFT_AMBDEC_PRESETS)
1434 INSTALL(FILES presets/3D7.1.ambdec
1435 presets/hexagon.ambdec
1436 presets/itu5.1.ambdec
1437 presets/itu5.1-nocenter.ambdec
1438 presets/rectangle.ambdec
1439 presets/square.ambdec
1441 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/presets
1443 MESSAGE(STATUS "Installing AmbDec presets")
1448 ADD_EXECUTABLE(openal-info utils/openal-info.c)
1449 TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS})
1450 TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL)
1452 SET(MAKEHRTF_SRCS utils/makehrtf.c)
1454 SET(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c)
1456 ADD_EXECUTABLE(makehrtf ${MAKEHRTF_SRCS})
1457 TARGET_COMPILE_DEFINITIONS(makehrtf PRIVATE ${CPP_DEFS})
1458 TARGET_COMPILE_OPTIONS(makehrtf PRIVATE ${C_FLAGS})
1460 TARGET_LINK_LIBRARIES(makehrtf PRIVATE ${LINKER_FLAGS} m)
1464 INSTALL(TARGETS openal-info makehrtf
1465 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1466 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1467 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1471 MESSAGE(STATUS "Building utility programs")
1472 IF(TARGET alsoft-config)
1473 MESSAGE(STATUS "Building configuration program")
1479 SET(TEST_COMMON_OBJS examples/common/alhelpers.c)
1481 ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS})
1482 TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS})
1483 TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS})
1484 TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB})
1487 INSTALL(TARGETS altonegen
1488 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1489 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1490 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1494 MESSAGE(STATUS "Building test programs")
1499 ADD_EXECUTABLE(alrecord examples/alrecord.c)
1500 TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS})
1501 TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS})
1502 TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL)
1505 INSTALL(TARGETS alrecord
1506 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1507 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1508 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1512 MESSAGE(STATUS "Building example programs")
1516 # Add a static library with common functions used by multiple targets
1517 ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c)
1518 TARGET_COMPILE_DEFINITIONS(ex-common PRIVATE ${CPP_DEFS})
1519 TARGET_COMPILE_OPTIONS(ex-common PRIVATE ${C_FLAGS})
1521 ADD_EXECUTABLE(alplay examples/alplay.c)
1522 TARGET_COMPILE_DEFINITIONS(alplay PRIVATE ${CPP_DEFS})
1523 TARGET_INCLUDE_DIRECTORIES(alplay
1524 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1525 TARGET_COMPILE_OPTIONS(alplay PRIVATE ${C_FLAGS})
1526 TARGET_LINK_LIBRARIES(alplay
1527 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1530 ADD_EXECUTABLE(alstream examples/alstream.c)
1531 TARGET_COMPILE_DEFINITIONS(alstream PRIVATE ${CPP_DEFS})
1532 TARGET_INCLUDE_DIRECTORIES(alstream
1533 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1534 TARGET_COMPILE_OPTIONS(alstream PRIVATE ${C_FLAGS})
1535 TARGET_LINK_LIBRARIES(alstream
1536 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1539 ADD_EXECUTABLE(alreverb examples/alreverb.c)
1540 TARGET_COMPILE_DEFINITIONS(alreverb PRIVATE ${CPP_DEFS})
1541 TARGET_INCLUDE_DIRECTORIES(alreverb
1542 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1543 TARGET_COMPILE_OPTIONS(alreverb PRIVATE ${C_FLAGS})
1544 TARGET_LINK_LIBRARIES(alreverb
1545 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1548 ADD_EXECUTABLE(almultireverb examples/almultireverb.c)
1549 TARGET_COMPILE_DEFINITIONS(almultireverb PRIVATE ${CPP_DEFS})
1550 TARGET_INCLUDE_DIRECTORIES(almultireverb
1551 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1552 TARGET_COMPILE_OPTIONS(almultireverb PRIVATE ${C_FLAGS})
1553 TARGET_LINK_LIBRARIES(almultireverb
1554 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1557 ADD_EXECUTABLE(allatency examples/allatency.c)
1558 TARGET_COMPILE_DEFINITIONS(allatency PRIVATE ${CPP_DEFS})
1559 TARGET_INCLUDE_DIRECTORIES(allatency
1560 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1561 TARGET_COMPILE_OPTIONS(allatency PRIVATE ${C_FLAGS})
1562 TARGET_LINK_LIBRARIES(allatency
1563 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1566 ADD_EXECUTABLE(alloopback examples/alloopback.c)
1567 TARGET_COMPILE_DEFINITIONS(alloopback PRIVATE ${CPP_DEFS})
1568 TARGET_INCLUDE_DIRECTORIES(alloopback
1569 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1570 TARGET_COMPILE_OPTIONS(alloopback PRIVATE ${C_FLAGS})
1571 TARGET_LINK_LIBRARIES(alloopback
1572 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1575 ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
1576 TARGET_COMPILE_DEFINITIONS(alhrtf PRIVATE ${CPP_DEFS})
1577 TARGET_INCLUDE_DIRECTORIES(alhrtf
1578 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1579 TARGET_COMPILE_OPTIONS(alhrtf PRIVATE ${C_FLAGS})
1580 TARGET_LINK_LIBRARIES(alhrtf
1581 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1585 INSTALL(TARGETS alplay alstream alreverb almultireverb allatency alloopback alhrtf
1586 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1587 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1588 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1592 MESSAGE(STATUS "Building SDL_sound example programs")
1598 IF(AVFORMAT_VERSION VERSION_LESS "57.56.101")
1599 MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 57.56.101)")
1602 IF(AVCODEC_VERSION VERSION_LESS "57.64.101")
1603 MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 57.64.101)")
1606 IF(AVUTIL_VERSION VERSION_LESS "55.34.101")
1607 MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 55.34.101)")
1610 IF(SWSCALE_VERSION VERSION_LESS "4.2.100")
1611 MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 4.2.100)")
1614 IF(SWRESAMPLE_VERSION VERSION_LESS "2.3.100")
1615 MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 2.3.100)")
1620 ADD_EXECUTABLE(alffplay examples/alffplay.cpp)
1621 TARGET_COMPILE_DEFINITIONS(alffplay PRIVATE ${CPP_DEFS})
1622 TARGET_INCLUDE_DIRECTORIES(alffplay
1623 PRIVATE ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
1624 TARGET_COMPILE_OPTIONS(alffplay PRIVATE ${C_FLAGS})
1625 TARGET_LINK_LIBRARIES(alffplay
1626 PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} common OpenAL)
1629 INSTALL(TARGETS alffplay
1630 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1631 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1632 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1635 MESSAGE(STATUS "Building SDL+FFmpeg example programs")