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 # 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 # Add definitions, compiler switches, etc.
232 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_SOURCE_DIR}/common" "${OpenAL_BINARY_DIR}")
234 IF(NOT CMAKE_BUILD_TYPE)
235 SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
236 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
239 IF(NOT CMAKE_DEBUG_POSTFIX)
240 SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
241 "Library postfix for debug builds. Normally left blank."
246 SET(CPP_DEFS ${CPP_DEFS} _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE NOMINMAX)
247 SET(C_FLAGS ${C_FLAGS} /wd4065 /wd4098 /wd4200)
250 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
252 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
255 MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
258 OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
259 IF(FORCE_STATIC_VCRT)
261 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
262 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
263 IF(${flag_var} MATCHES "/MD")
264 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
269 SET(C_FLAGS ${C_FLAGS} -Winline -Wall)
270 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
272 SET(C_FLAGS ${C_FLAGS} -Wextra)
276 SET(C_FLAGS ${C_FLAGS} -Werror)
279 # We want RelWithDebInfo to actually include debug stuff (define _DEBUG
281 FOREACH(flag_var CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
282 IF(${flag_var} MATCHES "-DNDEBUG")
283 STRING(REGEX REPLACE "-DNDEBUG" "-D_DEBUG" ${flag_var} "${${flag_var}}")
287 CHECK_C_COMPILER_FLAG(-fno-math-errno HAVE_FNO_MATH_ERRNO)
288 IF(HAVE_FNO_MATH_ERRNO)
289 SET(C_FLAGS ${C_FLAGS} -fno-math-errno)
292 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
293 int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
295 option(ALSOFT_STATIC_LIBGCC "Force -static-libgcc for static GCC runtimes" OFF)
296 if(ALSOFT_STATIC_LIBGCC)
297 set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
298 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -static-libgcc)
299 check_c_source_compiles(
305 HAVE_STATIC_LIBGCC_SWITCH
307 set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
308 unset(OLD_REQUIRED_LIBRARIES)
310 if(NOT HAVE_STATIC_LIBGCC_SWITCH)
311 message(FATAL_ERROR "Cannot static link libgcc")
313 set(LINKER_FLAGS ${LINKER_FLAGS} -static-libgcc)
316 option(ALSOFT_STATIC_STDCXX "Static link libstdc++" OFF)
317 if(ALSOFT_STATIC_STDCXX)
318 set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
319 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,--push-state,-Bstatic,-lstdc++,--pop-state")
320 check_cxx_source_compiles(
326 HAVE_STATIC_LIBSTDCXX_SWITCH
328 set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
329 unset(OLD_REQUIRED_LIBRARIES)
331 if(NOT HAVE_STATIC_LIBSTDCXX_SWITCH)
332 message(FATAL_ERROR "Cannot static link libstdc++")
334 set(LINKER_FLAGS ${LINKER_FLAGS} "-Wl,--push-state,-Bstatic,-lstdc++,--pop-state")
338 option(ALSOFT_STATIC_WINPTHREAD "Static link libwinpthread" OFF)
339 if(ALSOFT_STATIC_WINPTHREAD)
340 set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
341 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,--push-state,-Bstatic,-lwinpthread,--pop-state")
342 check_cxx_source_compiles(
348 HAVE_STATIC_LIBWINPTHREAD_SWITCH
350 set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
351 unset(OLD_REQUIRED_LIBRARIES)
353 if(NOT HAVE_STATIC_LIBWINPTHREAD_SWITCH)
354 message(FATAL_ERROR "Cannot static link libwinpthread")
356 set(LINKER_FLAGS ${LINKER_FLAGS} "-Wl,--push-state,-Bstatic,-lwinpthread,--pop-state")
361 # Set visibility/export options if available
363 SET(EXPORT_DECL "__declspec(dllexport)")
365 SET(ALIGN_DECL "__declspec(align(x))")
367 SET(ALIGN_DECL "__declspec(aligned(x))")
370 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
371 # Yes GCC, really don't accept visibility modes you don't support
372 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
374 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
375 int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
376 IF(HAVE_GCC_PROTECTED_VISIBILITY)
377 SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
379 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
380 int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
381 IF(HAVE_GCC_DEFAULT_VISIBILITY)
382 SET(EXPORT_DECL "__attribute__((visibility(\"default\")))")
386 IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
387 CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
388 IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
389 SET(C_FLAGS ${C_FLAGS} -fvisibility=hidden)
393 CHECK_C_SOURCE_COMPILES("int foo __attribute__((aligned(16)));
394 int main() {return 0;}" HAVE_ATTRIBUTE_ALIGNED)
395 IF(HAVE_ATTRIBUTE_ALIGNED)
396 SET(ALIGN_DECL "__attribute__((aligned(x)))")
399 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
405 SET(SSE4_1_SWITCH "")
406 SET(FPU_NEON_SWITCH "")
408 CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
410 SET(SSE_SWITCH "-msse")
412 CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
413 IF(HAVE_MSSE2_SWITCH)
414 SET(SSE2_SWITCH "-msse2")
416 CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH)
417 IF(HAVE_MSSE3_SWITCH)
418 SET(SSE3_SWITCH "-msse3")
420 CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH)
421 IF(HAVE_MSSE4_1_SWITCH)
422 SET(SSE4_1_SWITCH "-msse4.1")
424 CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH)
425 IF(HAVE_MFPU_NEON_SWITCH)
426 SET(FPU_NEON_SWITCH "-mfpu=neon")
430 IF(CMAKE_SIZEOF_VOID_P MATCHES "4")
431 IF(SSE_SWITCH OR MSVC)
432 OPTION(ALSOFT_ENABLE_SSE_CODEGEN "Enable SSE code generation instead of x87 for 32-bit targets." TRUE)
434 IF(SSE2_SWITCH OR MSVC)
435 OPTION(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE)
438 IF(ALSOFT_ENABLE_SSE2_CODEGEN)
440 CHECK_C_COMPILER_FLAG("${SSE2_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE_2)
441 IF(HAVE_MFPMATH_SSE_2)
442 SET(C_FLAGS ${C_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
446 CHECK_C_COMPILER_FLAG("/arch:SSE2" HAVE_ARCH_SSE2)
448 SET(C_FLAGS ${C_FLAGS} "/arch:SSE2")
453 IF(ALSOFT_ENABLE_SSE_CODEGEN AND NOT FPMATH_SET)
455 CHECK_C_COMPILER_FLAG("${SSE_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE)
457 SET(C_FLAGS ${C_FLAGS} ${SSE_SWITCH} -mfpmath=sse)
461 CHECK_C_COMPILER_FLAG("/arch:SSE" HAVE_ARCH_SSE)
463 SET(C_FLAGS ${C_FLAGS} "/arch:SSE")
471 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
472 int main() {return 0;}" HAVE_GCC_FORMAT)
474 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
475 CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
476 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
477 CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
478 CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
479 CHECK_INCLUDE_FILE(sys/sysconf.h HAVE_SYS_SYSCONF_H)
480 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
481 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
482 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
483 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
484 IF(NOT HAVE_GUIDDEF_H)
485 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
488 # Some systems need libm for some of the following math functions to work
490 CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
492 SET(MATH_LIB ${MATH_LIB} m)
493 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
496 # Check for the dlopen API (for dynamicly loading backend libs)
498 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
500 SET(EXTRA_LIBS dl ${EXTRA_LIBS})
501 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
504 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
507 # Check for a cpuid intrinsic
509 CHECK_C_SOURCE_COMPILES("#include <cpuid.h>
512 unsigned int eax, ebx, ecx, edx;
513 return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
514 }" HAVE_GCC_GET_CPUID)
517 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
523 }" HAVE_CPUID_INTRINSIC)
524 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
527 unsigned long idx = 0;
528 _BitScanForward64(&idx, 1);
530 }" HAVE_BITSCANFORWARD64_INTRINSIC)
531 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
534 unsigned long idx = 0;
535 _BitScanForward(&idx, 1);
537 }" HAVE_BITSCANFORWARD_INTRINSIC)
540 CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF)
541 CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
542 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
543 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
544 CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH)
547 CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
548 CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
551 CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
552 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
553 IF(NOT HAVE_STRCASECMP)
554 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
555 IF(NOT HAVE__STRICMP)
556 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
559 SET(CPP_DEFS ${CPP_DEFS} strcasecmp=_stricmp)
562 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
563 IF(NOT HAVE_STRNCASECMP)
564 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
565 IF(NOT HAVE__STRNICMP)
566 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
569 SET(CPP_DEFS ${CPP_DEFS} strncasecmp=_strnicmp)
573 # Check if we have Windows headers
574 SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
575 SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
576 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
577 SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
578 UNSET(OLD_REQUIRED_DEFINITIONS)
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
640 CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
641 IF(NOT HAVE_PTHREAD_SETNAME_NP)
642 CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
644 CHECK_C_SOURCE_COMPILES("
648 pthread_setname_np(\"testname\");
651 PTHREAD_SETNAME_NP_ONE_PARAM
653 CHECK_C_SOURCE_COMPILES("
657 pthread_setname_np(pthread_self(), \"%s\", \"testname\");
660 PTHREAD_SETNAME_NP_THREE_PARAMS
665 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
667 SET(EXTRA_LIBS rt ${EXTRA_LIBS})
671 CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_GETOPT)
673 # Check for a 64-bit type
674 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
675 IF(NOT HAVE_STDINT_H)
677 CHECK_C_SOURCE_COMPILES("#define _WIN32_WINNT 0x0502
680 int main() {return 0;}" HAVE___INT64)
683 IF(NOT SIZEOF_LONG MATCHES "8")
684 IF(NOT SIZEOF_LONG_LONG MATCHES "8")
685 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
705 OpenAL32/Include/alMain.h
706 OpenAL32/Include/alu.h
708 OpenAL32/Include/alAuxEffectSlot.h
709 OpenAL32/alAuxEffectSlot.cpp
710 OpenAL32/Include/alBuffer.h
711 OpenAL32/alBuffer.cpp
712 OpenAL32/Include/alEffect.h
713 OpenAL32/alEffect.cpp
714 OpenAL32/Include/alError.h
716 OpenAL32/alExtension.cpp
717 OpenAL32/Include/alFilter.h
718 OpenAL32/alFilter.cpp
719 OpenAL32/Include/alListener.h
720 OpenAL32/alListener.cpp
721 OpenAL32/Include/alSource.h
722 OpenAL32/alSource.cpp
725 OpenAL32/Include/sample_cvt.h
726 OpenAL32/sample_cvt.cpp
743 Alc/effects/autowah.cpp
744 Alc/effects/chorus.cpp
745 Alc/effects/compressor.cpp
746 Alc/effects/dedicated.cpp
747 Alc/effects/distortion.cpp
749 Alc/effects/equalizer.cpp
750 Alc/effects/fshifter.cpp
751 Alc/effects/modulator.cpp
753 Alc/effects/pshifter.cpp
754 Alc/effects/reverb.cpp
756 Alc/filters/filter.cpp
759 Alc/filters/splitter.cpp
760 Alc/filters/splitter.h
779 Alc/mixer/mixer_c.cpp
783 SET(CPU_EXTS "Default")
798 SET(HAVE_PORTAUDIO 0)
799 SET(HAVE_PULSEAUDIO 0)
800 SET(HAVE_COREAUDIO 0)
805 # Check for SSE support
806 OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
807 CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
809 OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
810 IF(ALSOFT_CPUEXT_SSE)
812 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse.cpp)
814 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse.cpp PROPERTIES
815 COMPILE_FLAGS "${SSE_SWITCH}")
817 SET(CPU_EXTS "${CPU_EXTS}, SSE")
820 IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
821 MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
824 OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
825 CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
827 OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
828 IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
830 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse2.cpp)
832 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse2.cpp PROPERTIES
833 COMPILE_FLAGS "${SSE2_SWITCH}")
835 SET(CPU_EXTS "${CPU_EXTS}, SSE2")
838 IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
839 MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
842 OPTION(ALSOFT_REQUIRE_SSE3 "Require SSE3 support" OFF)
843 CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}")
845 OPTION(ALSOFT_CPUEXT_SSE3 "Enable SSE3 support" ON)
846 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE3)
848 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse3.cpp)
850 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse3.cpp PROPERTIES
851 COMPILE_FLAGS "${SSE3_SWITCH}")
853 SET(CPU_EXTS "${CPU_EXTS}, SSE3")
856 IF(ALSOFT_REQUIRE_SSE3 AND NOT HAVE_SSE3)
857 MESSAGE(FATAL_ERROR "Failed to enable required SSE3 CPU extensions")
860 OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
861 CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
863 OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
864 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1)
866 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse41.cpp)
868 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse41.cpp PROPERTIES
869 COMPILE_FLAGS "${SSE4_1_SWITCH}")
871 SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
874 IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
875 MESSAGE(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
878 # Check for ARM Neon support
879 OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
880 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H ${FPU_NEON_SWITCH})
882 OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON)
883 IF(ALSOFT_CPUEXT_NEON)
885 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_neon.cpp)
887 SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_neon.cpp PROPERTIES
888 COMPILE_FLAGS "${FPU_NEON_SWITCH}")
890 SET(CPU_EXTS "${CPU_EXTS}, Neon")
893 IF(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
894 MESSAGE(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
898 IF(WIN32 OR HAVE_DLFCN_H)
900 MACRO(ADD_BACKEND_LIBS _LIBS)
903 SET(IS_LINKED " (linked)")
904 MACRO(ADD_BACKEND_LIBS _LIBS)
905 SET(EXTRA_LIBS ${_LIBS} ${EXTRA_LIBS})
910 SET(ALC_OBJS ${ALC_OBJS}
911 Alc/backends/base.cpp
913 # Default backends, always available
914 Alc/backends/loopback.cpp
915 Alc/backends/loopback.h
916 Alc/backends/null.cpp
921 OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
924 OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
925 IF(ALSOFT_BACKEND_ALSA)
927 SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
928 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.cpp Alc/backends/alsa.h)
929 ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
930 SET(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS})
933 IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
934 MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend")
938 OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
941 OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
942 IF(ALSOFT_BACKEND_OSS)
944 SET(BACKENDS "${BACKENDS} OSS,")
945 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.cpp Alc/backends/oss.h)
947 SET(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS})
949 SET(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS})
952 IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
953 MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend")
956 # Check Solaris backend
957 OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
958 FIND_PACKAGE(AudioIO)
960 OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
961 IF(ALSOFT_BACKEND_SOLARIS)
963 SET(BACKENDS "${BACKENDS} Solaris,")
964 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.cpp Alc/backends/solaris.h)
965 SET(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS})
968 IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
969 MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend")
972 # Check SndIO backend
973 OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
974 FIND_PACKAGE(SoundIO)
976 OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
977 IF(ALSOFT_BACKEND_SNDIO)
979 SET(BACKENDS "${BACKENDS} SndIO (linked),")
980 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.cpp Alc/backends/sndio.h)
981 SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
982 SET(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS})
985 IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
986 MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend")
990 OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF)
993 OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON)
994 IF(ALSOFT_BACKEND_QSA)
996 SET(BACKENDS "${BACKENDS} QSA (linked),")
997 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.cpp Alc/backends/qsa.h)
998 SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
999 SET(INC_PATHS ${INC_PATHS} ${QSA_INCLUDE_DIRS})
1002 IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA)
1003 MESSAGE(FATAL_ERROR "Failed to enabled required QSA backend")
1006 # Check Windows-only backends
1007 OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
1008 OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
1009 OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF)
1011 SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
1012 SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
1014 # Check MMSystem backend
1015 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
1017 CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
1019 OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
1020 IF(ALSOFT_BACKEND_WINMM)
1022 SET(BACKENDS "${BACKENDS} WinMM,")
1023 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.cpp Alc/backends/winmm.h)
1024 SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
1029 # Check DSound backend
1030 FIND_PACKAGE(DSound)
1032 OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
1033 IF(ALSOFT_BACKEND_DSOUND)
1035 SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
1036 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.cpp Alc/backends/dsound.h)
1037 ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
1038 SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS})
1042 # Check for WASAPI backend
1043 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
1044 IF(HAVE_MMDEVICEAPI_H)
1045 OPTION(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON)
1046 IF(ALSOFT_BACKEND_WASAPI)
1048 SET(BACKENDS "${BACKENDS} WASAPI,")
1049 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wasapi.cpp Alc/backends/wasapi.h)
1053 SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
1054 UNSET(OLD_REQUIRED_DEFINITIONS)
1056 IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
1057 MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")
1059 IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND)
1060 MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend")
1062 IF(ALSOFT_REQUIRE_WASAPI AND NOT HAVE_WASAPI)
1063 MESSAGE(FATAL_ERROR "Failed to enabled required WASAPI backend")
1066 # Check PortAudio backend
1067 OPTION(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
1068 FIND_PACKAGE(PortAudio)
1070 OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
1071 IF(ALSOFT_BACKEND_PORTAUDIO)
1072 SET(HAVE_PORTAUDIO 1)
1073 SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
1074 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.cpp Alc/backends/portaudio.h)
1075 ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
1076 SET(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS})
1079 IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
1080 MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend")
1083 # Check PulseAudio backend
1084 OPTION(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
1085 FIND_PACKAGE(PulseAudio)
1086 IF(PULSEAUDIO_FOUND)
1087 OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
1088 IF(ALSOFT_BACKEND_PULSEAUDIO)
1089 SET(HAVE_PULSEAUDIO 1)
1090 SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
1091 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.cpp Alc/backends/pulseaudio.h)
1092 ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
1093 SET(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS})
1096 IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
1097 MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend")
1100 # Check JACK backend
1101 OPTION(ALSOFT_REQUIRE_JACK "Require JACK backend" OFF)
1104 OPTION(ALSOFT_BACKEND_JACK "Enable JACK backend" ON)
1105 IF(ALSOFT_BACKEND_JACK)
1107 SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
1108 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.cpp Alc/backends/jack.h)
1109 ADD_BACKEND_LIBS(${JACK_LIBRARIES})
1110 SET(INC_PATHS ${INC_PATHS} ${JACK_INCLUDE_DIRS})
1113 IF(ALSOFT_REQUIRE_JACK AND NOT HAVE_JACK)
1114 MESSAGE(FATAL_ERROR "Failed to enabled required JACK backend")
1117 # Check CoreAudio backend
1118 OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
1119 FIND_LIBRARY(COREAUDIO_FRAMEWORK
1121 PATHS /System/Library/Frameworks
1123 IF(COREAUDIO_FRAMEWORK)
1124 OPTION(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
1125 IF(ALSOFT_BACKEND_COREAUDIO)
1126 SET(HAVE_COREAUDIO 1)
1127 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.cpp Alc/backends/coreaudio.h)
1128 SET(BACKENDS "${BACKENDS} CoreAudio,")
1129 SET(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${EXTRA_LIBS})
1130 SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
1131 SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
1133 # Some versions of OSX may need the AudioToolbox framework. Add it if
1135 FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
1137 PATHS ~/Library/Frameworks
1139 /System/Library/Frameworks
1141 IF(AUDIOTOOLBOX_LIBRARY)
1142 SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
1146 IF(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
1147 MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend")
1150 # Check for OpenSL (Android) backend
1151 OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
1152 CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
1153 IF(HAVE_SLES_OPENSLES_ANDROID_H)
1154 CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
1155 IF(HAVE_LIBOPENSLES)
1156 OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
1157 IF(ALSOFT_BACKEND_OPENSL)
1159 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.cpp Alc/backends/opensl.h)
1160 SET(BACKENDS "${BACKENDS} OpenSL,")
1161 SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
1165 IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
1166 MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
1169 # Check for SDL2 backend
1170 OPTION(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF)
1173 # Off by default, since it adds a runtime dependency
1174 OPTION(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF)
1175 IF(ALSOFT_BACKEND_SDL2)
1177 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sdl2.cpp Alc/backends/sdl2.h)
1178 SET(BACKENDS "${BACKENDS} SDL2,")
1179 SET(EXTRA_LIBS ${SDL2_LIBRARY} ${EXTRA_LIBS})
1180 SET(INC_PATHS ${INC_PATHS} ${SDL2_INCLUDE_DIR})
1183 IF(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND)
1184 MESSAGE(FATAL_ERROR "Failed to enabled required SDL2 backend")
1187 # Optionally enable the Wave Writer backend
1188 OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
1189 IF(ALSOFT_BACKEND_WAVE)
1191 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.cpp Alc/backends/wave.h)
1192 SET(BACKENDS "${BACKENDS} WaveFile,")
1195 # This is always available
1196 SET(BACKENDS "${BACKENDS} Null")
1200 IF(GIT_FOUND AND EXISTS "${OpenAL_SOURCE_DIR}/.git")
1201 # Get the current working branch and its latest abbreviated commit hash
1202 ADD_CUSTOM_TARGET(build_version
1203 ${CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE}
1204 -D LIB_VERSION=${LIB_VERSION}
1205 -D SRC=${OpenAL_SOURCE_DIR}/version.h.in
1206 -D DST=${OpenAL_BINARY_DIR}/version.h
1207 -P ${OpenAL_SOURCE_DIR}/version.cmake
1208 WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
1212 SET(GIT_BRANCH "UNKNOWN")
1213 SET(GIT_COMMIT_HASH "unknown")
1215 "${OpenAL_SOURCE_DIR}/version.h.in"
1216 "${OpenAL_BINARY_DIR}/version.h")
1219 SET(NATIVE_SRC_DIR "${OpenAL_SOURCE_DIR}/native-tools/")
1220 SET(NATIVE_BIN_DIR "${OpenAL_BINARY_DIR}/native-tools/")
1221 FILE(MAKE_DIRECTORY "${NATIVE_BIN_DIR}")
1223 SET(BIN2H_COMMAND "${NATIVE_BIN_DIR}bin2h")
1224 SET(BSINCGEN_COMMAND "${NATIVE_BIN_DIR}bsincgen")
1225 ADD_CUSTOM_COMMAND(OUTPUT "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1226 COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "${NATIVE_SRC_DIR}"
1227 COMMAND ${CMAKE_COMMAND} -E remove "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1228 COMMAND ${CMAKE_COMMAND} --build . --config "Release"
1229 WORKING_DIRECTORY "${NATIVE_BIN_DIR}"
1230 DEPENDS "${NATIVE_SRC_DIR}CMakeLists.txt"
1231 IMPLICIT_DEPENDS C "${NATIVE_SRC_DIR}bin2h.c"
1232 C "${NATIVE_SRC_DIR}bsincgen.c"
1235 ADD_CUSTOM_TARGET(native-tools
1236 DEPENDS "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
1240 option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" ON)
1241 if(ALSOFT_EMBED_HRTF_DATA)
1242 MACRO(make_hrtf_header FILENAME VARNAME)
1243 SET(infile "${OpenAL_SOURCE_DIR}/hrtf/${FILENAME}")
1244 SET(outfile "${OpenAL_BINARY_DIR}/${FILENAME}.h")
1246 ADD_CUSTOM_COMMAND(OUTPUT "${outfile}"
1247 COMMAND "${BIN2H_COMMAND}" "${infile}" "${outfile}" ${VARNAME}
1248 DEPENDS native-tools "${infile}"
1251 SET(ALC_OBJS ${ALC_OBJS} "${outfile}")
1254 make_hrtf_header(default-44100.mhr "hrtf_default_44100")
1255 make_hrtf_header(default-48000.mhr "hrtf_default_48000")
1258 ADD_CUSTOM_COMMAND(OUTPUT "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1259 COMMAND "${BSINCGEN_COMMAND}" "${OpenAL_BINARY_DIR}/bsinc_inc.h"
1260 DEPENDS native-tools "${NATIVE_SRC_DIR}bsincgen.c"
1263 SET(ALC_OBJS ${ALC_OBJS} "${OpenAL_BINARY_DIR}/bsinc_inc.h")
1266 IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL)
1267 add_subdirectory(utils/alsoft-config)
1274 FIND_PACKAGE(SDL_sound)
1275 FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE)
1280 SET(LIBNAME "openal")
1282 SET(LIBNAME "OpenAL32")
1285 # Needed for openal.pc.in
1286 SET(prefix ${CMAKE_INSTALL_PREFIX})
1287 SET(exec_prefix "\${prefix}")
1288 SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
1289 SET(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
1290 SET(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
1291 SET(PACKAGE_VERSION "${LIB_VERSION}")
1292 SET(PKG_CONFIG_CFLAGS )
1293 SET(PKG_CONFIG_PRIVATE_LIBS )
1294 IF(LIBTYPE STREQUAL "STATIC")
1295 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC)
1296 FOREACH(FLAG ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
1297 # If this is already a linker flag, or is a full path+file, add it
1298 # as-is. Otherwise, it's a name intended to be dressed as -lname.
1299 IF(FLAG MATCHES "^-.*" OR EXISTS "${FLAG}")
1300 SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} ${FLAG}")
1302 SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} -l${FLAG}")
1309 "${OpenAL_SOURCE_DIR}/config.h.in"
1310 "${OpenAL_BINARY_DIR}/config.h")
1312 "${OpenAL_SOURCE_DIR}/openal.pc.in"
1313 "${OpenAL_BINARY_DIR}/openal.pc"
1317 # Add a static library with common functions used by multiple targets
1318 ADD_LIBRARY(common STATIC ${COMMON_OBJS})
1319 TARGET_COMPILE_DEFINITIONS(common PRIVATE ${CPP_DEFS})
1320 TARGET_COMPILE_OPTIONS(common PRIVATE ${C_FLAGS})
1324 SET(IMPL_TARGET OpenAL)
1328 # Build main library
1329 IF(LIBTYPE STREQUAL "STATIC")
1330 SET(CPP_DEFS ${CPP_DEFS} AL_LIBTYPE_STATIC)
1331 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
1332 SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS)
1334 ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
1336 # Make sure to compile the common code with PIC, since it'll be linked into
1337 # shared libs that needs it.
1338 SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE)
1339 SET(COMMON_LIB common)
1343 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "/SUBSYSTEM:WINDOWS")
1344 ELSEIF(CMAKE_COMPILER_IS_GNUCC)
1345 SET(SUBSYS_FLAG ${SUBSYS_FLAG} "-mwindows")
1349 IF(WIN32 AND ALSOFT_BUILD_ROUTER)
1350 ADD_LIBRARY(OpenAL SHARED router/router.cpp router/router.h router/alc.cpp router/al.cpp)
1351 TARGET_COMPILE_DEFINITIONS(OpenAL
1352 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1353 TARGET_COMPILE_OPTIONS(OpenAL PRIVATE ${C_FLAGS})
1354 TARGET_LINK_LIBRARIES(OpenAL PRIVATE ${COMMON_LIB} ${LINKER_FLAGS})
1355 SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "")
1356 SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME})
1357 IF(TARGET build_version)
1358 ADD_DEPENDENCIES(OpenAL build_version)
1362 SET(LIBNAME "soft_oal")
1363 SET(IMPL_TARGET soft_oal)
1366 ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS})
1368 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "")
1371 SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME}
1372 VERSION ${LIB_VERSION}
1373 SOVERSION ${LIB_MAJOR_VERSION}
1375 TARGET_COMPILE_DEFINITIONS(${IMPL_TARGET}
1376 PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
1377 TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET}
1378 PRIVATE "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc" ${INC_PATHS})
1379 TARGET_COMPILE_OPTIONS(${IMPL_TARGET} PRIVATE ${C_FLAGS})
1380 TARGET_LINK_LIBRARIES(${IMPL_TARGET}
1381 PRIVATE ${COMMON_LIB} ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
1382 IF(TARGET build_version)
1383 ADD_DEPENDENCIES(${IMPL_TARGET} build_version)
1386 IF(WIN32 AND MINGW AND ALSOFT_BUILD_IMPORT_LIB AND NOT LIBTYPE STREQUAL "STATIC")
1387 FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable")
1388 FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable")
1389 IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE)
1391 IF(NOT SED_EXECUTABLE)
1392 MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation")
1394 IF(NOT DLLTOOL_EXECUTABLE)
1395 MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation")
1398 SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS
1399 " -Wl,--output-def,OpenAL32.def")
1400 ADD_CUSTOM_COMMAND(TARGET OpenAL POST_BUILD
1401 COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def
1402 COMMAND "${DLLTOOL_EXECUTABLE}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll
1403 COMMENT "Stripping ordinals from OpenAL32.def and generating OpenAL32.lib..."
1410 INSTALL(TARGETS OpenAL EXPORT OpenAL
1411 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1412 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1413 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1414 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL
1416 EXPORT(TARGETS OpenAL
1418 FILE OpenALConfig.cmake)
1419 INSTALL(EXPORT OpenAL
1420 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL
1422 FILE OpenALConfig.cmake)
1423 INSTALL(FILES include/AL/al.h
1427 include/AL/efx-creative.h
1428 include/AL/efx-presets.h
1429 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/AL
1431 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
1432 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
1434 INSTALL(TARGETS soft_oal
1435 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1443 message(STATUS "Building DLL router")
1447 MESSAGE(STATUS "Building OpenAL with support for the following backends:")
1448 MESSAGE(STATUS " ${BACKENDS}")
1450 MESSAGE(STATUS "Building with support for CPU extensions:")
1451 MESSAGE(STATUS " ${CPU_EXTS}")
1454 MESSAGE(STATUS "Building with SSE${FPMATH_SET} codegen")
1460 MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
1461 MESSAGE(STATUS " This is probably NOT what you want!")
1466 if(ALSOFT_EMBED_HRTF_DATA)
1467 message(STATUS "Embedding HRTF datasets")
1471 # Install alsoft.conf configuration file
1473 INSTALL(FILES alsoftrc.sample
1474 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal
1476 MESSAGE(STATUS "Installing sample configuration")
1480 # Install HRTF definitions
1481 IF(ALSOFT_HRTF_DEFS)
1482 INSTALL(FILES hrtf/default-44100.mhr
1483 hrtf/default-48000.mhr
1484 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/hrtf
1486 MESSAGE(STATUS "Installing HRTF definitions")
1490 # Install AmbDec presets
1491 IF(ALSOFT_AMBDEC_PRESETS)
1492 INSTALL(FILES presets/3D7.1.ambdec
1493 presets/hexagon.ambdec
1494 presets/itu5.1.ambdec
1495 presets/itu5.1-nocenter.ambdec
1496 presets/rectangle.ambdec
1497 presets/square.ambdec
1499 DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/presets
1501 MESSAGE(STATUS "Installing AmbDec presets")
1506 ADD_EXECUTABLE(openal-info utils/openal-info.c)
1507 TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS})
1508 TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL)
1510 SET(MAKEHRTF_SRCS utils/makehrtf.c)
1512 SET(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c utils/getopt.h)
1514 ADD_EXECUTABLE(makehrtf ${MAKEHRTF_SRCS})
1515 TARGET_COMPILE_DEFINITIONS(makehrtf PRIVATE ${CPP_DEFS})
1516 TARGET_COMPILE_OPTIONS(makehrtf PRIVATE ${C_FLAGS})
1518 TARGET_LINK_LIBRARIES(makehrtf PRIVATE ${LINKER_FLAGS} m)
1522 INSTALL(TARGETS openal-info makehrtf
1523 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1524 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1525 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1529 MESSAGE(STATUS "Building utility programs")
1530 IF(TARGET alsoft-config)
1531 MESSAGE(STATUS "Building configuration program")
1537 SET(TEST_COMMON_OBJS examples/common/alhelpers.c)
1539 ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS})
1540 TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS})
1541 TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS})
1542 TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB})
1545 INSTALL(TARGETS altonegen
1546 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1547 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1548 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1552 MESSAGE(STATUS "Building test programs")
1557 # Add a static library with common functions used by multiple targets
1558 ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c)
1559 TARGET_COMPILE_DEFINITIONS(ex-common PRIVATE ${CPP_DEFS})
1560 TARGET_COMPILE_OPTIONS(ex-common PRIVATE ${C_FLAGS})
1562 ADD_EXECUTABLE(alrecord examples/alrecord.c)
1563 TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS})
1564 TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS})
1565 TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} ex-common common OpenAL)
1568 INSTALL(TARGETS alrecord
1569 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1570 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1571 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1575 MESSAGE(STATUS "Building example programs")
1579 ADD_EXECUTABLE(alplay examples/alplay.c)
1580 TARGET_COMPILE_DEFINITIONS(alplay PRIVATE ${CPP_DEFS})
1581 TARGET_INCLUDE_DIRECTORIES(alplay
1582 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1583 TARGET_COMPILE_OPTIONS(alplay PRIVATE ${C_FLAGS})
1584 TARGET_LINK_LIBRARIES(alplay
1585 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1588 ADD_EXECUTABLE(alstream examples/alstream.c)
1589 TARGET_COMPILE_DEFINITIONS(alstream PRIVATE ${CPP_DEFS})
1590 TARGET_INCLUDE_DIRECTORIES(alstream
1591 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1592 TARGET_COMPILE_OPTIONS(alstream PRIVATE ${C_FLAGS})
1593 TARGET_LINK_LIBRARIES(alstream
1594 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1597 ADD_EXECUTABLE(alreverb examples/alreverb.c)
1598 TARGET_COMPILE_DEFINITIONS(alreverb PRIVATE ${CPP_DEFS})
1599 TARGET_INCLUDE_DIRECTORIES(alreverb
1600 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1601 TARGET_COMPILE_OPTIONS(alreverb PRIVATE ${C_FLAGS})
1602 TARGET_LINK_LIBRARIES(alreverb
1603 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1606 ADD_EXECUTABLE(almultireverb examples/almultireverb.c)
1607 TARGET_COMPILE_DEFINITIONS(almultireverb PRIVATE ${CPP_DEFS})
1608 TARGET_INCLUDE_DIRECTORIES(almultireverb
1609 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1610 TARGET_COMPILE_OPTIONS(almultireverb PRIVATE ${C_FLAGS})
1611 TARGET_LINK_LIBRARIES(almultireverb
1612 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1615 ADD_EXECUTABLE(allatency examples/allatency.c)
1616 TARGET_COMPILE_DEFINITIONS(allatency PRIVATE ${CPP_DEFS})
1617 TARGET_INCLUDE_DIRECTORIES(allatency
1618 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1619 TARGET_COMPILE_OPTIONS(allatency PRIVATE ${C_FLAGS})
1620 TARGET_LINK_LIBRARIES(allatency
1621 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1624 ADD_EXECUTABLE(alloopback examples/alloopback.c)
1625 TARGET_COMPILE_DEFINITIONS(alloopback PRIVATE ${CPP_DEFS})
1626 TARGET_INCLUDE_DIRECTORIES(alloopback
1627 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1628 TARGET_COMPILE_OPTIONS(alloopback PRIVATE ${C_FLAGS})
1629 TARGET_LINK_LIBRARIES(alloopback
1630 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1633 ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
1634 TARGET_COMPILE_DEFINITIONS(alhrtf PRIVATE ${CPP_DEFS})
1635 TARGET_INCLUDE_DIRECTORIES(alhrtf
1636 PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
1637 TARGET_COMPILE_OPTIONS(alhrtf PRIVATE ${C_FLAGS})
1638 TARGET_LINK_LIBRARIES(alhrtf
1639 PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
1643 INSTALL(TARGETS alplay alstream alreverb almultireverb allatency alloopback alhrtf
1644 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1645 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1646 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1650 MESSAGE(STATUS "Building SDL_sound example programs")
1656 IF(AVFORMAT_VERSION VERSION_LESS "57.56.101")
1657 MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 57.56.101)")
1660 IF(AVCODEC_VERSION VERSION_LESS "57.64.101")
1661 MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 57.64.101)")
1664 IF(AVUTIL_VERSION VERSION_LESS "55.34.101")
1665 MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 55.34.101)")
1668 IF(SWSCALE_VERSION VERSION_LESS "4.2.100")
1669 MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 4.2.100)")
1672 IF(SWRESAMPLE_VERSION VERSION_LESS "2.3.100")
1673 MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 2.3.100)")
1678 ADD_EXECUTABLE(alffplay examples/alffplay.cpp)
1679 TARGET_COMPILE_DEFINITIONS(alffplay PRIVATE ${CPP_DEFS})
1680 TARGET_INCLUDE_DIRECTORIES(alffplay
1681 PRIVATE ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
1682 TARGET_COMPILE_OPTIONS(alffplay PRIVATE ${C_FLAGS})
1683 TARGET_LINK_LIBRARIES(alffplay
1684 PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} ex-common common
1688 INSTALL(TARGETS alffplay
1689 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1690 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1691 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1694 MESSAGE(STATUS "Building SDL+FFmpeg example programs")