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)
23 include(CheckFileOffsetBits)
26 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
30 # This option is mainly for static linking OpenAL Soft into another project
31 # that already defines the IDs. It is up to that project to ensure all
32 # required IDs are defined.
33 OPTION(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF)
35 # These are needed on non-Windows systems for extra features
36 ADD_DEFINITIONS(-D_GNU_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700)
37 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_GNU_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700")
40 # Set defines for large file support
41 CHECK_FILE_OFFSET_BITS()
43 ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
44 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
46 ADD_DEFINITIONS(-D_LARGEFILE_SOURCE -D_LARGE_FILES)
47 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES")
50 OPTION(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON)
52 OPTION(ALSOFT_WERROR "Treat compile warnings as errors" OFF)
54 OPTION(ALSOFT_UTILS "Build and install utility programs" ON)
55 OPTION(ALSOFT_NO_CONFIG_UTIL "Disable building the alsoft-config utility" OFF)
57 OPTION(ALSOFT_EXAMPLES "Build and install example programs" ON)
59 OPTION(ALSOFT_CONFIG "Install alsoft.conf sample configuration file" ON)
60 OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" ON)
65 ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502")
70 # QNX's gcc do not uses /usr/include and /usr/lib pathes by default
71 IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
72 ADD_DEFINITIONS("-I/usr/include")
73 SET(EXTRA_LIBS ${EXTRA_LIBS} -L/usr/lib)
80 SET(LIB_MAJOR_VERSION "1")
81 SET(LIB_MINOR_VERSION "15")
83 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
89 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
90 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
93 CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
95 SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
98 # MSVC may need workarounds for C99 restrict and inline
100 # TODO: Once we truly require C99, these restrict and inline checks should go
102 CHECK_C_SOURCE_COMPILES("int *restrict foo;
103 int main() {return 0;}" HAVE_RESTRICT)
104 IF(NOT HAVE_RESTRICT)
105 ADD_DEFINITIONS("-Drestrict=")
106 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Drestrict=")
109 CHECK_C_SOURCE_COMPILES("inline void foo(void) { }
110 int main() {return 0;}" HAVE_INLINE)
112 CHECK_C_SOURCE_COMPILES("__inline void foo(void) { }
113 int main() {return 0;}" HAVE___INLINE)
114 IF(NOT HAVE___INLINE)
115 MESSAGE(FATAL_ERROR "No inline keyword found, please report!")
118 ADD_DEFINITIONS(-Dinline=__inline)
119 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Dinline=__inline")
123 # Make sure we have C99-style inline semantics with GCC (4.3 or newer).
124 IF(CMAKE_COMPILER_IS_GNUCC)
125 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
126 # Force no inlining for the next test.
127 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -fno-inline")
129 CHECK_C_SOURCE_COMPILES("extern inline int foo() { return 0; }
130 int main() {return foo();}" INLINE_IS_C99)
131 IF(NOT INLINE_IS_C99)
132 MESSAGE(FATAL_ERROR "Your compiler does not seem to have C99 inline semantics!
133 Please update your compiler for better C99 compliance.")
136 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
139 # Check if we have C99 variable length arrays
140 CHECK_C_SOURCE_COMPILES(
141 "int main(int argc, char *argv[])
143 volatile int tmp[argc];
149 # Check if we have C99 bool
150 CHECK_C_SOURCE_COMPILES(
151 "int main(int argc, char *argv[])
154 ret = (argc > 1) ? 1 : 0;
159 # Check if we have C11 static_assert
160 CHECK_C_SOURCE_COMPILES(
163 _Static_assert(sizeof(int) == sizeof(int), \"What\");
166 HAVE_C11_STATIC_ASSERT)
168 # Check if we have C11 alignas
169 CHECK_C_SOURCE_COMPILES(
170 "_Alignas(16) int foo;
177 # Check if we have C11 _Atomic
178 CHECK_C_SOURCE_COMPILES(
179 "#include <stdatomic.h>
183 return atomic_load(&foo);
187 # Add definitions, compiler switches, etc.
188 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_BINARY_DIR}")
189 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
190 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc")
191 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
192 ADD_DEFINITIONS("-DAL_NO_UID_DEFS")
196 IF(NOT CMAKE_BUILD_TYPE)
197 SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
198 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
201 IF(NOT CMAKE_DEBUG_POSTFIX)
202 SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
203 "Library postfix for debug builds. Normally left blank."
209 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_DEBUG")
210 SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG")
211 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
212 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
213 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
214 ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
215 ADD_DEFINITIONS("/wd4098")
218 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
220 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
223 MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
224 SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} "${DXSDK_DIR}/Include")
225 INCLUDE_DIRECTORIES("${DXSDK_DIR}/Include")
226 LINK_DIRECTORIES("${DXSDK_DIR}/Lib")
229 OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
230 IF(FORCE_STATIC_VCRT)
232 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
233 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
234 IF(${flag_var} MATCHES "/MD")
235 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
240 ADD_DEFINITIONS(-Winline -Wall)
241 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
243 ADD_DEFINITIONS(-Wextra)
247 ADD_DEFINITIONS(-Werror)
250 # Force enable PIC if available. The static common library will be linked
251 # into the dynamic openal library, which requires all its code to be
252 # position-independent, and CMake doesn't automatically enable PIC for
253 # static library targets (Windows code is always position-independent).
254 CHECK_C_COMPILER_FLAG(-fPIC HAVE_FPIC_SWITCH)
255 IF(HAVE_FPIC_SWITCH AND NOT WIN32)
256 ADD_DEFINITIONS(-fPIC)
259 SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -D_DEBUG" CACHE STRING
260 "Flags used by the compiler during Release with Debug Info builds."
262 SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING
263 "Flags used by the compiler during release minsize builds."
265 SET(CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -DNDEBUG" CACHE STRING
266 "Flags used by the compiler during release builds"
268 SET(CMAKE_C_FLAGS_DEBUG "-g3 -D_DEBUG" CACHE STRING
269 "Flags used by the compiler during debug builds."
272 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
273 int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
276 # Set visibility/export options if available
278 SET(EXPORT_DECL "__declspec(dllexport)")
280 SET(ALIGN_DECL "__declspec(align(x))")
282 SET(ALIGN_DECL "__declspec(aligned(x))")
285 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
286 # Yes GCC, really don't accept visibility modes you don't support
287 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
289 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
290 int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
291 IF(HAVE_GCC_PROTECTED_VISIBILITY)
292 SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
294 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
295 int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
296 IF(HAVE_GCC_DEFAULT_VISIBILITY)
297 SET(EXPORT_DECL "__attribute__((visibility(\"default\")))")
301 IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
302 CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
303 IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
304 ADD_DEFINITIONS(-fvisibility=hidden)
308 CHECK_C_SOURCE_COMPILES("int foo __attribute__((aligned(16)));
309 int main() {return 0;}" HAVE_ATTRIBUTE_ALIGNED)
310 IF(HAVE_ATTRIBUTE_ALIGNED)
311 SET(ALIGN_DECL "__attribute__((aligned(x)))")
314 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
319 SET(SSE4_1_SWITCH "")
321 CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
323 SET(SSE_SWITCH "-msse")
325 CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
326 IF(HAVE_MSSE2_SWITCH)
327 SET(SSE2_SWITCH "-msse2")
329 CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH)
330 IF(HAVE_MSSE4_1_SWITCH)
331 SET(SSE4_1_SWITCH "-msse4.1")
335 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
336 int main() {return 0;}" HAVE_GCC_FORMAT)
338 CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
339 CHECK_INCLUDE_FILE(stdalign.h HAVE_STDALIGN_H)
340 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
341 CHECK_INCLUDE_FILE(ftw.h HAVE_FTW_H)
342 CHECK_INCLUDE_FILE(io.h HAVE_IO_H)
343 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
344 CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
345 CHECK_INCLUDE_FILE(sys/sysconf.h HAVE_SYS_SYSCONF_H)
346 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
347 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
348 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
349 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
350 IF(NOT HAVE_GUIDDEF_H)
351 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
354 # Some systems need libm for some of the following math functions to work
355 CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
357 SET(EXTRA_LIBS m ${EXTRA_LIBS})
358 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
362 CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
363 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
364 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
365 CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
367 CHECK_SYMBOL_EXISTS(alloca malloc.h HAVE_ALLOCA)
369 MESSAGE(FATAL_ERROR "No alloca function found, please report!")
374 CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
375 CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
378 CHECK_SYMBOL_EXISTS(ftw ftw.h HAVE_FTW)
381 CHECK_SYMBOL_EXISTS(_wfindfirst io.h HAVE__WFINDFIRST)
384 CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
385 CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
386 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
387 IF(NOT HAVE_STRCASECMP)
388 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
389 IF(NOT HAVE__STRICMP)
390 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
393 ADD_DEFINITIONS(-Dstrcasecmp=_stricmp)
396 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
397 IF(NOT HAVE_STRNCASECMP)
398 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
399 IF(NOT HAVE__STRNICMP)
400 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
403 ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp)
406 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
407 IF(NOT HAVE_SNPRINTF)
408 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
409 IF(NOT HAVE__SNPRINTF)
410 MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
413 ADD_DEFINITIONS(-Dsnprintf=_snprintf)
416 CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
417 IF(NOT HAVE_ISFINITE)
418 CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
420 CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE)
422 MESSAGE(FATAL_ERROR "No isfinite function found, please report!")
424 ADD_DEFINITIONS(-Disfinite=_finite)
426 ADD_DEFINITIONS(-Disfinite=finite)
430 CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
432 CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN)
434 MESSAGE(FATAL_ERROR "No isnan function found, please report!")
437 ADD_DEFINITIONS(-Disnan=_isnan)
441 # Check for the dlopen API (for dynamicly loading backend libs)
443 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
445 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
447 SET(EXTRA_LIBS dl ${EXTRA_LIBS})
452 # Check if we have Windows headers
453 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502)
454 IF(NOT HAVE_WINDOWS_H)
455 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
456 IF(NOT HAVE_GETTIMEOFDAY)
457 MESSAGE(FATAL_ERROR "No timing function found!")
460 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
461 IF(NOT HAVE_NANOSLEEP)
462 MESSAGE(FATAL_ERROR "No sleep function found!")
465 # We need pthreads outside of Windows
466 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
467 IF(NOT HAVE_PTHREAD_H)
468 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
470 # Some systems need pthread_np.h to get recursive mutexes
471 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
473 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
475 ADD_DEFINITIONS(-pthread)
476 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
477 SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread)
480 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
482 SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
485 CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
487 CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
488 IF(NOT HAVE_PTHREAD_SETNAME_NP)
489 CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
491 IF(HAVE_PTHREAD_NP_H)
492 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
495 CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK)
497 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
499 SET(EXTRA_LIBS rt ${EXTRA_LIBS})
503 # Check for a 64-bit type
504 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
505 IF(NOT HAVE_STDINT_H)
507 CHECK_C_SOURCE_COMPILES("#define _WIN32_WINNT 0x0502
510 int main() {return 0;}" HAVE___INT64)
513 IF(NOT SIZEOF_LONG MATCHES "8")
514 IF(NOT SIZEOF_LONG_LONG MATCHES "8")
515 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
522 SET(COMMON_OBJS common/atomic.c
527 SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c
531 OpenAL32/alExtension.c
533 OpenAL32/alFontsound.c
534 OpenAL32/alListener.c
537 OpenAL32/alSoundfont.c
541 OpenAL32/sample_cvt.c
543 SET(ALC_OBJS Alc/ALc.c
548 Alc/effects/autowah.c
550 Alc/effects/compressor.c
551 Alc/effects/dedicated.c
552 Alc/effects/distortion.c
554 Alc/effects/equalizer.c
555 Alc/effects/flanger.c
556 Alc/effects/modulator.c
567 SET(CPU_EXTS "Default")
573 SET(HAVE_FLUIDSYNTH 0)
583 SET(HAVE_PORTAUDIO 0)
584 SET(HAVE_PULSEAUDIO 0)
585 SET(HAVE_COREAUDIO 0)
589 # Check for SSE support
590 OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
591 CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
593 OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
594 IF(ALSOFT_CPUEXT_SSE)
595 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
597 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse.c)
599 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse.c PROPERTIES
600 COMPILE_FLAGS "${SSE_SWITCH}")
602 SET(CPU_EXTS "${CPU_EXTS}, SSE")
606 IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
607 MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
610 OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
611 CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
613 OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
614 IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
615 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
617 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse2.c)
619 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse2.c PROPERTIES
620 COMPILE_FLAGS "${SSE2_SWITCH}")
622 SET(CPU_EXTS "${CPU_EXTS}, SSE2")
626 IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
627 MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
630 OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
631 CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
633 OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
634 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1)
635 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
637 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse41.c)
639 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse41.c PROPERTIES
640 COMPILE_FLAGS "${SSE4_1_SWITCH}")
642 SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
646 IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
647 MESSAGE(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
650 # Check for ARM Neon support
651 OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
652 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H)
654 OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON)
655 IF(ALSOFT_CPUEXT_NEON)
657 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_neon.c)
658 SET(CPU_EXTS "${CPU_EXTS}, Neon")
661 IF(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
662 MESSAGE(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
666 IF(WIN32 OR HAVE_DLFCN_H)
668 MACRO(ADD_BACKEND_LIBS _LIBS)
671 SET(IS_LINKED " (linked)")
672 MACRO(ADD_BACKEND_LIBS _LIBS)
673 SET(EXTRA_LIBS ${_LIBS} ${EXTRA_LIBS})
677 SET(ALC_OBJS ${ALC_OBJS}
681 Alc/midi/fluidsynth.c
685 # Check for FluidSynth support
686 OPTION(ALSOFT_REQUIRE_FLUIDSYNTH "Require FluidSynth MIDI" OFF)
687 FIND_PACKAGE(FluidSynth)
689 OPTION(ALSOFT_MIDI_FLUIDSYNTH "Enable FluidSynth MIDI" ON)
690 IF(ALSOFT_MIDI_FLUIDSYNTH)
691 SET(HAVE_FLUIDSYNTH 1)
692 ADD_BACKEND_LIBS(${FLUIDSYNTH_LIBRARIES})
693 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
694 INCLUDE_DIRECTORIES(${ALSA_INCLUDE_DIRS})
698 IF(ALSOFT_REQUIRE_FLUIDSYNTH AND NOT HAVE_FLUIDSYNTH)
699 MESSAGE(FATAL_ERROR "Failed to enabled required FluidSynth support")
704 SET(ALC_OBJS ${ALC_OBJS}
706 # Default backends, always available
707 Alc/backends/loopback.c
712 OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
715 OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
716 IF(ALSOFT_BACKEND_ALSA)
718 SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
719 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c)
720 ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
721 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
722 INCLUDE_DIRECTORIES(${ALSA_INCLUDE_DIRS})
726 IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
727 MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend")
731 OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
734 OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
735 IF(ALSOFT_BACKEND_OSS)
737 SET(BACKENDS "${BACKENDS} OSS,")
738 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
739 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
740 INCLUDE_DIRECTORIES(${OSS_INCLUDE_DIRS})
744 IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
745 MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend")
748 # Check Solaris backend
749 OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
750 FIND_PACKAGE(AudioIO)
752 OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
753 IF(ALSOFT_BACKEND_SOLARIS)
755 SET(BACKENDS "${BACKENDS} Solaris,")
756 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
757 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
758 INCLUDE_DIRECTORIES(${AUDIOIO_INCLUDE_DIRS})
762 IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
763 MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend")
766 # Check SndIO backend
767 OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
768 FIND_PACKAGE(SoundIO)
770 OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
771 IF(ALSOFT_BACKEND_SNDIO)
773 SET(BACKENDS "${BACKENDS} SndIO (linked),")
774 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c)
775 SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
776 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
777 INCLUDE_DIRECTORIES(${SOUNDIO_INCLUDE_DIRS})
781 IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
782 MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend")
786 OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF)
789 OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON)
790 IF(ALSOFT_BACKEND_QSA)
792 SET(BACKENDS "${BACKENDS} QSA (linked),")
793 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c)
794 SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
795 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
796 INCLUDE_DIRECTORIES(${QSA_INCLUDE_DIRS})
800 IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA)
801 MESSAGE(FATAL_ERROR "Failed to enabled required QSA backend")
804 # Check DSound backend
805 OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
808 OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
809 IF(ALSOFT_BACKEND_DSOUND)
811 SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
812 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c)
813 ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
814 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
815 INCLUDE_DIRECTORIES(${DSOUND_INCLUDE_DIRS})
819 IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND)
820 MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend")
823 # Check for MMDevApi backend
824 OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF)
826 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
827 IF(HAVE_MMDEVICEAPI_H)
828 OPTION(ALSOFT_BACKEND_MMDEVAPI "Enable MMDevApi backend" ON)
829 IF(ALSOFT_BACKEND_MMDEVAPI)
831 SET(BACKENDS "${BACKENDS} MMDevApi,")
832 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c)
836 IF(ALSOFT_REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI)
837 MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend")
840 # Check MMSystem backend
841 OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
843 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
845 CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
847 OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
848 IF(ALSOFT_BACKEND_WINMM)
850 SET(BACKENDS "${BACKENDS} WinMM,")
851 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
852 SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
857 IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
858 MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")
861 # Check PortAudio backend
862 OPTION(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
863 FIND_PACKAGE(PortAudio)
865 OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
866 IF(ALSOFT_BACKEND_PORTAUDIO)
867 SET(HAVE_PORTAUDIO 1)
868 SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
869 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c)
870 ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
871 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
872 INCLUDE_DIRECTORIES(${PORTAUDIO_INCLUDE_DIRS})
876 IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
877 MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend")
880 # Check PulseAudio backend
881 OPTION(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
882 FIND_PACKAGE(PulseAudio)
884 OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
885 IF(ALSOFT_BACKEND_PULSEAUDIO)
886 SET(HAVE_PULSEAUDIO 1)
887 SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
888 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c)
889 ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
890 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
891 INCLUDE_DIRECTORIES(${PULSEAUDIO_INCLUDE_DIRS})
895 IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
896 MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend")
899 # Check CoreAudio backend
900 OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
901 FIND_LIBRARY(COREAUDIO_FRAMEWORK
903 PATHS /System/Library/Frameworks
905 IF(COREAUDIO_FRAMEWORK)
906 OPTION(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
907 IF(ALSOFT_BACKEND_COREAUDIO)
908 SET(HAVE_COREAUDIO 1)
909 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c)
910 SET(BACKENDS "${BACKENDS} CoreAudio,")
911 SET(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${EXTRA_LIBS})
912 SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
913 SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
915 # Some versions of OSX may need the AudioToolbox framework. Add it if
917 FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
919 PATHS ~/Library/Frameworks
921 /System/Library/Frameworks
923 IF(AUDIOTOOLBOX_LIBRARY)
924 SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
928 IF(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
929 MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend")
932 # Check for OpenSL (Android) backend
933 OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
934 CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
935 IF(HAVE_SLES_OPENSLES_ANDROID_H)
936 CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
938 OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
939 IF(ALSOFT_BACKEND_OPENSL)
941 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c)
942 SET(BACKENDS "${BACKENDS} OpenSL,")
943 SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
947 IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
948 MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
951 # Optionally enable the Wave Writer backend
952 OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
953 IF(ALSOFT_BACKEND_WAVE)
955 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c)
956 SET(BACKENDS "${BACKENDS} WaveFile,")
959 # This is always available
960 SET(BACKENDS "${BACKENDS} Null")
962 IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL)
963 add_subdirectory(utils/alsoft-config)
968 FIND_PACKAGE(SDL_sound)
969 IF(SDL_SOUND_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8")
970 INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
972 FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE)
973 IF(FFMPEG_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8")
974 INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIRS})
979 IF(LIBTYPE STREQUAL "STATIC")
980 ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC)
981 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS})
984 # Needed for openal.pc.in
985 SET(prefix ${CMAKE_INSTALL_PREFIX})
986 SET(exec_prefix "\${prefix}")
987 SET(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
988 SET(bindir "\${exec_prefix}/bin")
989 SET(includedir "\${prefix}/include")
990 SET(PACKAGE_VERSION "${LIB_VERSION}")
994 "${OpenAL_SOURCE_DIR}/config.h.in"
995 "${OpenAL_BINARY_DIR}/config.h")
997 "${OpenAL_SOURCE_DIR}/openal.pc.in"
998 "${OpenAL_BINARY_DIR}/openal.pc"
1001 # Build a common library with reusable helpers
1002 ADD_LIBRARY(common STATIC ${COMMON_OBJS})
1004 # Build main library
1005 ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS})
1006 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES)
1007 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
1008 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS)
1010 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc")
1011 IF(FLUIDSYNTH_FOUND)
1012 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${FLUIDSYNTH_INCLUDE_DIR})
1015 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS})
1018 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${OSS_INCLUDE_DIRS})
1021 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${AUDIOIO_INCLUDE_DIRS})
1024 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${SOUNDIO_INCLUDE_DIRS})
1027 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${QSA_INCLUDE_DIRS})
1030 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIRS})
1033 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PORTAUDIO_INCLUDE_DIRS})
1036 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS})
1038 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION}
1039 SOVERSION ${LIB_MAJOR_VERSION})
1040 IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC")
1041 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
1044 TARGET_LINK_LIBRARIES(${LIBNAME} common ${EXTRA_LIBS})
1046 # Add an install target here
1047 INSTALL(TARGETS ${LIBNAME}
1048 RUNTIME DESTINATION bin
1049 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1050 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1052 INSTALL(FILES include/AL/al.h
1056 include/AL/efx-creative.h
1057 include/AL/efx-presets.h
1058 DESTINATION include/AL
1060 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
1061 DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
1065 MESSAGE(STATUS "Building OpenAL with support for the following backends:")
1066 MESSAGE(STATUS " ${BACKENDS}")
1068 MESSAGE(STATUS "Building with support for CPU extensions:")
1069 MESSAGE(STATUS " ${CPU_EXTS}")
1072 MESSAGE(STATUS "FluidSynth support for ALC_SOFT_midi_interface enabled")
1078 MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
1079 MESSAGE(STATUS " This is probably NOT what you want!")
1084 # Install alsoft.conf configuration file
1086 INSTALL(FILES alsoftrc.sample
1087 DESTINATION share/openal
1089 MESSAGE(STATUS "Installing sample configuration")
1093 # Install HRTF definitions
1094 IF(ALSOFT_HRTF_DEFS)
1095 INSTALL(FILES hrtf/default-44100.mhr
1096 hrtf/default-48000.mhr
1097 DESTINATION share/openal/hrtf
1099 MESSAGE(STATUS "Installing HRTF definitions")
1104 ADD_EXECUTABLE(openal-info utils/openal-info.c)
1105 TARGET_LINK_LIBRARIES(openal-info ${LIBNAME})
1107 ADD_EXECUTABLE(makehrtf utils/makehrtf.c)
1109 TARGET_LINK_LIBRARIES(makehrtf m)
1112 INSTALL(TARGETS openal-info makehrtf
1113 RUNTIME DESTINATION bin
1114 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1115 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1118 MESSAGE(STATUS "Building utility programs")
1119 IF(TARGET alsoft-config)
1120 MESSAGE(STATUS "Building configuration program")
1126 IF(SDL2_FOUND AND SDL_SOUND_FOUND)
1127 ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c
1128 examples/common/sdl_sound.c)
1129 SET_PROPERTY(TARGET ex-common APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1130 ${SDL_SOUND_INCLUDE_DIR})
1132 ADD_EXECUTABLE(alstream examples/alstream.c)
1133 TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1134 SET_PROPERTY(TARGET alstream APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1135 ${SDL_SOUND_INCLUDE_DIR})
1137 ADD_EXECUTABLE(alreverb examples/alreverb.c)
1138 TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1139 SET_PROPERTY(TARGET alreverb APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1140 ${SDL_SOUND_INCLUDE_DIR})
1142 ADD_EXECUTABLE(allatency examples/allatency.c)
1143 TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1144 SET_PROPERTY(TARGET allatency APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1145 ${SDL_SOUND_INCLUDE_DIR})
1147 ADD_EXECUTABLE(alloopback examples/alloopback.c)
1148 TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1149 SET_PROPERTY(TARGET alloopback APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1150 ${SDL_SOUND_INCLUDE_DIR})
1152 INSTALL(TARGETS alstream alreverb allatency alloopback
1153 RUNTIME DESTINATION bin
1154 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1155 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1161 IF(AVFORMAT_VERSION VERSION_LESS "55.33.100")
1162 MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 55.33.100)")
1165 IF(AVCODEC_VERSION VERSION_LESS "55.52.102")
1166 MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 55.52.102)")
1169 IF(AVUTIL_VERSION VERSION_LESS "52.66.100")
1170 MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 52.66.100)")
1173 IF(SWSCALE_VERSION VERSION_LESS "2.5.102")
1174 MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 2.5.102)")
1177 IF(SWRESAMPLE_VERSION VERSION_LESS "0.18.100")
1178 MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 0.18.100)")
1182 IF(FFVER_OK AND NOT MSVC)
1183 ADD_EXECUTABLE(alffplay examples/alffplay.c)
1184 TARGET_LINK_LIBRARIES(alffplay common ex-common ${SDL2_LIBRARY} ${LIBNAME} ${FFMPEG_LIBRARIES})
1185 SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1186 ${FFMPEG_INCLUDE_DIRS})
1188 INSTALL(TARGETS alffplay
1189 RUNTIME DESTINATION bin
1190 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1191 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1193 MESSAGE(STATUS "Building SDL and FFmpeg example programs")
1195 MESSAGE(STATUS "Building SDL example programs")