1 # CMake build file list for OpenAL
3 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
7 IF(COMMAND CMAKE_POLICY)
8 CMAKE_POLICY(SET CMP0003 NEW)
9 CMAKE_POLICY(SET CMP0005 NEW)
10 ENDIF(COMMAND CMAKE_POLICY)
12 SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
14 INCLUDE(CheckFunctionExists)
15 INCLUDE(CheckLibraryExists)
16 INCLUDE(CheckSharedFunctionExists)
17 INCLUDE(CheckIncludeFile)
18 INCLUDE(CheckIncludeFiles)
19 INCLUDE(CheckSymbolExists)
20 INCLUDE(CheckCCompilerFlag)
21 INCLUDE(CheckCSourceCompiles)
22 INCLUDE(CheckTypeSize)
25 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
29 # This option is mainly for static linking OpenAL Soft into another project
30 # that already defines the IDs. It is up to that project to ensure all
31 # required IDs are defined.
32 OPTION(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF)
34 # These are needed on non-Windows systems for extra features
35 ADD_DEFINITIONS(-D_GNU_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700)
36 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_GNU_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700")
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)
49 OPTION(ALSOFT_CONFIG "Install alsoft.conf sample configuration file" ON)
50 OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" ON)
55 ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502")
60 # QNX's gcc do not uses /usr/include and /usr/lib pathes by default
61 IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
62 ADD_DEFINITIONS("-I/usr/include")
63 SET(EXTRA_LIBS ${EXTRA_LIBS} -L/usr/lib)
70 SET(LIB_MAJOR_VERSION "1")
71 SET(LIB_MINOR_VERSION "15")
73 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
79 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
80 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
83 CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
85 SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
88 # MSVC may need workarounds for C99 restrict and inline
90 # TODO: Once we truly require C99, these restrict and inline checks should go
92 CHECK_C_SOURCE_COMPILES("int *restrict foo;
93 int main() {return 0;}" HAVE_RESTRICT)
95 ADD_DEFINITIONS("-Drestrict=")
96 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Drestrict=")
99 CHECK_C_SOURCE_COMPILES("inline void foo(void) { }
100 int main() {return 0;}" HAVE_INLINE)
102 CHECK_C_SOURCE_COMPILES("__inline void foo(void) { }
103 int main() {return 0;}" HAVE___INLINE)
104 IF(NOT HAVE___INLINE)
105 MESSAGE(FATAL_ERROR "No inline keyword found, please report!")
108 ADD_DEFINITIONS(-Dinline=__inline)
109 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Dinline=__inline")
113 # Make sure we have C99-style inline semantics with GCC (4.3 or newer).
114 IF(CMAKE_COMPILER_IS_GNUCC)
115 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
116 # Force no inlining for the next test.
117 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -fno-inline")
119 CHECK_C_SOURCE_COMPILES("extern inline int foo() { return 0; }
120 int main() {return foo();}" INLINE_IS_C99)
121 IF(NOT INLINE_IS_C99)
122 MESSAGE(FATAL_ERROR "Your compiler does not seem to have C99 inline semantics!
123 Please update your compiler for better C99 compliance.")
126 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
129 # Check if we have C99 variable length arrays
130 CHECK_C_SOURCE_COMPILES(
131 "int main(int argc, char *argv[])
133 volatile int tmp[argc];
139 # Check if we have C99 bool
140 CHECK_C_SOURCE_COMPILES(
141 "int main(int argc, char *argv[])
144 ret = (argc > 1) ? 1 : 0;
149 # Check if we have C11 static_assert
150 CHECK_C_SOURCE_COMPILES(
153 _Static_assert(sizeof(int) == sizeof(int), \"What\");
156 HAVE_C11_STATIC_ASSERT)
158 # Check if we have C11 alignas
159 CHECK_C_SOURCE_COMPILES(
160 "_Alignas(16) int foo;
167 # Add definitions, compiler switches, etc.
168 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_BINARY_DIR}")
169 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
170 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc")
171 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
172 ADD_DEFINITIONS("-DAL_NO_UID_DEFS")
176 IF(NOT CMAKE_BUILD_TYPE)
177 SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
178 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
181 IF(NOT CMAKE_DEBUG_POSTFIX)
182 SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
183 "Library postfix for debug builds. Normally left blank."
189 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_DEBUG")
190 SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG")
191 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
192 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
193 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
194 ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
195 ADD_DEFINITIONS("/wd4098")
198 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
200 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
203 MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
204 SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${DXSDK_DIR}/Include")
205 INCLUDE_DIRECTORIES("${DXSDK_DIR}/Include")
206 LINK_DIRECTORIES("${DXSDK_DIR}/Lib")
209 OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
210 IF(FORCE_STATIC_VCRT)
212 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
213 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
214 IF(${flag_var} MATCHES "/MD")
215 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
220 ADD_DEFINITIONS(-Winline -Wall)
221 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
223 ADD_DEFINITIONS(-Wextra)
227 ADD_DEFINITIONS(-Werror)
230 # Force enable PIC if available. The static common library will be linked
231 # into the dynamic openal library, which requires all its code to be
232 # position-independent, and CMake doesn't automatically enable PIC for
233 # static library targets (Windows code is always position-independent).
234 CHECK_C_COMPILER_FLAG(-fPIC HAVE_FPIC_SWITCH)
235 IF(HAVE_FPIC_SWITCH AND NOT WIN32)
236 ADD_DEFINITIONS(-fPIC)
239 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -D_DEBUG" CACHE STRING
240 "Flags used by the compiler during Release with Debug Info builds."
242 SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING
243 "Flags used by the compiler during release minsize builds."
245 SET(CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -DNDEBUG" CACHE STRING
246 "Flags used by the compiler during release builds"
248 SET(CMAKE_C_FLAGS_DEBUG "-g3 -D_DEBUG" CACHE STRING
249 "Flags used by the compiler during debug builds."
252 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
253 int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
256 # Set visibility/export options if available
258 SET(EXPORT_DECL "__declspec(dllexport)")
260 SET(ALIGN_DECL "__declspec(align(x))")
262 SET(ALIGN_DECL "__declspec(aligned(x))")
265 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
266 # Yes GCC, really don't accept visibility modes you don't support
267 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
269 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
270 int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
271 IF(HAVE_GCC_PROTECTED_VISIBILITY)
272 SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
274 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
275 int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
276 IF(HAVE_GCC_DEFAULT_VISIBILITY)
277 SET(EXPORT_DECL "__attribute__((visibility(\"default\")))")
281 IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
282 CHECK_C_COMPILER_FLAG(-fvisibility=internal HAVE_VISIBILITY_INTERNAL_SWITCH)
283 IF(HAVE_VISIBILITY_INTERNAL_SWITCH)
284 ADD_DEFINITIONS(-fvisibility=internal)
286 CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
287 IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
288 ADD_DEFINITIONS(-fvisibility=hidden)
293 CHECK_C_SOURCE_COMPILES("int foo __attribute__((aligned(16)));
294 int main() {return 0;}" HAVE_ATTRIBUTE_ALIGNED)
295 IF(HAVE_ATTRIBUTE_ALIGNED)
296 SET(ALIGN_DECL "__attribute__((aligned(x)))")
299 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
304 SET(SSE4_1_SWITCH "")
306 CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
308 SET(SSE_SWITCH "-msse")
310 CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
311 IF(HAVE_MSSE2_SWITCH)
312 SET(SSE2_SWITCH "-msse2")
314 CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH)
315 IF(HAVE_MSSE4_1_SWITCH)
316 SET(SSE4_1_SWITCH "-msse4.1")
320 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
321 int main() {return 0;}" HAVE_GCC_FORMAT)
323 CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
324 CHECK_INCLUDE_FILE(stdalign.h HAVE_STDALIGN_H)
325 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
326 CHECK_INCLUDE_FILE(ftw.h HAVE_FTW_H)
327 CHECK_INCLUDE_FILE(io.h HAVE_IO_H)
328 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
329 CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
330 CHECK_INCLUDE_FILE(sys/sysconf.h HAVE_SYS_SYSCONF_H)
331 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
332 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
333 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
334 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
335 IF(NOT HAVE_GUIDDEF_H)
336 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
339 # Some systems need libm for some of the following math functions to work
340 CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
342 SET(EXTRA_LIBS m ${EXTRA_LIBS})
343 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
347 CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
348 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
349 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
350 CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
352 CHECK_SYMBOL_EXISTS(alloca malloc.h HAVE_ALLOCA)
354 MESSAGE(FATAL_ERROR "No alloca function found, please report!")
359 CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
360 CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
363 CHECK_SYMBOL_EXISTS(ftw ftw.h HAVE_FTW)
366 CHECK_SYMBOL_EXISTS(_wfindfirst io.h HAVE__WFINDFIRST)
369 CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
370 CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
371 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
372 IF(NOT HAVE_STRCASECMP)
373 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
374 IF(NOT HAVE__STRICMP)
375 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
378 ADD_DEFINITIONS(-Dstrcasecmp=_stricmp)
381 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
382 IF(NOT HAVE_STRNCASECMP)
383 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
384 IF(NOT HAVE__STRNICMP)
385 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
388 ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp)
391 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
392 IF(NOT HAVE_SNPRINTF)
393 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
394 IF(NOT HAVE__SNPRINTF)
395 MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
398 ADD_DEFINITIONS(-Dsnprintf=_snprintf)
401 CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
402 IF(NOT HAVE_ISFINITE)
403 CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
405 CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE)
407 MESSAGE(FATAL_ERROR "No isfinite function found, please report!")
409 ADD_DEFINITIONS(-Disfinite=_finite)
411 ADD_DEFINITIONS(-Disfinite=finite)
415 CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
417 CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN)
419 MESSAGE(FATAL_ERROR "No isnan function found, please report!")
422 ADD_DEFINITIONS(-Disnan=_isnan)
426 # Check for the dlopen API (for dynamicly loading backend libs)
428 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
430 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
432 SET(EXTRA_LIBS dl ${EXTRA_LIBS})
437 # Check if we have Windows headers
438 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502)
439 IF(NOT HAVE_WINDOWS_H)
440 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
441 IF(NOT HAVE_GETTIMEOFDAY)
442 MESSAGE(FATAL_ERROR "No timing function found!")
445 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
446 IF(NOT HAVE_NANOSLEEP)
447 MESSAGE(FATAL_ERROR "No sleep function found!")
450 # We need pthreads outside of Windows
451 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
452 IF(NOT HAVE_PTHREAD_H)
453 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
455 # Some systems need pthread_np.h to get recursive mutexes
456 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
458 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
460 ADD_DEFINITIONS(-pthread)
461 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
462 SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread)
465 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
467 SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
470 CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
472 CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
473 IF(NOT HAVE_PTHREAD_SETNAME_NP)
474 CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
476 IF(HAVE_PTHREAD_NP_H)
477 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
480 CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK)
482 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
484 SET(EXTRA_LIBS rt ${EXTRA_LIBS})
488 # Check for a 64-bit type
489 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
490 IF(NOT HAVE_STDINT_H)
492 CHECK_C_SOURCE_COMPILES("#define _WIN32_WINNT 0x0502
495 int main() {return 0;}" HAVE___INT64)
498 IF(NOT SIZEOF_LONG MATCHES "8")
499 IF(NOT SIZEOF_LONG_LONG MATCHES "8")
500 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
507 SET(COMMON_OBJS common/atomic.c
512 SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c
516 OpenAL32/alExtension.c
518 OpenAL32/alFontsound.c
519 OpenAL32/alListener.c
522 OpenAL32/alSoundfont.c
526 OpenAL32/sample_cvt.c
528 SET(ALC_OBJS Alc/ALc.c
533 Alc/effects/autowah.c
535 Alc/effects/compressor.c
536 Alc/effects/dedicated.c
537 Alc/effects/distortion.c
539 Alc/effects/equalizer.c
540 Alc/effects/flanger.c
541 Alc/effects/modulator.c
552 SET(CPU_EXTS "Default")
558 # Check for SSE support
559 OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
560 CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
562 OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
563 IF(ALSOFT_CPUEXT_SSE)
564 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
566 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse.c)
568 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse.c PROPERTIES
569 COMPILE_FLAGS "${SSE_SWITCH}")
571 SET(CPU_EXTS "${CPU_EXTS}, SSE")
575 IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
576 MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
579 OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
580 CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
582 OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
583 IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
584 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
586 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse2.c)
588 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse2.c PROPERTIES
589 COMPILE_FLAGS "${SSE2_SWITCH}")
591 SET(CPU_EXTS "${CPU_EXTS}, SSE2")
595 IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
596 MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
599 OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
600 CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
602 OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
603 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1)
604 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
606 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse41.c)
608 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse41.c PROPERTIES
609 COMPILE_FLAGS "${SSE4_1_SWITCH}")
611 SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
615 IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
616 MESSAGE(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
619 # Check for ARM Neon support
620 OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
621 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H)
623 OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON)
624 IF(ALSOFT_CPUEXT_NEON)
626 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_neon.c)
627 SET(CPU_EXTS "${CPU_EXTS}, Neon")
630 IF(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
631 MESSAGE(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
635 SET(ALC_OBJS ${ALC_OBJS}
639 Alc/midi/fluidsynth.c
643 SET(HAVE_FLUIDSYNTH 0)
645 # Check for FluidSynth support
646 OPTION(ALSOFT_REQUIRE_FLUIDSYNTH "Require FluidSynth MIDI" OFF)
647 FIND_PACKAGE(FluidSynth)
649 OPTION(ALSOFT_MIDI_FLUIDSYNTH "Enable FluidSynth MIDI" ON)
650 IF(ALSOFT_MIDI_FLUIDSYNTH)
651 SET(HAVE_FLUIDSYNTH 1)
652 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
653 INCLUDE_DIRECTORIES(${FLUIDSYNTH_INCLUDE_DIR})
655 SET(EXTRA_LIBS ${FLUIDSYNTH_LIBRARIES} ${EXTRA_LIBS})
658 IF(ALSOFT_REQUIRE_FLUIDSYNTH AND NOT HAVE_FLUIDSYNTH)
659 MESSAGE(FATAL_ERROR "Failed to enabled required FluidSynth support")
663 SET(ALC_OBJS ${ALC_OBJS}
665 # Default backends, always available
666 Alc/backends/loopback.c
679 SET(HAVE_PORTAUDIO 0)
680 SET(HAVE_PULSEAUDIO 0)
681 SET(HAVE_COREAUDIO 0)
684 IF(WIN32 OR HAVE_DLFCN_H)
686 MACRO(ADD_BACKEND_LIBS _LIBS)
689 SET(IS_LINKED " (linked)")
690 MACRO(ADD_BACKEND_LIBS _LIBS)
691 SET(EXTRA_LIBS ${_LIBS} ${EXTRA_LIBS})
696 OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
699 OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
700 IF(ALSOFT_BACKEND_ALSA)
702 SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
703 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c)
704 ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
705 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
706 INCLUDE_DIRECTORIES(${ALSA_INCLUDE_DIRS})
710 IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
711 MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend")
715 OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
718 OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
719 IF(ALSOFT_BACKEND_OSS)
721 SET(BACKENDS "${BACKENDS} OSS,")
722 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
723 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
724 INCLUDE_DIRECTORIES(${OSS_INCLUDE_DIRS})
728 IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
729 MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend")
732 # Check Solaris backend
733 OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
734 FIND_PACKAGE(AudioIO)
736 OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
737 IF(ALSOFT_BACKEND_SOLARIS)
739 SET(BACKENDS "${BACKENDS} Solaris,")
740 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
741 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
742 INCLUDE_DIRECTORIES(${AUDIOIO_INCLUDE_DIRS})
746 IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
747 MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend")
750 # Check SndIO backend
751 OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
752 FIND_PACKAGE(SoundIO)
754 OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
755 IF(ALSOFT_BACKEND_SNDIO)
757 SET(BACKENDS "${BACKENDS} SndIO (linked),")
758 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c)
759 SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
760 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
761 INCLUDE_DIRECTORIES(${SOUNDIO_INCLUDE_DIRS})
765 IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
766 MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend")
770 OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF)
773 OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON)
774 IF(ALSOFT_BACKEND_QSA)
776 SET(BACKENDS "${BACKENDS} QSA (linked),")
777 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c)
778 SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
779 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
780 INCLUDE_DIRECTORIES(${QSA_INCLUDE_DIRS})
784 IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA)
785 MESSAGE(FATAL_ERROR "Failed to enabled required QSA backend")
788 # Check DSound backend
789 OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
792 OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
793 IF(ALSOFT_BACKEND_DSOUND)
795 SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
796 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c)
797 ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
798 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
799 INCLUDE_DIRECTORIES(${DSOUND_INCLUDE_DIRS})
803 IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND)
804 MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend")
807 # Check for MMDevApi backend
808 OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF)
810 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
811 IF(HAVE_MMDEVICEAPI_H)
812 OPTION(ALSOFT_BACKEND_MMDEVAPI "Enable MMDevApi backend" ON)
813 IF(ALSOFT_BACKEND_MMDEVAPI)
815 SET(BACKENDS "${BACKENDS} MMDevApi,")
816 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c)
820 IF(ALSOFT_REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI)
821 MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend")
824 # Check MMSystem backend
825 OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
827 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
829 CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
831 OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
832 IF(ALSOFT_BACKEND_WINMM)
834 SET(BACKENDS "${BACKENDS} WinMM,")
835 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
836 SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
841 IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
842 MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")
845 # Check PortAudio backend
846 OPTION(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
847 FIND_PACKAGE(PortAudio)
849 OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
850 IF(ALSOFT_BACKEND_PORTAUDIO)
851 SET(HAVE_PORTAUDIO 1)
852 SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
853 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c)
854 ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
855 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
856 INCLUDE_DIRECTORIES(${PORTAUDIO_INCLUDE_DIRS})
860 IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
861 MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend")
864 # Check PulseAudio backend
865 OPTION(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
866 FIND_PACKAGE(PulseAudio)
868 OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
869 IF(ALSOFT_BACKEND_PULSEAUDIO)
870 SET(HAVE_PULSEAUDIO 1)
871 SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
872 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c)
873 ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
874 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
875 INCLUDE_DIRECTORIES(${PULSEAUDIO_INCLUDE_DIRS})
879 IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
880 MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend")
883 # Check CoreAudio backend
884 OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
885 FIND_LIBRARY(COREAUDIO_FRAMEWORK
887 PATHS /System/Library/Frameworks
889 IF(COREAUDIO_FRAMEWORK)
890 OPTION(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
891 IF(ALSOFT_BACKEND_COREAUDIO)
892 SET(HAVE_COREAUDIO 1)
893 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c)
894 SET(BACKENDS "${BACKENDS} CoreAudio,")
895 SET(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${EXTRA_LIBS})
896 SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
897 SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
899 # Some versions of OSX may need the AudioToolbox framework. Add it if
901 FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
903 PATHS ~/Library/Frameworks
905 /System/Library/Frameworks
907 IF(AUDIOTOOLBOX_LIBRARY)
908 SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
912 IF(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
913 MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend")
916 # Check for OpenSL (Android) backend
917 OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
918 CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
919 IF(HAVE_SLES_OPENSLES_ANDROID_H)
920 CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
922 OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
923 IF(ALSOFT_BACKEND_OPENSL)
925 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c)
926 SET(BACKENDS "${BACKENDS} OpenSL,")
927 SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
931 IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
932 MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
935 # Optionally enable the Wave Writer backend
936 OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
937 IF(ALSOFT_BACKEND_WAVE)
939 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c)
940 SET(BACKENDS "${BACKENDS} WaveFile,")
943 # This is always available
944 SET(BACKENDS "${BACKENDS} Null")
946 IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL)
947 add_subdirectory(utils/alsoft-config)
952 FIND_PACKAGE(SDL_sound)
953 IF(SDL_SOUND_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8")
954 INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
956 FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE)
957 IF(FFMPEG_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8")
958 INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIRS})
963 IF(LIBTYPE STREQUAL "STATIC")
964 ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC)
965 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS})
968 # Needed for openal.pc.in
969 SET(prefix ${CMAKE_INSTALL_PREFIX})
970 SET(exec_prefix "\${prefix}")
971 SET(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
972 SET(bindir "\${exec_prefix}/bin")
973 SET(includedir "\${prefix}/include")
974 SET(PACKAGE_VERSION "${LIB_VERSION}")
978 "${OpenAL_SOURCE_DIR}/config.h.in"
979 "${OpenAL_BINARY_DIR}/config.h")
981 "${OpenAL_SOURCE_DIR}/openal.pc.in"
982 "${OpenAL_BINARY_DIR}/openal.pc"
985 # Build a common library with reusable helpers
986 ADD_LIBRARY(common STATIC ${COMMON_OBJS})
989 ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS})
990 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES)
991 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
992 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS)
994 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc")
996 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${FLUIDSYNTH_INCLUDE_DIR})
999 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS})
1002 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${OSS_INCLUDE_DIRS})
1005 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${AUDIOIO_INCLUDE_DIRS})
1008 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${SOUNDIO_INCLUDE_DIRS})
1011 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${QSA_INCLUDE_DIRS})
1014 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIRS})
1017 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PORTAUDIO_INCLUDE_DIRS})
1020 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS})
1022 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION}
1023 SOVERSION ${LIB_MAJOR_VERSION})
1024 IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC")
1025 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
1028 TARGET_LINK_LIBRARIES(${LIBNAME} common ${EXTRA_LIBS})
1030 # Add an install target here
1031 INSTALL(TARGETS ${LIBNAME}
1032 RUNTIME DESTINATION bin
1033 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1034 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1036 INSTALL(FILES include/AL/al.h
1040 include/AL/efx-creative.h
1041 include/AL/efx-presets.h
1042 DESTINATION include/AL
1044 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
1045 DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
1049 MESSAGE(STATUS "Building OpenAL with support for the following backends:")
1050 MESSAGE(STATUS " ${BACKENDS}")
1052 MESSAGE(STATUS "Building with support for CPU extensions:")
1053 MESSAGE(STATUS " ${CPU_EXTS}")
1056 MESSAGE(STATUS "FluidSynth support for ALC_SOFT_midi_interface enabled")
1062 MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
1063 MESSAGE(STATUS " This is probably NOT what you want!")
1068 # Install alsoft.conf configuration file
1070 INSTALL(FILES alsoftrc.sample
1071 DESTINATION share/openal
1073 MESSAGE(STATUS "Installing sample configuration")
1077 # Install HRTF definitions
1078 IF(ALSOFT_HRTF_DEFS)
1079 INSTALL(FILES hrtf/default-44100.mhr
1080 DESTINATION share/openal/hrtf
1082 MESSAGE(STATUS "Installing HRTF definitions")
1087 ADD_EXECUTABLE(openal-info utils/openal-info.c)
1088 TARGET_LINK_LIBRARIES(openal-info ${LIBNAME})
1090 ADD_EXECUTABLE(makehrtf utils/makehrtf.c)
1092 TARGET_LINK_LIBRARIES(makehrtf m)
1095 INSTALL(TARGETS openal-info makehrtf
1096 RUNTIME DESTINATION bin
1097 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1098 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1101 MESSAGE(STATUS "Building utility programs")
1102 IF(TARGET alsoft-config)
1103 MESSAGE(STATUS "Building configuration program")
1109 IF(SDL2_FOUND AND SDL_SOUND_FOUND)
1110 ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c
1111 examples/common/sdl_sound.c)
1112 SET_PROPERTY(TARGET ex-common APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1113 ${SDL_SOUND_INCLUDE_DIR})
1115 ADD_EXECUTABLE(alstream examples/alstream.c)
1116 TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1117 SET_PROPERTY(TARGET alstream APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1118 ${SDL_SOUND_INCLUDE_DIR})
1120 ADD_EXECUTABLE(alreverb examples/alreverb.c)
1121 TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1122 SET_PROPERTY(TARGET alreverb APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1123 ${SDL_SOUND_INCLUDE_DIR})
1125 ADD_EXECUTABLE(allatency examples/allatency.c)
1126 TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1127 SET_PROPERTY(TARGET allatency APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1128 ${SDL_SOUND_INCLUDE_DIR})
1130 ADD_EXECUTABLE(alloopback examples/alloopback.c)
1131 TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1132 SET_PROPERTY(TARGET alloopback APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1133 ${SDL_SOUND_INCLUDE_DIR})
1135 INSTALL(TARGETS alstream alreverb allatency alloopback
1136 RUNTIME DESTINATION bin
1137 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1138 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1144 IF(AVFORMAT_VERSION VERSION_LESS "55.33.100")
1145 MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 55.33.100)")
1148 IF(AVCODEC_VERSION VERSION_LESS "55.52.102")
1149 MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 55.52.102)")
1152 IF(AVUTIL_VERSION VERSION_LESS "52.66.100")
1153 MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 52.66.100)")
1156 IF(SWSCALE_VERSION VERSION_LESS "2.5.102")
1157 MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 2.5.102)")
1160 IF(SWRESAMPLE_VERSION VERSION_LESS "0.18.100")
1161 MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 0.18.100)")
1165 IF(FFVER_OK AND NOT MSVC)
1166 ADD_EXECUTABLE(alffplay examples/alffplay.c)
1167 TARGET_LINK_LIBRARIES(alffplay common ex-common ${SDL2_LIBRARY} ${LIBNAME} ${FFMPEG_LIBRARIES})
1168 SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1169 ${FFMPEG_INCLUDE_DIRS})
1171 INSTALL(TARGETS alffplay
1172 RUNTIME DESTINATION bin
1173 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1174 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1176 MESSAGE(STATUS "Building SDL and FFmpeg example programs")
1178 MESSAGE(STATUS "Building SDL example programs")