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)
29 OPTION(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON)
31 OPTION(ALSOFT_WERROR "Treat compile warnings as errors" OFF)
33 OPTION(ALSOFT_UTILS "Build and install utility programs" ON)
34 OPTION(ALSOFT_NO_CONFIG_UTIL "Disable building the alsoft-config utility" OFF)
36 OPTION(ALSOFT_EXAMPLES "Build and install example programs" ON)
38 OPTION(ALSOFT_CONFIG "Install alsoft.conf sample configuration file" ON)
39 OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" ON)
44 ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502")
46 # This option is mainly for static linking OpenAL Soft into another project
47 # that already defines the IDs. It is up to that project to ensure all
48 # required IDs are defined.
49 OPTION(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF)
52 OPTION(ALSOFT_BUILD_IMPORT_LIB "Build an import .lib using dlltool (requires sed)" ON)
55 SET(DLLTOOL "${HOST}-dlltool")
57 SET(DLLTOOL "dlltool")
64 # These are needed on non-Windows systems for extra features
65 ADD_DEFINITIONS(-D_GNU_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700)
66 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_GNU_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700")
69 # Set defines for large file support
70 CHECK_FILE_OFFSET_BITS()
72 ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
73 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
75 ADD_DEFINITIONS(-D_LARGEFILE_SOURCE -D_LARGE_FILES)
76 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES")
79 # QNX's gcc do not uses /usr/include and /usr/lib pathes by default
80 IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
81 ADD_DEFINITIONS("-I/usr/include")
82 SET(EXTRA_LIBS ${EXTRA_LIBS} -L/usr/lib)
89 SET(LIB_MAJOR_VERSION "1")
90 SET(LIB_MINOR_VERSION "16")
92 SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
98 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
99 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
102 CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
104 SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
107 # MSVC may need workarounds for C99 restrict and inline
109 # TODO: Once we truly require C99, these restrict and inline checks should go
111 CHECK_C_SOURCE_COMPILES("int *restrict foo;
112 int main() {return 0;}" HAVE_RESTRICT)
113 IF(NOT HAVE_RESTRICT)
114 ADD_DEFINITIONS("-Drestrict=")
115 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Drestrict=")
118 CHECK_C_SOURCE_COMPILES("inline void foo(void) { }
119 int main() {return 0;}" HAVE_INLINE)
121 CHECK_C_SOURCE_COMPILES("__inline void foo(void) { }
122 int main() {return 0;}" HAVE___INLINE)
123 IF(NOT HAVE___INLINE)
124 MESSAGE(FATAL_ERROR "No inline keyword found, please report!")
127 ADD_DEFINITIONS(-Dinline=__inline)
128 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Dinline=__inline")
132 # Make sure we have C99-style inline semantics with GCC (4.3 or newer).
133 IF(CMAKE_COMPILER_IS_GNUCC)
134 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
135 # Force no inlining for the next test.
136 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -fno-inline")
138 CHECK_C_SOURCE_COMPILES("extern inline int foo() { return 0; }
139 int main() {return foo();}" INLINE_IS_C99)
140 IF(NOT INLINE_IS_C99)
141 MESSAGE(FATAL_ERROR "Your compiler does not seem to have C99 inline semantics!
142 Please update your compiler for better C99 compliance.")
145 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
148 # Check if we have C99 variable length arrays
149 CHECK_C_SOURCE_COMPILES(
150 "int main(int argc, char *argv[])
152 volatile int tmp[argc];
158 # Check if we have C99 bool
159 CHECK_C_SOURCE_COMPILES(
160 "int main(int argc, char *argv[])
163 ret = (argc > 1) ? 1 : 0;
168 # Check if we have C11 static_assert
169 CHECK_C_SOURCE_COMPILES(
172 _Static_assert(sizeof(int) == sizeof(int), \"What\");
175 HAVE_C11_STATIC_ASSERT)
177 # Check if we have C11 alignas
178 CHECK_C_SOURCE_COMPILES(
179 "_Alignas(16) int foo;
186 # Check if we have C11 _Atomic
187 CHECK_C_SOURCE_COMPILES(
188 "#include <stdatomic.h>
189 const int _Atomic foo = ATOMIC_VAR_INIT(~0);
192 return atomic_load(&foo);
196 # Add definitions, compiler switches, etc.
197 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_BINARY_DIR}")
198 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
199 INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc")
200 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
201 ADD_DEFINITIONS("-DAL_NO_UID_DEFS")
205 IF(NOT CMAKE_BUILD_TYPE)
206 SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
207 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
210 IF(NOT CMAKE_DEBUG_POSTFIX)
211 SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
212 "Library postfix for debug builds. Normally left blank."
217 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
218 ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
219 ADD_DEFINITIONS("/wd4098")
222 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
224 STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
227 MESSAGE(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
230 OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
231 IF(FORCE_STATIC_VCRT)
233 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
234 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
235 IF(${flag_var} MATCHES "/MD")
236 STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
241 ADD_DEFINITIONS(-Winline -Wall)
242 CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
244 ADD_DEFINITIONS(-Wextra)
248 ADD_DEFINITIONS(-Werror)
251 # Force enable -fPIC for CMake versions before 2.8.9 (later versions have
252 # the POSITION_INDEPENDENT_CODE target property). The static common library
253 # will be linked into the dynamic openal library, which requires all its
254 # code to be position-independent.
255 IF(CMAKE_VERSION VERSION_LESS "2.8.9" AND NOT WIN32)
256 CHECK_C_COMPILER_FLAG(-fPIC HAVE_FPIC_SWITCH)
258 ADD_DEFINITIONS(-fPIC)
262 # We want RelWithDebInfo to actually include debug stuff (define _DEBUG
264 FOREACH(flag_var CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
265 IF(${flag_var} MATCHES "-DNDEBUG")
266 STRING(REGEX REPLACE "-DNDEBUG" "-D_DEBUG" ${flag_var} "${${flag_var}}")
270 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
271 int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
274 # Set visibility/export options if available
276 SET(EXPORT_DECL "__declspec(dllexport)")
278 SET(ALIGN_DECL "__declspec(align(x))")
280 SET(ALIGN_DECL "__declspec(aligned(x))")
283 SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
284 # Yes GCC, really don't accept visibility modes you don't support
285 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
287 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"protected\")));
288 int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
289 IF(HAVE_GCC_PROTECTED_VISIBILITY)
290 SET(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
292 CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));
293 int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
294 IF(HAVE_GCC_DEFAULT_VISIBILITY)
295 SET(EXPORT_DECL "__attribute__((visibility(\"default\")))")
299 IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
300 CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
301 IF(HAVE_VISIBILITY_HIDDEN_SWITCH)
302 ADD_DEFINITIONS(-fvisibility=hidden)
306 CHECK_C_SOURCE_COMPILES("int foo __attribute__((aligned(16)));
307 int main() {return 0;}" HAVE_ATTRIBUTE_ALIGNED)
308 IF(HAVE_ATTRIBUTE_ALIGNED)
309 SET(ALIGN_DECL "__attribute__((aligned(x)))")
312 SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
317 SET(SSE4_1_SWITCH "")
319 CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
321 SET(SSE_SWITCH "-msse")
323 CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
324 IF(HAVE_MSSE2_SWITCH)
325 SET(SSE2_SWITCH "-msse2")
327 CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH)
328 IF(HAVE_MSSE4_1_SWITCH)
329 SET(SSE4_1_SWITCH "-msse4.1")
333 CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
334 int main() {return 0;}" HAVE_GCC_FORMAT)
336 CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
337 CHECK_INCLUDE_FILE(stdalign.h HAVE_STDALIGN_H)
338 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
339 CHECK_INCLUDE_FILE(ftw.h HAVE_FTW_H)
340 CHECK_INCLUDE_FILE(io.h HAVE_IO_H)
341 CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
342 CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
343 CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
344 CHECK_INCLUDE_FILE(sys/sysconf.h HAVE_SYS_SYSCONF_H)
345 CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
346 CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
347 CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
348 CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
349 IF(NOT HAVE_GUIDDEF_H)
350 CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
354 CHECK_C_SOURCE_COMPILES("#include <cpuid.h>
357 unsigned int eax, ebx, ecx, edx;
358 return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
359 }" HAVE_GCC_GET_CPUID)
363 CHECK_C_SOURCE_COMPILES("#include <intrin.h>
369 }" HAVE_CPUID_INTRINSIC)
372 # Some systems need libm for some of the following math functions to work
373 CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
375 SET(EXTRA_LIBS m ${EXTRA_LIBS})
376 SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
380 CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
381 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
382 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
383 CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
385 CHECK_SYMBOL_EXISTS(alloca malloc.h HAVE_ALLOCA)
387 MESSAGE(FATAL_ERROR "No alloca function found, please report!")
392 CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
393 CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
396 CHECK_SYMBOL_EXISTS(ftw ftw.h HAVE_FTW)
399 CHECK_SYMBOL_EXISTS(_wfindfirst io.h HAVE__WFINDFIRST)
402 CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
403 CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
404 CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
405 IF(NOT HAVE_STRCASECMP)
406 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
407 IF(NOT HAVE__STRICMP)
408 MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
411 ADD_DEFINITIONS(-Dstrcasecmp=_stricmp)
414 CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
415 IF(NOT HAVE_STRNCASECMP)
416 CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
417 IF(NOT HAVE__STRNICMP)
418 MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
421 ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp)
424 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
425 IF(NOT HAVE_SNPRINTF)
426 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
427 IF(NOT HAVE__SNPRINTF)
428 MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
431 ADD_DEFINITIONS(-Dsnprintf=_snprintf)
434 CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
435 IF(NOT HAVE_ISFINITE)
436 CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
438 CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE)
440 MESSAGE(FATAL_ERROR "No isfinite function found, please report!")
442 ADD_DEFINITIONS(-Disfinite=_finite)
444 ADD_DEFINITIONS(-Disfinite=finite)
448 CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
450 CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN)
452 MESSAGE(FATAL_ERROR "No isnan function found, please report!")
455 ADD_DEFINITIONS(-Disnan=_isnan)
459 # Check for the dlopen API (for dynamicly loading backend libs)
461 CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
463 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
465 SET(EXTRA_LIBS dl ${EXTRA_LIBS})
470 # Check if we have Windows headers
471 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502)
472 IF(NOT HAVE_WINDOWS_H)
473 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
474 IF(NOT HAVE_GETTIMEOFDAY)
475 MESSAGE(FATAL_ERROR "No timing function found!")
478 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
479 IF(NOT HAVE_NANOSLEEP)
480 MESSAGE(FATAL_ERROR "No sleep function found!")
483 # We need pthreads outside of Windows
484 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
485 IF(NOT HAVE_PTHREAD_H)
486 MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
488 # Some systems need pthread_np.h to get recursive mutexes
489 CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
491 CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
493 ADD_DEFINITIONS(-pthread)
494 SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
495 SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread)
498 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
500 SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
503 CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
505 CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
506 IF(NOT HAVE_PTHREAD_SETNAME_NP)
507 CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
509 IF(HAVE_PTHREAD_NP_H)
510 CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
513 CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK)
515 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
517 SET(EXTRA_LIBS rt ${EXTRA_LIBS})
521 # Check for a 64-bit type
522 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
523 IF(NOT HAVE_STDINT_H)
525 CHECK_C_SOURCE_COMPILES("#define _WIN32_WINNT 0x0502
528 int main() {return 0;}" HAVE___INT64)
531 IF(NOT SIZEOF_LONG MATCHES "8")
532 IF(NOT SIZEOF_LONG_LONG MATCHES "8")
533 MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
540 SET(COMMON_OBJS common/atomic.c
545 SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c
549 OpenAL32/alExtension.c
551 OpenAL32/alFontsound.c
552 OpenAL32/alListener.c
555 OpenAL32/alSoundfont.c
559 OpenAL32/sample_cvt.c
561 SET(ALC_OBJS Alc/ALc.c
566 Alc/effects/autowah.c
568 Alc/effects/compressor.c
569 Alc/effects/dedicated.c
570 Alc/effects/distortion.c
572 Alc/effects/equalizer.c
573 Alc/effects/flanger.c
574 Alc/effects/modulator.c
585 SET(CPU_EXTS "Default")
591 SET(HAVE_FLUIDSYNTH 0)
601 SET(HAVE_PORTAUDIO 0)
602 SET(HAVE_PULSEAUDIO 0)
603 SET(HAVE_COREAUDIO 0)
607 # Check for SSE support
608 OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
609 CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
611 OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
612 IF(ALSOFT_CPUEXT_SSE)
613 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
615 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse.c)
617 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse.c PROPERTIES
618 COMPILE_FLAGS "${SSE_SWITCH}")
620 SET(CPU_EXTS "${CPU_EXTS}, SSE")
624 IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
625 MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
628 OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
629 CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
631 OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
632 IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
633 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
635 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse2.c)
637 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse2.c PROPERTIES
638 COMPILE_FLAGS "${SSE2_SWITCH}")
640 SET(CPU_EXTS "${CPU_EXTS}, SSE2")
644 IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
645 MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
648 OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
649 CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
651 OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
652 IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1)
653 IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
655 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse41.c)
657 SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse41.c PROPERTIES
658 COMPILE_FLAGS "${SSE4_1_SWITCH}")
660 SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
664 IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
665 MESSAGE(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
668 # Check for ARM Neon support
669 OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
670 CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H)
672 OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON)
673 IF(ALSOFT_CPUEXT_NEON)
675 SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_neon.c)
676 SET(CPU_EXTS "${CPU_EXTS}, Neon")
679 IF(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
680 MESSAGE(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
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})
695 SET(ALC_OBJS ${ALC_OBJS}
699 Alc/midi/fluidsynth.c
703 # Check for FluidSynth support
704 OPTION(ALSOFT_REQUIRE_FLUIDSYNTH "Require FluidSynth MIDI" OFF)
705 FIND_PACKAGE(FluidSynth)
707 OPTION(ALSOFT_MIDI_FLUIDSYNTH "Enable FluidSynth MIDI" ON)
708 IF(ALSOFT_MIDI_FLUIDSYNTH)
709 SET(HAVE_FLUIDSYNTH 1)
710 ADD_BACKEND_LIBS(${FLUIDSYNTH_LIBRARIES})
711 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
712 INCLUDE_DIRECTORIES(${FLUIDSYNTH_INCLUDE_DIR})
716 IF(ALSOFT_REQUIRE_FLUIDSYNTH AND NOT HAVE_FLUIDSYNTH)
717 MESSAGE(FATAL_ERROR "Failed to enabled required FluidSynth support")
722 SET(ALC_OBJS ${ALC_OBJS}
724 # Default backends, always available
725 Alc/backends/loopback.c
730 OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
733 OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
734 IF(ALSOFT_BACKEND_ALSA)
736 SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
737 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c)
738 ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
739 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
740 INCLUDE_DIRECTORIES(${ALSA_INCLUDE_DIRS})
744 IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
745 MESSAGE(FATAL_ERROR "Failed to enabled required ALSA backend")
749 OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
752 OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
753 IF(ALSOFT_BACKEND_OSS)
755 SET(BACKENDS "${BACKENDS} OSS,")
756 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
757 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
758 INCLUDE_DIRECTORIES(${OSS_INCLUDE_DIRS})
762 IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
763 MESSAGE(FATAL_ERROR "Failed to enabled required OSS backend")
766 # Check Solaris backend
767 OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
768 FIND_PACKAGE(AudioIO)
770 OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
771 IF(ALSOFT_BACKEND_SOLARIS)
773 SET(BACKENDS "${BACKENDS} Solaris,")
774 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
775 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
776 INCLUDE_DIRECTORIES(${AUDIOIO_INCLUDE_DIRS})
780 IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
781 MESSAGE(FATAL_ERROR "Failed to enabled required Solaris backend")
784 # Check SndIO backend
785 OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
786 FIND_PACKAGE(SoundIO)
788 OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
789 IF(ALSOFT_BACKEND_SNDIO)
791 SET(BACKENDS "${BACKENDS} SndIO (linked),")
792 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c)
793 SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
794 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
795 INCLUDE_DIRECTORIES(${SOUNDIO_INCLUDE_DIRS})
799 IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
800 MESSAGE(FATAL_ERROR "Failed to enabled required SndIO backend")
804 OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF)
807 OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON)
808 IF(ALSOFT_BACKEND_QSA)
810 SET(BACKENDS "${BACKENDS} QSA (linked),")
811 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c)
812 SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
813 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
814 INCLUDE_DIRECTORIES(${QSA_INCLUDE_DIRS})
818 IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA)
819 MESSAGE(FATAL_ERROR "Failed to enabled required QSA backend")
822 # Check Windows-only backends
823 OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
824 OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
825 OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF)
827 # Check MMSystem backend
828 CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
830 CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
832 OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
833 IF(ALSOFT_BACKEND_WINMM)
835 SET(BACKENDS "${BACKENDS} WinMM,")
836 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
837 SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
842 # Check DSound backend
845 OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
846 IF(ALSOFT_BACKEND_DSOUND)
848 SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
849 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c)
850 ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
851 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
852 INCLUDE_DIRECTORIES(${DSOUND_INCLUDE_DIRS})
857 # Check for MMDevApi backend
858 CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
859 IF(HAVE_MMDEVICEAPI_H)
860 OPTION(ALSOFT_BACKEND_MMDEVAPI "Enable MMDevApi backend" ON)
861 IF(ALSOFT_BACKEND_MMDEVAPI)
863 SET(BACKENDS "${BACKENDS} MMDevApi,")
864 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c)
868 IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
869 MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend")
871 IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND)
872 MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend")
874 IF(ALSOFT_REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI)
875 MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend")
878 # Check PortAudio backend
879 OPTION(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
880 FIND_PACKAGE(PortAudio)
882 OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
883 IF(ALSOFT_BACKEND_PORTAUDIO)
884 SET(HAVE_PORTAUDIO 1)
885 SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
886 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c)
887 ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
888 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
889 INCLUDE_DIRECTORIES(${PORTAUDIO_INCLUDE_DIRS})
893 IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
894 MESSAGE(FATAL_ERROR "Failed to enabled required PortAudio backend")
897 # Check PulseAudio backend
898 OPTION(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
899 FIND_PACKAGE(PulseAudio)
901 OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
902 IF(ALSOFT_BACKEND_PULSEAUDIO)
903 SET(HAVE_PULSEAUDIO 1)
904 SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
905 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c)
906 ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
907 IF(CMAKE_VERSION VERSION_LESS "2.8.8")
908 INCLUDE_DIRECTORIES(${PULSEAUDIO_INCLUDE_DIRS})
912 IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
913 MESSAGE(FATAL_ERROR "Failed to enabled required PulseAudio backend")
916 # Check CoreAudio backend
917 OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
918 FIND_LIBRARY(COREAUDIO_FRAMEWORK
920 PATHS /System/Library/Frameworks
922 IF(COREAUDIO_FRAMEWORK)
923 OPTION(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
924 IF(ALSOFT_BACKEND_COREAUDIO)
925 SET(HAVE_COREAUDIO 1)
926 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c)
927 SET(BACKENDS "${BACKENDS} CoreAudio,")
928 SET(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${EXTRA_LIBS})
929 SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
930 SET(EXTRA_LIBS /System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
932 # Some versions of OSX may need the AudioToolbox framework. Add it if
934 FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
936 PATHS ~/Library/Frameworks
938 /System/Library/Frameworks
940 IF(AUDIOTOOLBOX_LIBRARY)
941 SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
945 IF(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
946 MESSAGE(FATAL_ERROR "Failed to enabled required CoreAudio backend")
949 # Check for OpenSL (Android) backend
950 OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
951 CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
952 IF(HAVE_SLES_OPENSLES_ANDROID_H)
953 CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
955 OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
956 IF(ALSOFT_BACKEND_OPENSL)
958 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c)
959 SET(BACKENDS "${BACKENDS} OpenSL,")
960 SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
964 IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
965 MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
968 # Optionally enable the Wave Writer backend
969 OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
970 IF(ALSOFT_BACKEND_WAVE)
972 SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c)
973 SET(BACKENDS "${BACKENDS} WaveFile,")
976 # This is always available
977 SET(BACKENDS "${BACKENDS} Null")
979 IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL)
980 add_subdirectory(utils/alsoft-config)
985 FIND_PACKAGE(SDL_sound)
986 IF(SDL_SOUND_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8")
987 INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
989 FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE)
990 IF(FFMPEG_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8")
991 INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIRS})
996 IF(LIBTYPE STREQUAL "STATIC")
997 ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC)
998 SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS})
1001 # Needed for openal.pc.in
1002 SET(prefix ${CMAKE_INSTALL_PREFIX})
1003 SET(exec_prefix "\${prefix}")
1004 SET(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
1005 SET(bindir "\${exec_prefix}/bin")
1006 SET(includedir "\${prefix}/include")
1007 SET(PACKAGE_VERSION "${LIB_VERSION}")
1011 "${OpenAL_SOURCE_DIR}/config.h.in"
1012 "${OpenAL_BINARY_DIR}/config.h")
1014 "${OpenAL_SOURCE_DIR}/openal.pc.in"
1015 "${OpenAL_BINARY_DIR}/openal.pc"
1018 # Build a common library with reusable helpers
1019 ADD_LIBRARY(common STATIC ${COMMON_OBJS})
1020 IF(NOT LIBTYPE STREQUAL "STATIC")
1021 SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE)
1024 # Build main library
1025 IF(LIBTYPE STREQUAL "STATIC")
1026 ADD_LIBRARY(${LIBNAME} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
1028 ADD_LIBRARY(${LIBNAME} SHARED ${OPENAL_OBJS} ${ALC_OBJS})
1030 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES)
1031 IF(WIN32 AND ALSOFT_NO_UID_DEFS)
1032 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS)
1034 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc")
1035 IF(FLUIDSYNTH_FOUND)
1036 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${FLUIDSYNTH_INCLUDE_DIR})
1039 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS})
1042 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${OSS_INCLUDE_DIRS})
1045 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${AUDIOIO_INCLUDE_DIRS})
1048 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${SOUNDIO_INCLUDE_DIRS})
1051 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${QSA_INCLUDE_DIRS})
1054 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIRS})
1057 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PORTAUDIO_INCLUDE_DIRS})
1060 SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS})
1062 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION}
1063 SOVERSION ${LIB_MAJOR_VERSION})
1064 IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC")
1065 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
1067 IF(MINGW AND ALSOFT_BUILD_IMPORT_LIB)
1068 FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable")
1069 FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable")
1070 IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE)
1072 IF(NOT SED_EXECUTABLE)
1073 MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation")
1075 IF(NOT DLLTOOL_EXECUTABLE)
1076 MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation")
1079 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-Wl,--output-def,${LIBNAME}.def")
1080 ADD_CUSTOM_COMMAND(TARGET ${LIBNAME} POST_BUILD
1081 COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" ${LIBNAME}.def
1082 COMMAND "${DLLTOOL_EXECUTABLE}" -d ${LIBNAME}.def -l ${LIBNAME}.lib -D ${LIBNAME}.dll
1083 COMMENT "Stripping ordinals from ${LIBNAME}.def and generating ${LIBNAME}.lib..."
1090 TARGET_LINK_LIBRARIES(${LIBNAME} common ${EXTRA_LIBS})
1092 # Add an install target here
1093 INSTALL(TARGETS ${LIBNAME}
1094 RUNTIME DESTINATION bin
1095 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1096 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1098 INSTALL(FILES include/AL/al.h
1102 include/AL/efx-creative.h
1103 include/AL/efx-presets.h
1104 DESTINATION include/AL
1106 INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
1107 DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
1111 MESSAGE(STATUS "Building OpenAL with support for the following backends:")
1112 MESSAGE(STATUS " ${BACKENDS}")
1114 MESSAGE(STATUS "Building with support for CPU extensions:")
1115 MESSAGE(STATUS " ${CPU_EXTS}")
1118 MESSAGE(STATUS "FluidSynth support for ALC_SOFT_midi_interface enabled")
1124 MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
1125 MESSAGE(STATUS " This is probably NOT what you want!")
1130 # Install alsoft.conf configuration file
1132 INSTALL(FILES alsoftrc.sample
1133 DESTINATION share/openal
1135 MESSAGE(STATUS "Installing sample configuration")
1139 # Install HRTF definitions
1140 IF(ALSOFT_HRTF_DEFS)
1141 INSTALL(FILES hrtf/default-44100.mhr
1142 hrtf/default-48000.mhr
1143 DESTINATION share/openal/hrtf
1145 MESSAGE(STATUS "Installing HRTF definitions")
1150 ADD_EXECUTABLE(openal-info utils/openal-info.c)
1151 TARGET_LINK_LIBRARIES(openal-info ${LIBNAME})
1153 ADD_EXECUTABLE(makehrtf utils/makehrtf.c)
1155 TARGET_LINK_LIBRARIES(makehrtf m)
1158 INSTALL(TARGETS openal-info makehrtf
1159 RUNTIME DESTINATION bin
1160 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1161 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1164 MESSAGE(STATUS "Building utility programs")
1165 IF(TARGET alsoft-config)
1166 MESSAGE(STATUS "Building configuration program")
1172 IF(SDL2_FOUND AND SDL_SOUND_FOUND)
1173 ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c
1174 examples/common/sdl_sound.c)
1175 SET_PROPERTY(TARGET ex-common APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1176 ${SDL_SOUND_INCLUDE_DIR})
1178 ADD_EXECUTABLE(alstream examples/alstream.c)
1179 TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1180 SET_PROPERTY(TARGET alstream APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1181 ${SDL_SOUND_INCLUDE_DIR})
1183 ADD_EXECUTABLE(alreverb examples/alreverb.c)
1184 TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1185 SET_PROPERTY(TARGET alreverb APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1186 ${SDL_SOUND_INCLUDE_DIR})
1188 ADD_EXECUTABLE(allatency examples/allatency.c)
1189 TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1190 SET_PROPERTY(TARGET allatency APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1191 ${SDL_SOUND_INCLUDE_DIR})
1193 ADD_EXECUTABLE(alloopback examples/alloopback.c)
1194 TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
1195 SET_PROPERTY(TARGET alloopback APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1196 ${SDL_SOUND_INCLUDE_DIR})
1198 INSTALL(TARGETS alstream alreverb allatency alloopback
1199 RUNTIME DESTINATION bin
1200 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1201 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1207 IF(AVFORMAT_VERSION VERSION_LESS "55.33.100")
1208 MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 55.33.100)")
1211 IF(AVCODEC_VERSION VERSION_LESS "55.52.102")
1212 MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 55.52.102)")
1215 IF(AVUTIL_VERSION VERSION_LESS "52.66.100")
1216 MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 52.66.100)")
1219 IF(SWSCALE_VERSION VERSION_LESS "2.5.102")
1220 MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 2.5.102)")
1223 IF(SWRESAMPLE_VERSION VERSION_LESS "0.18.100")
1224 MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 0.18.100)")
1228 IF(FFVER_OK AND NOT MSVC)
1229 ADD_EXECUTABLE(alffplay examples/alffplay.c)
1230 TARGET_LINK_LIBRARIES(alffplay common ex-common ${SDL2_LIBRARY} ${LIBNAME} ${FFMPEG_LIBRARIES})
1231 SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
1232 ${FFMPEG_INCLUDE_DIRS})
1234 INSTALL(TARGETS alffplay
1235 RUNTIME DESTINATION bin
1236 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
1237 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
1239 MESSAGE(STATUS "Building SDL and FFmpeg example programs")
1241 MESSAGE(STATUS "Building SDL example programs")