aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-12 19:21:00 +0100
committerSven Gothel <[email protected]>2019-12-12 19:21:00 +0100
commit4df06c6894b39af5bf4681c0acf0c1c080084c80 (patch)
tree2505eb6e3b5798db34033c4cac2d4613bf6bda44 /CMakeLists.txt
parent8915501ed02eac2b3bce9a7fc06cb1ab562901c3 (diff)
parentc0cf323e1d56ce605e90927324d2fdafcfbb564a (diff)
merge v1.20.0
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt1187
1 files changed, 497 insertions, 690 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fb2be56..5f7e1a84 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,26 +16,38 @@ IF(COMMAND CMAKE_POLICY)
IF(POLICY CMP0054)
CMAKE_POLICY(SET CMP0054 NEW)
ENDIF(POLICY CMP0054)
+ IF(POLICY CMP0075)
+ CMAKE_POLICY(SET CMP0075 NEW)
+ ENDIF(POLICY CMP0075)
ENDIF(COMMAND CMAKE_POLICY)
+IF(NOT CMAKE_BUILD_TYPE)
+ SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
+ "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
+ FORCE)
+ENDIF()
+IF(NOT CMAKE_DEBUG_POSTFIX)
+ SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
+ "Library postfix for debug builds. Normally left blank."
+ FORCE)
+ENDIF()
+
SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
+
INCLUDE(CheckFunctionExists)
INCLUDE(CheckLibraryExists)
-INCLUDE(CheckSharedFunctionExists)
INCLUDE(CheckIncludeFile)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckCCompilerFlag)
INCLUDE(CheckCXXCompilerFlag)
INCLUDE(CheckCSourceCompiles)
+INCLUDE(CheckCXXSourceCompiles)
INCLUDE(CheckTypeSize)
include(CheckStructHasMember)
-include(CheckFileOffsetBits)
include(GNUInstallDirs)
-SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
-
OPTION(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON)
@@ -62,7 +74,7 @@ if(DEFINED LIB_SUFFIX)
endif()
-SET(CPP_DEFS ) # C pre-process, not C++
+SET(CPP_DEFS ) # C pre-processor, not C++
SET(INC_PATHS )
SET(C_FLAGS )
SET(LINKER_FLAGS )
@@ -102,35 +114,27 @@ IF(NOT LIBTYPE)
ENDIF()
SET(LIB_MAJOR_VERSION "1")
-SET(LIB_MINOR_VERSION "19")
-SET(LIB_REVISION "1")
+SET(LIB_MINOR_VERSION "20")
+SET(LIB_REVISION "0")
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
+SET(LIB_VERSION_NUM ${LIB_MAJOR_VERSION},${LIB_MINOR_VERSION},${LIB_REVISION},0)
SET(EXPORT_DECL "")
-SET(ALIGN_DECL "")
IF(OPENAL_CUSTOM_CONFIG)
include(${OPENAL_CUSTOM_CONFIG})
ENDIF()
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
-CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
-CHECK_C_COMPILER_FLAG(-std=c11 HAVE_STD_C11)
-IF(HAVE_STD_C11)
- SET(CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}")
-ELSE()
- CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
- IF(HAVE_STD_C99)
- SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
- ENDIF()
-ENDIF()
+# Require C++11
+SET(CMAKE_CXX_STANDARD 11)
+SET(CMAKE_CXX_STANDARD_REQUIRED TRUE)
+
+# Prefer C11, but support C99 and C90 too.
+SET(CMAKE_C_STANDARD 11)
-CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD_CXX11)
-IF(HAVE_STD_CXX11)
- SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
-ENDIF()
if(NOT WIN32)
# Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions
@@ -148,74 +152,20 @@ if(NOT WIN32)
UNSET(OLD_REQUIRED_FLAGS)
ENDIF()
-# Set defines for large file support
-CHECK_FILE_OFFSET_BITS()
-IF(_FILE_OFFSET_BITS)
- SET(CPP_DEFS ${CPP_DEFS} "_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
- SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
+# C99 has restrict, but C++ does not, so we can only utilize __restrict.
+SET(RESTRICT_DECL )
+CHECK_CXX_SOURCE_COMPILES("int *__restrict foo;
+int main() { return 0; }" HAVE___RESTRICT)
+IF(HAVE___RESTRICT)
+ SET(RESTRICT_DECL "__restrict")
ENDIF()
-SET(CPP_DEFS ${CPP_DEFS} _LARGEFILE_SOURCE _LARGE_FILES)
-SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES")
-
-# MSVC may need workarounds for C99 restrict and inline
-IF(MSVC)
- # TODO: Once we truly require C99, these restrict and inline checks should go
- # away.
- CHECK_C_SOURCE_COMPILES("int *restrict foo;
- int main() {return 0;}" HAVE_RESTRICT)
- IF(NOT HAVE_RESTRICT)
- SET(CPP_DEFS ${CPP_DEFS} "restrict=")
- SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Drestrict=")
- ENDIF()
-
- CHECK_C_SOURCE_COMPILES("inline void foo(void) { }
- int main() {return 0;}" HAVE_INLINE)
- IF(NOT HAVE_INLINE)
- CHECK_C_SOURCE_COMPILES("__inline void foo(void) { }
- int main() {return 0;}" HAVE___INLINE)
- IF(NOT HAVE___INLINE)
- MESSAGE(FATAL_ERROR "No inline keyword found, please report!")
- ENDIF()
- SET(CPP_DEFS ${CPP_DEFS} inline=__inline)
- SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Dinline=__inline")
- ENDIF()
-ENDIF()
-
-# Make sure we have C99-style inline semantics with GCC (4.3 or newer).
-IF(CMAKE_COMPILER_IS_GNUCC)
- SET(CMAKE_C_FLAGS "-fno-gnu89-inline ${CMAKE_C_FLAGS}")
-
- SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- # Force no inlining for the next test.
- SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -fno-inline")
-
- CHECK_C_SOURCE_COMPILES("extern inline int foo() { return 0; }
- int main() {return foo();}" INLINE_IS_C99)
- IF(NOT INLINE_IS_C99)
- MESSAGE(FATAL_ERROR "Your compiler does not seem to have C99 inline semantics!
- Please update your compiler for better C99 compliance.")
- ENDIF()
-
- SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
-ENDIF()
-
-# Check if we have a proper timespec declaration
-CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
-IF(HAVE_STRUCT_TIMESPEC)
- # Define it here so we don't have to include config.h for it
- SET(CPP_DEFS ${CPP_DEFS} HAVE_STRUCT_TIMESPEC)
-ENDIF()
-
-# Some systems may need libatomic for C11 atomic functions to work
+# Some systems may need libatomic for atomic functions to work
SET(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
SET(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES} atomic)
-CHECK_C_SOURCE_COMPILES("#include <stdatomic.h>
-int _Atomic foo = ATOMIC_VAR_INIT(0);
-int main()
-{
- return atomic_fetch_add(&foo, 2);
-}"
+CHECK_CXX_SOURCE_COMPILES("#include <atomic>
+std::atomic<int> foo{0};
+int main() { return foo.fetch_add(2); }"
HAVE_LIBATOMIC)
IF(NOT HAVE_LIBATOMIC)
SET(CMAKE_REQUIRED_LIBRARIES "${OLD_REQUIRED_LIBRARIES}")
@@ -231,62 +181,13 @@ IF(HAVE_LIBLOG)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} log)
ENDIF()
-# Check if we have C99 bool
-CHECK_C_SOURCE_COMPILES(
-"int main(int argc, char *argv[])
- {
- volatile _Bool ret;
- ret = (argc > 1) ? 1 : 0;
- return ret ? -1 : 0;
- }"
-HAVE_C99_BOOL)
-
-# Check if we have C11 static_assert
-CHECK_C_SOURCE_COMPILES(
-"int main()
- {
- _Static_assert(sizeof(int) == sizeof(int), \"What\");
- return 0;
- }"
-HAVE_C11_STATIC_ASSERT)
-
-# Check if we have C11 alignas
-CHECK_C_SOURCE_COMPILES(
-"_Alignas(16) int foo;
- int main()
- {
- return 0;
- }"
-HAVE_C11_ALIGNAS)
-
-# Check if we have C11 _Atomic
-CHECK_C_SOURCE_COMPILES(
-"#include <stdatomic.h>
- int _Atomic foo = ATOMIC_VAR_INIT(0);
- int main()
- {
- atomic_fetch_add(&foo, 2);
- return 0;
- }"
-HAVE_C11_ATOMIC)
-
-# Add definitions, compiler switches, etc.
-INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_SOURCE_DIR}/common" "${OpenAL_BINARY_DIR}")
-
-IF(NOT CMAKE_BUILD_TYPE)
- SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
- "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
- FORCE)
-ENDIF()
-IF(NOT CMAKE_DEBUG_POSTFIX)
- SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING
- "Library postfix for debug builds. Normally left blank."
- FORCE)
-ENDIF()
-
IF(MSVC)
- SET(CPP_DEFS ${CPP_DEFS} _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
- SET(C_FLAGS ${C_FLAGS} /wd4098)
+ SET(CPP_DEFS ${CPP_DEFS} _CRT_SECURE_NO_WARNINGS NOMINMAX)
+ CHECK_CXX_COMPILER_FLAG(/permissive- HAVE_PERMISSIVE_SWITCH)
+ IF(HAVE_PERMISSIVE_SWITCH)
+ SET(C_FLAGS ${C_FLAGS} $<$<COMPILE_LANGUAGE:CXX>:/permissive->)
+ ENDIF()
+ SET(C_FLAGS ${C_FLAGS} /W4 /w14640 /wd4065 /wd4268 /wd4324)
IF(NOT DXSDK_DIR)
STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
@@ -308,11 +209,9 @@ IF(MSVC)
ENDFOREACH(flag_var)
ENDIF()
ELSE()
- SET(C_FLAGS ${C_FLAGS} -Winline -Wall)
- CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA)
- IF(HAVE_W_EXTRA)
- SET(C_FLAGS ${C_FLAGS} -Wextra)
- ENDIF()
+ SET(C_FLAGS ${C_FLAGS} -Winline -Wunused -Wall -Wextra -Wshadow -Wconversion -Wcast-align
+ -Wpedantic
+ $<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast -Wnon-virtual-dtor -Woverloaded-virtual>)
IF(ALSOFT_WERROR)
SET(C_FLAGS ${C_FLAGS} -Werror)
@@ -331,37 +230,54 @@ ELSE()
SET(C_FLAGS ${C_FLAGS} -fno-math-errno)
ENDIF()
- CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
- int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
-
option(ALSOFT_STATIC_LIBGCC "Force -static-libgcc for static GCC runtimes" OFF)
if(ALSOFT_STATIC_LIBGCC)
set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -static-libgcc)
- check_c_source_compiles(
-"#include <stdlib.h>
-int main()
-{
- return 0;
-}"
- HAVE_STATIC_LIBGCC_SWITCH
- )
- if(HAVE_STATIC_LIBGCC_SWITCH)
- SET(LINKER_FLAGS ${LINKER_FLAGS} -static-libgcc)
+ check_cxx_source_compiles("int main() { }" HAVE_STATIC_LIBGCC_SWITCH)
+ set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
+ unset(OLD_REQUIRED_LIBRARIES)
+
+ if(NOT HAVE_STATIC_LIBGCC_SWITCH)
+ message(FATAL_ERROR "Cannot static link libgcc")
endif()
+ set(LINKER_FLAGS ${LINKER_FLAGS} -static-libgcc)
+ endif()
+
+ option(ALSOFT_STATIC_STDCXX "Static link libstdc++" OFF)
+ if(ALSOFT_STATIC_STDCXX)
+ set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,--push-state,-Bstatic,-lstdc++,--pop-state")
+ check_cxx_source_compiles("int main() { }" HAVE_STATIC_LIBSTDCXX_SWITCH)
set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
unset(OLD_REQUIRED_LIBRARIES)
+
+ if(NOT HAVE_STATIC_LIBSTDCXX_SWITCH)
+ message(FATAL_ERROR "Cannot static link libstdc++")
+ endif()
+ set(LINKER_FLAGS ${LINKER_FLAGS} "-Wl,--push-state,-Bstatic,-lstdc++,--pop-state")
+ endif()
+
+ if(WIN32)
+ option(ALSOFT_STATIC_WINPTHREAD "Static link libwinpthread" OFF)
+ if(ALSOFT_STATIC_WINPTHREAD)
+ set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,--push-state,-Bstatic,-lwinpthread,--pop-state")
+ check_cxx_source_compiles("int main() { }" HAVE_STATIC_LIBWINPTHREAD_SWITCH)
+ set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
+ unset(OLD_REQUIRED_LIBRARIES)
+
+ if(NOT HAVE_STATIC_LIBWINPTHREAD_SWITCH)
+ message(FATAL_ERROR "Cannot static link libwinpthread")
+ endif()
+ set(LINKER_FLAGS ${LINKER_FLAGS} "-Wl,--push-state,-Bstatic,-lwinpthread,--pop-state")
+ endif()
endif()
ENDIF()
# Set visibility/export options if available
IF(WIN32)
SET(EXPORT_DECL "__declspec(dllexport)")
- IF(NOT MINGW)
- SET(ALIGN_DECL "__declspec(align(x))")
- ELSE()
- SET(ALIGN_DECL "__declspec(aligned(x))")
- ENDIF()
ELSE()
SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
# Yes GCC, really don't accept visibility modes you don't support
@@ -386,38 +302,14 @@ ELSE()
ENDIF()
ENDIF()
- CHECK_C_SOURCE_COMPILES("int foo __attribute__((aligned(16)));
- int main() {return 0;}" HAVE_ATTRIBUTE_ALIGNED)
- IF(HAVE_ATTRIBUTE_ALIGNED)
- SET(ALIGN_DECL "__attribute__((aligned(x)))")
- ENDIF()
-
SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
ENDIF()
-CHECK_C_SOURCE_COMPILES("
-int main()
-{
- float *ptr;
- ptr = __builtin_assume_aligned(ptr, 16);
- return 0;
-}" HAVE___BUILTIN_ASSUME_ALIGNED)
-IF(HAVE___BUILTIN_ASSUME_ALIGNED)
- SET(ASSUME_ALIGNED_DECL "__builtin_assume_aligned(x, y)")
-ELSE()
- SET(ASSUME_ALIGNED_DECL "(x)")
-ENDIF()
-
-SET(SSE_SWITCH "")
SET(SSE2_SWITCH "")
SET(SSE3_SWITCH "")
SET(SSE4_1_SWITCH "")
SET(FPU_NEON_SWITCH "")
-CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
-IF(HAVE_MSSE_SWITCH)
- SET(SSE_SWITCH "-msse")
-ENDIF()
CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
IF(HAVE_MSSE2_SWITCH)
SET(SSE2_SWITCH "-msse2")
@@ -435,11 +327,15 @@ IF(HAVE_MFPU_NEON_SWITCH)
SET(FPU_NEON_SWITCH "-mfpu=neon")
ENDIF()
+CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE2_SWITCH}")
+CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
+CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}")
+CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
+CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H "${FPU_NEON_SWITCH}")
+
+SET(SSE_FLAGS )
SET(FPMATH_SET "0")
IF(CMAKE_SIZEOF_VOID_P MATCHES "4")
- IF(SSE_SWITCH OR MSVC)
- OPTION(ALSOFT_ENABLE_SSE_CODEGEN "Enable SSE code generation instead of x87 for 32-bit targets." TRUE)
- ENDIF()
IF(SSE2_SWITCH OR MSVC)
OPTION(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE)
ENDIF()
@@ -448,55 +344,48 @@ IF(CMAKE_SIZEOF_VOID_P MATCHES "4")
IF(SSE2_SWITCH)
CHECK_C_COMPILER_FLAG("${SSE2_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE_2)
IF(HAVE_MFPMATH_SSE_2)
- SET(C_FLAGS ${C_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
+ SET(SSE_FLAGS ${SSE_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
+ SET(C_FLAGS ${C_FLAGS} ${SSE_FLAGS})
SET(FPMATH_SET 2)
ENDIF()
ELSEIF(MSVC)
CHECK_C_COMPILER_FLAG("/arch:SSE2" HAVE_ARCH_SSE2)
IF(HAVE_ARCH_SSE2)
- SET(C_FLAGS ${C_FLAGS} "/arch:SSE2")
+ SET(SSE_FLAGS ${SSE_FLAGS} "/arch:SSE2")
+ SET(C_FLAGS ${C_FLAGS} ${SSE_FLAGS})
SET(FPMATH_SET 2)
ENDIF()
ENDIF()
ENDIF()
- IF(ALSOFT_ENABLE_SSE_CODEGEN AND NOT FPMATH_SET)
- IF(SSE_SWITCH)
- CHECK_C_COMPILER_FLAG("${SSE_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE)
- IF(HAVE_MFPMATH_SSE)
- SET(C_FLAGS ${C_FLAGS} ${SSE_SWITCH} -mfpmath=sse)
- SET(FPMATH_SET 1)
- ENDIF()
- ELSEIF(MSVC)
- CHECK_C_COMPILER_FLAG("/arch:SSE" HAVE_ARCH_SSE)
- IF(HAVE_ARCH_SSE)
- SET(C_FLAGS ${C_FLAGS} "/arch:SSE")
- SET(FPMATH_SET 1)
- ENDIF()
- ENDIF()
- ENDIF()
+ENDIF()
+
+IF(HAVE_EMMINTRIN_H)
+ SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ FOREACH(flag_var ${SSE_FLAGS})
+ SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag_var}")
+ ENDFOREACH()
+
+ CHECK_C_SOURCE_COMPILES("#include <emmintrin.h>
+ int main() {_mm_pause(); return 0;}" HAVE_SSE_INTRINSICS)
+
+ SET(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
ENDIF()
CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2)));
int main() {return 0;}" HAVE_GCC_FORMAT)
-CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
-CHECK_INCLUDE_FILE(stdalign.h HAVE_STDALIGN_H)
CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
-CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
CHECK_INCLUDE_FILE(sys/sysconf.h HAVE_SYS_SYSCONF_H)
-CHECK_INCLUDE_FILE(fenv.h HAVE_FENV_H)
-CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H)
-CHECK_INCLUDE_FILE(ieeefp.h HAVE_IEEEFP_H)
CHECK_INCLUDE_FILE(guiddef.h HAVE_GUIDDEF_H)
IF(NOT HAVE_GUIDDEF_H)
CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
ENDIF()
-# Some systems need libm for some of the following math functions to work
+# Some systems need libm for some math functions to work
SET(MATH_LIB )
CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
IF(HAVE_LIBM)
@@ -504,15 +393,22 @@ IF(HAVE_LIBM)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
ENDIF()
+# Some systems need to link with -lrt for clock_gettime as used by the common
+# eaxmple functions.
+SET(RT_LIB )
+CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
+IF(HAVE_LIBRT)
+ SET(RT_LIB rt)
+ENDIF()
+
# Check for the dlopen API (for dynamicly loading backend libs)
IF(ALSOFT_DLOPEN)
+ CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
IF(HAVE_LIBDL)
SET(EXTRA_LIBS dl ${EXTRA_LIBS})
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
ENDIF()
-
- CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
ENDIF()
# Check for a cpuid intrinsic
@@ -548,105 +444,19 @@ IF(HAVE_INTRIN_H)
}" HAVE_BITSCANFORWARD_INTRINSIC)
ENDIF()
-CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF)
-CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH)
-CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
-CHECK_SYMBOL_EXISTS(modff math.h HAVE_MODFF)
-CHECK_SYMBOL_EXISTS(log2f math.h HAVE_LOG2F)
-CHECK_SYMBOL_EXISTS(cbrtf math.h HAVE_CBRTF)
-CHECK_SYMBOL_EXISTS(copysignf math.h HAVE_COPYSIGNF)
-
-IF(HAVE_FLOAT_H)
- CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
- CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
-ENDIF()
CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
-CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
-CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
-IF(NOT HAVE_STRCASECMP)
- CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
- IF(NOT HAVE__STRICMP)
- MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!")
- ENDIF()
-
- SET(CPP_DEFS ${CPP_DEFS} strcasecmp=_stricmp)
-ENDIF()
-
-CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
-IF(NOT HAVE_STRNCASECMP)
- CHECK_FUNCTION_EXISTS(_strnicmp HAVE__STRNICMP)
- IF(NOT HAVE__STRNICMP)
- MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!")
- ENDIF()
-
- SET(CPP_DEFS ${CPP_DEFS} strncasecmp=_strnicmp)
-ENDIF()
-
-CHECK_SYMBOL_EXISTS(strnlen string.h HAVE_STRNLEN)
-CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
-IF(NOT HAVE_SNPRINTF)
- CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
- IF(NOT HAVE__SNPRINTF)
- MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
- ENDIF()
-
- SET(CPP_DEFS ${CPP_DEFS} snprintf=_snprintf)
-ENDIF()
-CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
-IF(NOT HAVE_ISFINITE)
- CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
- IF(NOT HAVE_FINITE)
- CHECK_FUNCTION_EXISTS(_finite HAVE__FINITE)
- IF(NOT HAVE__FINITE)
- MESSAGE(FATAL_ERROR "No isfinite function found, please report!")
- ENDIF()
- SET(CPP_DEFS ${CPP_DEFS} isfinite=_finite)
- ELSE()
- SET(CPP_DEFS ${CPP_DEFS} isfinite=finite)
- ENDIF()
-ENDIF()
-
-CHECK_SYMBOL_EXISTS(isnan math.h HAVE_ISNAN)
-IF(NOT HAVE_ISNAN)
- CHECK_FUNCTION_EXISTS(_isnan HAVE__ISNAN)
- IF(NOT HAVE__ISNAN)
- MESSAGE(FATAL_ERROR "No isnan function found, please report!")
- ENDIF()
-
- SET(CPP_DEFS ${CPP_DEFS} isnan=_isnan)
-ENDIF()
-
-
-# Check if we have Windows headers
-SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
-SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
-CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
-SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS})
-UNSET(OLD_REQUIRED_DEFINITIONS)
-
-IF(NOT HAVE_WINDOWS_H)
- CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
- IF(NOT HAVE_GETTIMEOFDAY)
- MESSAGE(FATAL_ERROR "No timing function found!")
- ENDIF()
-
- CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
- IF(NOT HAVE_NANOSLEEP)
- MESSAGE(FATAL_ERROR "No sleep function found!")
- ENDIF()
-
- # We need pthreads outside of Windows
+IF(NOT WIN32)
+ # We need pthreads outside of Windows, for semaphores. It's also used to
+ # set the priority and name of threads, when possible.
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
IF(NOT HAVE_PTHREAD_H)
MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
ENDIF()
- # Some systems need pthread_np.h to get recursive mutexes
- CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
IF(NOT HAVE_ANDROID_H)
@@ -667,6 +477,8 @@ IF(NOT HAVE_WINDOWS_H)
CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
+ # Some systems need pthread_np.h to get pthread_setname_np
+ CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
IF(HAVE_PTHREAD_NP_H)
CHECK_SYMBOL_EXISTS(pthread_setname_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SETNAME_NP)
IF(NOT HAVE_PTHREAD_SETNAME_NP)
@@ -693,7 +505,6 @@ int main()
PTHREAD_SETNAME_NP_THREE_PARAMS
)
ENDIF()
- CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
ELSE()
CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
IF(NOT HAVE_PTHREAD_SETNAME_NP)
@@ -718,132 +529,122 @@ int main()
PTHREAD_SETNAME_NP_THREE_PARAMS
)
ENDIF()
- CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
- ENDIF()
-
- CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK)
-
- CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
- IF(HAVE_LIBRT)
- SET(EXTRA_LIBS rt ${EXTRA_LIBS})
ENDIF()
ENDIF()
CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_GETOPT)
-# Check for a 64-bit type
-CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
-IF(NOT HAVE_STDINT_H)
- IF(HAVE_WINDOWS_H)
- CHECK_C_SOURCE_COMPILES("#define _WIN32_WINNT 0x0502
- #include <windows.h>
- __int64 foo;
- int main() {return 0;}" HAVE___INT64)
- ENDIF()
- IF(NOT HAVE___INT64)
- IF(NOT SIZEOF_LONG MATCHES "8")
- IF(NOT SIZEOF_LONG_LONG MATCHES "8")
- MESSAGE(FATAL_ERROR "No 64-bit types found, please report!")
- ENDIF()
- ENDIF()
- ENDIF()
-ENDIF()
-
+# Common sources used by both the OpenAL implementation library and potentially
+# the OpenAL router.
SET(COMMON_OBJS
- common/alcomplex.c
+ common/albyte.h
+ common/alcomplex.cpp
common/alcomplex.h
- common/align.h
- common/almalloc.c
+ common/alexcpt.cpp
+ common/alexcpt.h
+ common/alfstream.cpp
+ common/alfstream.h
+ common/almalloc.cpp
common/almalloc.h
- common/atomic.c
+ common/alnumeric.h
+ common/aloptional.h
+ common/alspan.h
+ common/alstring.cpp
+ common/alstring.h
common/atomic.h
- common/bool.h
+ common/dynload.cpp
+ common/dynload.h
+ common/endiantest.h
+ common/intrusive_ptr.h
common/math_defs.h
- common/rwlock.c
- common/rwlock.h
- common/static_assert.h
- common/threads.c
+ common/opthelpers.h
+ common/pragmadefs.h
+ common/strutils.cpp
+ common/strutils.h
+ common/threads.cpp
common/threads.h
- common/uintmap.c
- common/uintmap.h
+ common/vecmat.h
+ common/vector.h
)
SET(OPENAL_OBJS
- OpenAL32/Include/bs2b.h
- OpenAL32/Include/alMain.h
- OpenAL32/Include/alu.h
-
- OpenAL32/Include/alAuxEffectSlot.h
- OpenAL32/alAuxEffectSlot.c
- OpenAL32/Include/alBuffer.h
- OpenAL32/alBuffer.c
- OpenAL32/Include/alEffect.h
- OpenAL32/alEffect.c
- OpenAL32/Include/alError.h
- OpenAL32/alError.c
- OpenAL32/alExtension.c
- OpenAL32/Include/alFilter.h
- OpenAL32/alFilter.c
- OpenAL32/Include/alListener.h
- OpenAL32/alListener.c
- OpenAL32/Include/alSource.h
- OpenAL32/alSource.c
- OpenAL32/alState.c
- OpenAL32/event.c
- OpenAL32/Include/sample_cvt.h
- OpenAL32/sample_cvt.c
+ al/auxeffectslot.cpp
+ al/auxeffectslot.h
+ al/buffer.cpp
+ al/buffer.h
+ al/effect.cpp
+ al/effect.h
+ al/error.cpp
+ al/event.cpp
+ al/event.h
+ al/extension.cpp
+ al/filter.cpp
+ al/filter.h
+ al/listener.cpp
+ al/listener.h
+ al/source.cpp
+ al/source.h
+ al/state.cpp
)
SET(ALC_OBJS
- Alc/ALc.c
- Alc/ALu.c
- Alc/alconfig.c
- Alc/alconfig.h
- Alc/bs2b.c
- Alc/converter.c
- Alc/converter.h
- Alc/inprogext.h
- Alc/mastering.c
- Alc/mastering.h
- Alc/ringbuffer.c
- Alc/ringbuffer.h
- Alc/effects/autowah.c
- Alc/effects/chorus.c
- Alc/effects/compressor.c
- Alc/effects/dedicated.c
- Alc/effects/distortion.c
- Alc/effects/echo.c
- Alc/effects/equalizer.c
- Alc/effects/fshifter.c
- Alc/effects/modulator.c
- Alc/effects/null.c
- Alc/effects/pshifter.c
- Alc/effects/reverb.c
- Alc/filters/defs.h
- Alc/filters/filter.c
- Alc/filters/nfc.c
- Alc/filters/nfc.h
- Alc/filters/splitter.c
- Alc/filters/splitter.h
- Alc/helpers.c
- Alc/alstring.h
- Alc/compat.h
- Alc/cpu_caps.h
- Alc/fpu_modes.h
- Alc/logging.h
- Alc/vector.h
- Alc/hrtf.c
- Alc/hrtf.h
- Alc/uhjfilter.c
- Alc/uhjfilter.h
- Alc/ambdec.c
- Alc/ambdec.h
- Alc/bformatdec.c
- Alc/bformatdec.h
- Alc/panning.c
- Alc/polymorphism.h
- Alc/mixvoice.c
- Alc/mixer/defs.h
- Alc/mixer/mixer_c.c
+ alc/alc.cpp
+ alc/alcmain.h
+ alc/alu.cpp
+ alc/alu.h
+ alc/alconfig.cpp
+ alc/alconfig.h
+ alc/alcontext.h
+ alc/ambdec.cpp
+ alc/ambdec.h
+ alc/ambidefs.h
+ alc/bformatdec.cpp
+ alc/bformatdec.h
+ alc/bs2b.cpp
+ alc/bs2b.h
+ alc/compat.h
+ alc/converter.cpp
+ alc/converter.h
+ alc/cpu_caps.h
+ alc/devformat.h
+ alc/effects/base.h
+ alc/effects/autowah.cpp
+ alc/effects/chorus.cpp
+ alc/effects/compressor.cpp
+ alc/effects/dedicated.cpp
+ alc/effects/distortion.cpp
+ alc/effects/echo.cpp
+ alc/effects/equalizer.cpp
+ alc/effects/fshifter.cpp
+ alc/effects/modulator.cpp
+ alc/effects/null.cpp
+ alc/effects/pshifter.cpp
+ alc/effects/reverb.cpp
+ alc/effects/vmorpher.cpp
+ alc/filters/biquad.h
+ alc/filters/biquad.cpp
+ alc/filters/nfc.cpp
+ alc/filters/nfc.h
+ alc/filters/splitter.cpp
+ alc/filters/splitter.h
+ alc/fpu_modes.h
+ alc/helpers.cpp
+ alc/hrtf.cpp
+ alc/hrtf.h
+ alc/inprogext.h
+ alc/logging.h
+ alc/mastering.cpp
+ alc/mastering.h
+ alc/panning.cpp
+ alc/ringbuffer.cpp
+ alc/ringbuffer.h
+ alc/uhjfilter.cpp
+ alc/uhjfilter.h
+ alc/uiddefs.cpp
+ alc/voice.cpp
+ alc/voice.h
+ alc/mixer/defs.h
+ alc/mixer/hrtfbase.h
+ alc/mixer/mixer_c.cpp
)
@@ -854,76 +655,41 @@ SET(HAVE_SSE3 0)
SET(HAVE_SSE4_1 0)
SET(HAVE_NEON 0)
-SET(HAVE_ALSA 0)
-SET(HAVE_OSS 0)
-SET(HAVE_SOLARIS 0)
-SET(HAVE_SNDIO 0)
-SET(HAVE_QSA 0)
-SET(HAVE_DSOUND 0)
-SET(HAVE_WASAPI 0)
-SET(HAVE_WINMM 0)
-SET(HAVE_PORTAUDIO 0)
-SET(HAVE_PULSEAUDIO 0)
-SET(HAVE_COREAUDIO 0)
-SET(HAVE_OPENSL 0)
-SET(HAVE_WAVE 0)
-SET(HAVE_SDL2 0)
-
-# Check for SSE support
+# Check for SSE+SSE2 support
OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
-CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}")
-IF(HAVE_XMMINTRIN_H)
+OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
+IF(HAVE_XMMINTRIN_H AND HAVE_EMMINTRIN_H)
OPTION(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
- IF(ALSOFT_CPUEXT_SSE)
- IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
- SET(HAVE_SSE 1)
- SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse.c)
- IF(SSE_SWITCH)
- SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse.c PROPERTIES
- COMPILE_FLAGS "${SSE_SWITCH}")
- ENDIF()
- SET(CPU_EXTS "${CPU_EXTS}, SSE")
+ OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
+ IF(ALSOFT_CPUEXT_SSE AND ALSOFT_CPUEXT_SSE2)
+ SET(HAVE_SSE 1)
+ SET(HAVE_SSE2 1)
+ SET(ALC_OBJS ${ALC_OBJS} alc/mixer/mixer_sse.cpp alc/mixer/mixer_sse2.cpp)
+ IF(SSE2_SWITCH)
+ SET_SOURCE_FILES_PROPERTIES(alc/mixer/mixer_sse.cpp alc/mixer/mixer_sse2.cpp
+ PROPERTIES COMPILE_FLAGS "${SSE2_SWITCH}")
ENDIF()
+ SET(CPU_EXTS "${CPU_EXTS}, SSE, SSE2")
ENDIF()
ENDIF()
IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
MESSAGE(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
ENDIF()
-
-OPTION(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
-CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
-IF(HAVE_EMMINTRIN_H)
- OPTION(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
- IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
- IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
- SET(HAVE_SSE2 1)
- SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse2.c)
- IF(SSE2_SWITCH)
- SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse2.c PROPERTIES
- COMPILE_FLAGS "${SSE2_SWITCH}")
- ENDIF()
- SET(CPU_EXTS "${CPU_EXTS}, SSE2")
- ENDIF()
- ENDIF()
-ENDIF()
IF(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
MESSAGE(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
ENDIF()
OPTION(ALSOFT_REQUIRE_SSE3 "Require SSE3 support" OFF)
-CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}")
IF(HAVE_EMMINTRIN_H)
OPTION(ALSOFT_CPUEXT_SSE3 "Enable SSE3 support" ON)
IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE3)
- IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
- SET(HAVE_SSE3 1)
- SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse3.c)
- IF(SSE2_SWITCH)
- SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse3.c PROPERTIES
- COMPILE_FLAGS "${SSE3_SWITCH}")
- ENDIF()
- SET(CPU_EXTS "${CPU_EXTS}, SSE3")
+ SET(HAVE_SSE3 1)
+ SET(ALC_OBJS ${ALC_OBJS} alc/mixer/mixer_sse3.cpp)
+ IF(SSE2_SWITCH)
+ SET_SOURCE_FILES_PROPERTIES(alc/mixer/mixer_sse3.cpp PROPERTIES
+ COMPILE_FLAGS "${SSE3_SWITCH}")
ENDIF()
+ SET(CPU_EXTS "${CPU_EXTS}, SSE3")
ENDIF()
ENDIF()
IF(ALSOFT_REQUIRE_SSE3 AND NOT HAVE_SSE3)
@@ -931,19 +697,16 @@ IF(ALSOFT_REQUIRE_SSE3 AND NOT HAVE_SSE3)
ENDIF()
OPTION(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
-CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
IF(HAVE_SMMINTRIN_H)
OPTION(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
- IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1)
- IF(ALIGN_DECL OR HAVE_C11_ALIGNAS)
- SET(HAVE_SSE4_1 1)
- SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse41.c)
- IF(SSE4_1_SWITCH)
- SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse41.c PROPERTIES
- COMPILE_FLAGS "${SSE4_1_SWITCH}")
- ENDIF()
- SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
+ IF(HAVE_SSE3 AND ALSOFT_CPUEXT_SSE4_1)
+ SET(HAVE_SSE4_1 1)
+ SET(ALC_OBJS ${ALC_OBJS} alc/mixer/mixer_sse41.cpp)
+ IF(SSE4_1_SWITCH)
+ SET_SOURCE_FILES_PROPERTIES(alc/mixer/mixer_sse41.cpp PROPERTIES
+ COMPILE_FLAGS "${SSE4_1_SWITCH}")
ENDIF()
+ SET(CPU_EXTS "${CPU_EXTS}, SSE4.1")
ENDIF()
ENDIF()
IF(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
@@ -952,14 +715,13 @@ ENDIF()
# Check for ARM Neon support
OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
-CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H ${FPU_NEON_SWITCH})
IF(HAVE_ARM_NEON_H)
OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON)
IF(ALSOFT_CPUEXT_NEON)
SET(HAVE_NEON 1)
- SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_neon.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/mixer/mixer_neon.cpp)
IF(FPU_NEON_SWITCH)
- SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_neon.c PROPERTIES
+ SET_SOURCE_FILES_PROPERTIES(alc/mixer/mixer_neon.cpp PROPERTIES
COMPILE_FLAGS "${FPU_NEON_SWITCH}")
ENDIF()
SET(CPU_EXTS "${CPU_EXTS}, Neon")
@@ -970,6 +732,21 @@ IF(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
ENDIF()
+SET(HAVE_ALSA 0)
+SET(HAVE_OSS 0)
+SET(HAVE_SOLARIS 0)
+SET(HAVE_SNDIO 0)
+SET(HAVE_QSA 0)
+SET(HAVE_DSOUND 0)
+SET(HAVE_WASAPI 0)
+SET(HAVE_WINMM 0)
+SET(HAVE_PORTAUDIO 0)
+SET(HAVE_PULSEAUDIO 0)
+SET(HAVE_COREAUDIO 0)
+SET(HAVE_OPENSL 0)
+SET(HAVE_WAVE 0)
+SET(HAVE_SDL2 0)
+
IF(WIN32 OR HAVE_DLFCN_H)
SET(IS_LINKED "")
MACRO(ADD_BACKEND_LIBS _LIBS)
@@ -983,11 +760,13 @@ ENDIF()
SET(BACKENDS "")
SET(ALC_OBJS ${ALC_OBJS}
- Alc/backends/base.c
- Alc/backends/base.h
+ alc/backends/base.cpp
+ alc/backends/base.h
# Default backends, always available
- Alc/backends/loopback.c
- Alc/backends/null.c
+ alc/backends/loopback.cpp
+ alc/backends/loopback.h
+ alc/backends/null.cpp
+ alc/backends/null.h
)
# Check ALSA backend
@@ -998,7 +777,7 @@ IF(ALSA_FOUND)
IF(ALSOFT_BACKEND_ALSA)
SET(HAVE_ALSA 1)
SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/alsa.cpp alc/backends/alsa.h)
ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
SET(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS})
ENDIF()
@@ -1015,7 +794,7 @@ IF(OSS_FOUND)
IF(ALSOFT_BACKEND_OSS)
SET(HAVE_OSS 1)
SET(BACKENDS "${BACKENDS} OSS,")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/oss.cpp alc/backends/oss.h)
IF(OSS_LIBRARIES)
SET(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS})
ENDIF()
@@ -1034,7 +813,7 @@ IF(AUDIOIO_FOUND)
IF(ALSOFT_BACKEND_SOLARIS)
SET(HAVE_SOLARIS 1)
SET(BACKENDS "${BACKENDS} Solaris,")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/solaris.cpp alc/backends/solaris.h)
SET(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS})
ENDIF()
ENDIF()
@@ -1050,7 +829,7 @@ IF(SOUNDIO_FOUND)
IF(ALSOFT_BACKEND_SNDIO)
SET(HAVE_SNDIO 1)
SET(BACKENDS "${BACKENDS} SndIO (linked),")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/sndio.cpp alc/backends/sndio.h)
SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
SET(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS})
ENDIF()
@@ -1067,7 +846,7 @@ IF(QSA_FOUND)
IF(ALSOFT_BACKEND_QSA)
SET(HAVE_QSA 1)
SET(BACKENDS "${BACKENDS} QSA (linked),")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/qsa.cpp alc/backends/qsa.h)
SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
SET(INC_PATHS ${INC_PATHS} ${QSA_INCLUDE_DIRS})
ENDIF()
@@ -1080,22 +859,30 @@ ENDIF()
OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF)
-IF(HAVE_WINDOWS_H)
+IF(WIN32)
+ SET(WINSDK_LIB_DIRS )
+ SET(WINSDK_INCLUDE_DIRS )
+ FIND_PACKAGE(WindowsSDK)
+ IF(WINDOWSSDK_FOUND)
+ get_windowssdk_library_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_LIB_DIRS)
+ get_windowssdk_include_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_INCLUDE_DIRS)
+ ENDIF()
+
SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502)
# Check MMSystem backend
CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
- IF(HAVE_MMSYSTEM_H)
- CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
- IF(HAVE_LIBWINMM)
- OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
- IF(ALSOFT_BACKEND_WINMM)
- SET(HAVE_WINMM 1)
- SET(BACKENDS "${BACKENDS} WinMM,")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
- SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
- ENDIF()
+ FIND_LIBRARY(WINMM_LIBRARY NAMES winmm
+ PATHS ${WINSDK_LIB_DIRS}
+ PATH_SUFFIXES lib lib/x86 lib/x64)
+ IF(HAVE_MMSYSTEM_H AND WINMM_LIBRARY)
+ OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
+ IF(ALSOFT_BACKEND_WINMM)
+ SET(HAVE_WINMM 1)
+ SET(BACKENDS "${BACKENDS} WinMM,")
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/winmm.cpp alc/backends/winmm.h)
+ SET(EXTRA_LIBS ${WINMM_LIBRARY} ${EXTRA_LIBS})
ENDIF()
ENDIF()
@@ -1106,7 +893,7 @@ IF(HAVE_WINDOWS_H)
IF(ALSOFT_BACKEND_DSOUND)
SET(HAVE_DSOUND 1)
SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h)
ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS})
ENDIF()
@@ -1119,7 +906,7 @@ IF(HAVE_WINDOWS_H)
IF(ALSOFT_BACKEND_WASAPI)
SET(HAVE_WASAPI 1)
SET(BACKENDS "${BACKENDS} WASAPI,")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wasapi.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/wasapi.cpp alc/backends/wasapi.h)
ENDIF()
ENDIF()
@@ -1144,7 +931,7 @@ IF(PORTAUDIO_FOUND)
IF(ALSOFT_BACKEND_PORTAUDIO)
SET(HAVE_PORTAUDIO 1)
SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/portaudio.cpp alc/backends/portaudio.h)
ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
SET(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS})
ENDIF()
@@ -1161,7 +948,7 @@ IF(PULSEAUDIO_FOUND)
IF(ALSOFT_BACKEND_PULSEAUDIO)
SET(HAVE_PULSEAUDIO 1)
SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/pulseaudio.cpp alc/backends/pulseaudio.h)
ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
SET(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS})
ENDIF()
@@ -1178,7 +965,7 @@ IF(JACK_FOUND)
IF(ALSOFT_BACKEND_JACK)
SET(HAVE_JACK 1)
SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/jack.cpp alc/backends/jack.h)
ADD_BACKEND_LIBS(${JACK_LIBRARIES})
SET(INC_PATHS ${INC_PATHS} ${JACK_INCLUDE_DIRS})
ENDIF()
@@ -1190,14 +977,14 @@ ENDIF()
# Check CoreAudio backend
OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
FIND_LIBRARY(COREAUDIO_FRAMEWORK
- NAMES CoreAudio
- PATHS /System/Library/Frameworks
+ NAMES CoreAudio
+ PATHS /System/Library/Frameworks
)
IF(COREAUDIO_FRAMEWORK)
OPTION(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
IF(ALSOFT_BACKEND_COREAUDIO)
SET(HAVE_COREAUDIO 1)
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/coreaudio.cpp alc/backends/coreaudio.h)
SET(BACKENDS "${BACKENDS} CoreAudio,")
SET(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${EXTRA_LIBS})
SET(EXTRA_LIBS /System/Library/Frameworks/AudioUnit.framework ${EXTRA_LIBS})
@@ -1206,11 +993,12 @@ IF(COREAUDIO_FRAMEWORK)
# Some versions of OSX may need the AudioToolbox framework. Add it if
# it's found.
FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY
- NAMES AudioToolbox
- PATHS ~/Library/Frameworks
- /Library/Frameworks
- /System/Library/Frameworks
- )
+ NAMES AudioToolbox
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /System/Library/Frameworks
+ )
IF(AUDIOTOOLBOX_LIBRARY)
SET(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
ENDIF()
@@ -1222,17 +1010,15 @@ ENDIF()
# Check for OpenSL (Android) backend
OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
-CHECK_INCLUDE_FILES("SLES/OpenSLES.h;SLES/OpenSLES_Android.h" HAVE_SLES_OPENSLES_ANDROID_H)
-IF(HAVE_SLES_OPENSLES_ANDROID_H)
- CHECK_SHARED_FUNCTION_EXISTS(slCreateEngine "SLES/OpenSLES.h" OpenSLES "" HAVE_LIBOPENSLES)
- IF(HAVE_LIBOPENSLES)
- OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
- IF(ALSOFT_BACKEND_OPENSL)
- SET(HAVE_OPENSL 1)
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/opensl.c)
- SET(BACKENDS "${BACKENDS} OpenSL,")
- SET(EXTRA_LIBS OpenSLES ${EXTRA_LIBS})
- ENDIF()
+FIND_PACKAGE(OpenSL)
+IF(OPENSL_FOUND)
+ OPTION(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
+ IF(ALSOFT_BACKEND_OPENSL)
+ SET(HAVE_OPENSL 1)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/opensl.cpp alc/backends/opensl.h)
+ SET(BACKENDS "${BACKENDS} OpenSL,")
+ SET(EXTRA_LIBS ${OPENSL_LIBRARIES} ${EXTRA_LIBS})
+ SET(INC_PATHS ${INC_PATHS} ${OPENSL_INCLUDE_DIRS})
ENDIF()
ENDIF()
IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
@@ -1247,7 +1033,7 @@ IF(SDL2_FOUND)
OPTION(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF)
IF(ALSOFT_BACKEND_SDL2)
SET(HAVE_SDL2 1)
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sdl2.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/sdl2.cpp alc/backends/sdl2.h)
SET(BACKENDS "${BACKENDS} SDL2,")
SET(EXTRA_LIBS ${SDL2_LIBRARY} ${EXTRA_LIBS})
SET(INC_PATHS ${INC_PATHS} ${SDL2_INCLUDE_DIR})
@@ -1261,7 +1047,7 @@ ENDIF()
OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON)
IF(ALSOFT_BACKEND_WAVE)
SET(HAVE_WAVE 1)
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c)
+ SET(ALC_OBJS ${ALC_OBJS} alc/backends/wave.cpp alc/backends/wave.h)
SET(BACKENDS "${BACKENDS} WaveFile,")
ENDIF()
@@ -1273,11 +1059,9 @@ FIND_PACKAGE(Git)
IF(GIT_FOUND AND EXISTS "${OpenAL_SOURCE_DIR}/.git")
# Get the current working branch and its latest abbreviated commit hash
ADD_CUSTOM_TARGET(build_version
- ${CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE}
- -D LIB_VERSION=${LIB_VERSION}
- -D SRC=${OpenAL_SOURCE_DIR}/version.h.in
- -D DST=${OpenAL_BINARY_DIR}/version.h
- -P ${OpenAL_SOURCE_DIR}/version.cmake
+ ${CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE} -D LIB_VERSION=${LIB_VERSION}
+ -D LIB_VERSION_NUM=${LIB_VERSION_NUM} -D SRC=${OpenAL_SOURCE_DIR}/version.h.in
+ -D DST=${OpenAL_BINARY_DIR}/version.h -P ${OpenAL_SOURCE_DIR}/version.cmake
WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
VERBATIM
)
@@ -1289,24 +1073,42 @@ ELSE()
"${OpenAL_BINARY_DIR}/version.h")
ENDIF()
-IF(NOT CMAKE_CROSSCOMPILING)
-SET(NATIVE_SRC_DIR "${OpenAL_SOURCE_DIR}/native-tools/")
-SET(NATIVE_BIN_DIR "${OpenAL_BINARY_DIR}/native-tools/")
-FILE(MAKE_DIRECTORY "${NATIVE_BIN_DIR}")
+SET(NATIVE_SRC_DIR "${OpenAL_SOURCE_DIR}/native-tools")
-SET(BIN2H_COMMAND "${NATIVE_BIN_DIR}bin2h")
-SET(BSINCGEN_COMMAND "${NATIVE_BIN_DIR}bsincgen")
-ADD_CUSTOM_COMMAND(OUTPUT "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
- COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "${NATIVE_SRC_DIR}"
- COMMAND ${CMAKE_COMMAND} -E remove "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
- COMMAND ${CMAKE_COMMAND} --build . --config "Release"
- WORKING_DIRECTORY "${NATIVE_BIN_DIR}"
- DEPENDS "${NATIVE_SRC_DIR}CMakeLists.txt"
- IMPLICIT_DEPENDS C "${NATIVE_SRC_DIR}bin2h.c"
- C "${NATIVE_SRC_DIR}bsincgen.c"
- VERBATIM
-)
+SET(ALSOFT_NATIVE_TOOLS_PATH "" CACHE STRING "Path to prebuilt native tools (leave blank to auto-build)")
+IF(ALSOFT_NATIVE_TOOLS_PATH)
+ find_program(BIN2H_NATIVE_COMMAND NAMES bin2h
+ PATHS "${ALSOFT_NATIVE_TOOLS_PATH}"
+ NO_DEFAULT_PATH)
+ find_program(BSINCGEN_NATIVE_COMMAND NAMES bsincgen
+ PATHS "${ALSOFT_NATIVE_TOOLS_PATH}"
+ NO_DEFAULT_PATH)
+ if(NOT BIN2H_NATIVE_COMMAND OR NOT BSINCGEN_NATIVE_COMMAND)
+ message(FATAL_ERROR "Failed to find native tools in ${ALSOFT_NATIVE_TOOLS_PATH}.
+bin2h: ${BIN2H_NATIVE_COMMAND}
+bsincgen: ${BSINCGEN_NATIVE_COMMAND}")
+ endif()
+ SET(BIN2H_COMMAND ${BIN2H_NATIVE_COMMAND})
+ SET(BSINCGEN_COMMAND ${BSINCGEN_NATIVE_COMMAND})
+ELSE()
+ SET(NATIVE_BIN_DIR "${OpenAL_BINARY_DIR}/native-tools")
+ FILE(MAKE_DIRECTORY "${NATIVE_BIN_DIR}")
+
+ SET(BIN2H_COMMAND "${NATIVE_BIN_DIR}/bin2h")
+ SET(BSINCGEN_COMMAND "${NATIVE_BIN_DIR}/bsincgen")
+ ADD_CUSTOM_COMMAND(OUTPUT "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
+ COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "${NATIVE_SRC_DIR}"
+ COMMAND ${CMAKE_COMMAND} -E remove "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
+ COMMAND ${CMAKE_COMMAND} --build . --config "Release"
+ WORKING_DIRECTORY "${NATIVE_BIN_DIR}"
+ DEPENDS "${NATIVE_SRC_DIR}/CMakeLists.txt"
+ IMPLICIT_DEPENDS
+ C "${NATIVE_SRC_DIR}/bin2h.c"
+ C "${NATIVE_SRC_DIR}/bsincgen.c"
+ VERBATIM
+ )
+ENDIF()
ADD_CUSTOM_TARGET(native-tools
DEPENDS "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}"
VERBATIM
@@ -1332,7 +1134,7 @@ endif()
ADD_CUSTOM_COMMAND(OUTPUT "${OpenAL_BINARY_DIR}/bsinc_inc.h"
COMMAND "${BSINCGEN_COMMAND}" "${OpenAL_BINARY_DIR}/bsinc_inc.h"
- DEPENDS native-tools "${NATIVE_SRC_DIR}bsincgen.c"
+ DEPENDS native-tools "${NATIVE_SRC_DIR}/bsincgen.c"
VERBATIM
)
SET(ALC_OBJS ${ALC_OBJS} "${OpenAL_BINARY_DIR}/bsinc_inc.h")
@@ -1394,15 +1196,15 @@ CONFIGURE_FILE(
@ONLY)
-# Add a static library with common functions used by multiple targets
-ADD_LIBRARY(common STATIC ${COMMON_OBJS})
+ADD_LIBRARY(common STATIC EXCLUDE_FROM_ALL ${COMMON_OBJS})
+TARGET_INCLUDE_DIRECTORIES(common PRIVATE ${OpenAL_BINARY_DIR} ${OpenAL_SOURCE_DIR}/include)
TARGET_COMPILE_DEFINITIONS(common PRIVATE ${CPP_DEFS})
TARGET_COMPILE_OPTIONS(common PRIVATE ${C_FLAGS})
+SET_TARGET_PROPERTIES(common PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
UNSET(HAS_ROUTER)
-SET(IMPL_TARGET OpenAL)
-SET(COMMON_LIB )
+SET(IMPL_TARGET OpenAL) # Either OpenAL or soft_oal.
SET(SUBSYS_FLAG )
# Build main library
@@ -1411,13 +1213,9 @@ IF(LIBTYPE STREQUAL "STATIC")
IF(WIN32 AND ALSOFT_NO_UID_DEFS)
SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS)
ENDIF()
- ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
+ ADD_LIBRARY(${IMPL_TARGET} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
+ TARGET_LINK_LIBRARIES(${IMPL_TARGET} PRIVATE ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
ELSE()
- # Make sure to compile the common code with PIC, since it'll be linked into
- # shared libs that needs it.
- SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE)
- SET(COMMON_LIB common)
-
IF(WIN32)
IF(MSVC)
SET(SUBSYS_FLAG ${SUBSYS_FLAG} "/SUBSYSTEM:WINDOWS")
@@ -1426,12 +1224,27 @@ ELSE()
ENDIF()
ENDIF()
+ SET(RC_CONFIG resources/openal32.rc)
IF(WIN32 AND ALSOFT_BUILD_ROUTER)
- ADD_LIBRARY(OpenAL SHARED router/router.c router/router.h router/alc.c router/al.c)
+ ADD_LIBRARY(OpenAL SHARED
+ resources/router.rc
+ router/router.cpp
+ router/router.h
+ router/alc.cpp
+ router/al.cpp
+ )
TARGET_COMPILE_DEFINITIONS(OpenAL
PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
TARGET_COMPILE_OPTIONS(OpenAL PRIVATE ${C_FLAGS})
- TARGET_LINK_LIBRARIES(OpenAL PRIVATE ${LINKER_FLAGS} ${COMMON_LIB})
+ TARGET_LINK_LIBRARIES(OpenAL PRIVATE common ${LINKER_FLAGS})
+ TARGET_INCLUDE_DIRECTORIES(OpenAL
+ PUBLIC
+ $<BUILD_INTERFACE:${OpenAL_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>
+ PRIVATE
+ ${OpenAL_SOURCE_DIR}/common
+ ${OpenAL_BINARY_DIR}
+ )
SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME})
IF(TARGET build_version)
@@ -1441,24 +1254,36 @@ ELSE()
SET(LIBNAME "soft_oal")
SET(IMPL_TARGET soft_oal)
+ SET(RC_CONFIG resources/soft_oal.rc)
ENDIF()
- ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS})
+ ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS} ${RC_CONFIG})
IF(WIN32)
SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "")
ENDIF()
+ TARGET_LINK_LIBRARIES(${IMPL_TARGET} PRIVATE common ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
ENDIF()
+
+TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET}
+ PUBLIC
+ $<BUILD_INTERFACE:${OpenAL_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>
+ PRIVATE
+ ${INC_PATHS}
+ ${OpenAL_BINARY_DIR}
+ ${OpenAL_SOURCE_DIR}
+ ${OpenAL_SOURCE_DIR}/alc
+ ${OpenAL_SOURCE_DIR}/common
+)
+
SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME}
VERSION ${LIB_VERSION}
SOVERSION ${LIB_MAJOR_VERSION}
)
TARGET_COMPILE_DEFINITIONS(${IMPL_TARGET}
PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
-TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET}
- PRIVATE "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc" ${INC_PATHS})
TARGET_COMPILE_OPTIONS(${IMPL_TARGET} PRIVATE ${C_FLAGS})
-TARGET_LINK_LIBRARIES(${IMPL_TARGET}
- PRIVATE ${LINKER_FLAGS} ${COMMON_LIB} ${EXTRA_LIBS} ${MATH_LIB})
+
IF(TARGET build_version)
ADD_DEPENDENCIES(${IMPL_TARGET} build_version)
ENDIF()
@@ -1475,8 +1300,8 @@ IF(WIN32 AND MINGW AND ALSOFT_BUILD_IMPORT_LIB AND NOT LIBTYPE STREQUAL "STATIC"
MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation")
ENDIF()
ELSE()
- SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS
- " -Wl,--output-def,OpenAL32.def")
+ SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,--output-def,OpenAL32.def")
ADD_CUSTOM_COMMAND(TARGET OpenAL POST_BUILD
COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def
COMMAND "${DLLTOOL_EXECUTABLE}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll
@@ -1488,32 +1313,30 @@ ENDIF()
IF(ALSOFT_INSTALL)
INSTALL(TARGETS OpenAL EXPORT OpenAL
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL
- )
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL)
EXPORT(TARGETS OpenAL
- NAMESPACE OpenAL::
- FILE OpenALConfig.cmake)
+ NAMESPACE OpenAL::
+ FILE OpenALConfig.cmake)
INSTALL(EXPORT OpenAL
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL
- NAMESPACE OpenAL::
- FILE OpenALConfig.cmake)
- INSTALL(FILES include/AL/al.h
- include/AL/alc.h
- include/AL/alext.h
- include/AL/efx.h
- include/AL/efx-creative.h
- include/AL/efx-presets.h
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/AL
- )
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL
+ NAMESPACE OpenAL::
+ FILE OpenALConfig.cmake)
+ INSTALL(FILES
+ include/AL/al.h
+ include/AL/alc.h
+ include/AL/alext.h
+ include/AL/efx.h
+ include/AL/efx-creative.h
+ include/AL/efx-presets.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/AL)
INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
IF(TARGET soft_oal)
INSTALL(TARGETS soft_oal
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- )
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
ENDIF()
ENDIF()
@@ -1535,14 +1358,6 @@ IF(FPMATH_SET)
MESSAGE(STATUS "")
ENDIF()
-IF(WIN32)
- IF(NOT HAVE_DSOUND)
- MESSAGE(STATUS "WARNING: Building the Windows version without DirectSound output")
- MESSAGE(STATUS " This is probably NOT what you want!")
- MESSAGE(STATUS "")
- ENDIF()
-ENDIF()
-
if(ALSOFT_EMBED_HRTF_DATA)
message(STATUS "Embedding HRTF datasets")
message(STATUS "")
@@ -1551,59 +1366,76 @@ endif()
# Install alsoft.conf configuration file
IF(ALSOFT_CONFIG)
INSTALL(FILES alsoftrc.sample
- DESTINATION ${CMAKE_INSTALL_DATADIR}/openal
- )
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/openal)
MESSAGE(STATUS "Installing sample configuration")
MESSAGE(STATUS "")
ENDIF()
# Install HRTF definitions
IF(ALSOFT_HRTF_DEFS)
- INSTALL(FILES hrtf/default-44100.mhr
- hrtf/default-48000.mhr
- DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/hrtf
- )
+ INSTALL(FILES hrtf/default-44100.mhr hrtf/default-48000.mhr
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/hrtf)
MESSAGE(STATUS "Installing HRTF definitions")
MESSAGE(STATUS "")
ENDIF()
# Install AmbDec presets
IF(ALSOFT_AMBDEC_PRESETS)
- INSTALL(FILES presets/3D7.1.ambdec
- presets/hexagon.ambdec
- presets/itu5.1.ambdec
- presets/itu5.1-nocenter.ambdec
- presets/rectangle.ambdec
- presets/square.ambdec
- presets/presets.txt
- DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/presets
- )
+ INSTALL(FILES
+ presets/3D7.1.ambdec
+ presets/hexagon.ambdec
+ presets/itu5.1.ambdec
+ presets/itu5.1-nocenter.ambdec
+ presets/rectangle.ambdec
+ presets/square.ambdec
+ presets/presets.txt
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/openal/presets)
MESSAGE(STATUS "Installing AmbDec presets")
MESSAGE(STATUS "")
ENDIF()
IF(ALSOFT_UTILS)
+ set(UTIL_TARGETS )
+
ADD_EXECUTABLE(openal-info utils/openal-info.c)
+ TARGET_INCLUDE_DIRECTORIES(openal-info PRIVATE ${OpenAL_SOURCE_DIR}/common)
TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL)
-
- SET(MAKEHRTF_SRCS utils/makehrtf.c)
- IF(NOT HAVE_GETOPT)
- SET(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c utils/getopt.h)
- ENDIF()
- ADD_EXECUTABLE(makehrtf ${MAKEHRTF_SRCS})
- TARGET_COMPILE_DEFINITIONS(makehrtf PRIVATE ${CPP_DEFS})
- TARGET_COMPILE_OPTIONS(makehrtf PRIVATE ${C_FLAGS})
- IF(HAVE_LIBM)
- TARGET_LINK_LIBRARIES(makehrtf PRIVATE ${LINKER_FLAGS} m)
- ENDIF()
+ set(UTIL_TARGETS ${UTIL_TARGETS} openal-info)
+
+ find_package(MySOFA)
+ if(MYSOFA_FOUND)
+ set(MAKEMHR_SRCS
+ utils/makemhr/loaddef.cpp
+ utils/makemhr/loaddef.h
+ utils/makemhr/loadsofa.cpp
+ utils/makemhr/loadsofa.h
+ utils/makemhr/makemhr.cpp
+ utils/makemhr/makemhr.h)
+ if(NOT HAVE_GETOPT)
+ set(MAKEMHR_SRCS ${MAKEMHR_SRCS} utils/getopt.c utils/getopt.h)
+ endif()
+ add_executable(makemhr ${MAKEMHR_SRCS})
+ target_compile_definitions(makemhr PRIVATE ${CPP_DEFS})
+ target_include_directories(makemhr
+ PRIVATE ${OpenAL_SOURCE_DIR}/common ${OpenAL_BINARY_DIR})
+ target_compile_options(makemhr PRIVATE ${C_FLAGS})
+ target_link_libraries(makemhr PRIVATE common ${LINKER_FLAGS} MySOFA::MySOFA)
+ set(UTIL_TARGETS ${UTIL_TARGETS} makemhr)
+
+ set(SOFAINFO_SRCS utils/sofa-info.cpp)
+ add_executable(sofa-info ${SOFAINFO_SRCS})
+ target_compile_definitions(sofa-info PRIVATE ${CPP_DEFS})
+ target_include_directories(sofa-info PRIVATE ${OpenAL_SOURCE_DIR}/common)
+ target_compile_options(sofa-info PRIVATE ${C_FLAGS})
+ target_link_libraries(sofa-info PRIVATE ${LINKER_FLAGS} MySOFA::MySOFA)
+ endif()
IF(ALSOFT_INSTALL)
- INSTALL(TARGETS openal-info makehrtf
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- )
+ INSTALL(TARGETS ${UTIL_TARGETS}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF()
MESSAGE(STATUS "Building utility programs")
@@ -1613,20 +1445,28 @@ IF(ALSOFT_UTILS)
MESSAGE(STATUS "")
ENDIF()
-IF(ALSOFT_TESTS)
- SET(TEST_COMMON_OBJS examples/common/alhelpers.c)
- ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS})
+# Add a static library with common functions used by multiple example targets
+ADD_LIBRARY(ex-common STATIC EXCLUDE_FROM_ALL
+ examples/common/alhelpers.c
+ examples/common/alhelpers.h)
+TARGET_COMPILE_DEFINITIONS(ex-common PUBLIC ${CPP_DEFS})
+TARGET_INCLUDE_DIRECTORIES(ex-common PUBLIC ${OpenAL_SOURCE_DIR}/common)
+TARGET_COMPILE_OPTIONS(ex-common PUBLIC ${C_FLAGS})
+TARGET_LINK_LIBRARIES(ex-common PUBLIC OpenAL PRIVATE ${RT_LIB})
+
+IF(ALSOFT_TESTS)
+ ADD_EXECUTABLE(altonegen examples/altonegen.c)
TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS})
+ TARGET_INCLUDE_DIRECTORIES(altonegen PRIVATE ${OpenAL_SOURCE_DIR}/common)
TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS})
- TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB})
+ TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} ${MATH_LIB} ex-common)
IF(ALSOFT_INSTALL)
INSTALL(TARGETS altonegen
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- )
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF()
MESSAGE(STATUS "Building test programs")
@@ -1635,96 +1475,67 @@ ENDIF()
IF(ALSOFT_EXAMPLES)
ADD_EXECUTABLE(alrecord examples/alrecord.c)
- TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS})
- TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS})
- TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL)
+ TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} ex-common)
IF(ALSOFT_INSTALL)
INSTALL(TARGETS alrecord
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- )
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF()
MESSAGE(STATUS "Building example programs")
IF(SDL2_FOUND)
IF(SDL_SOUND_FOUND)
- # Add a static library with common functions used by multiple targets
- ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c)
- TARGET_COMPILE_DEFINITIONS(ex-common PRIVATE ${CPP_DEFS})
- TARGET_COMPILE_OPTIONS(ex-common PRIVATE ${C_FLAGS})
-
ADD_EXECUTABLE(alplay examples/alplay.c)
- TARGET_COMPILE_DEFINITIONS(alplay PRIVATE ${CPP_DEFS})
TARGET_INCLUDE_DIRECTORIES(alplay
PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
- TARGET_COMPILE_OPTIONS(alplay PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(alplay
- PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
- OpenAL)
+ PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common)
ADD_EXECUTABLE(alstream examples/alstream.c)
- TARGET_COMPILE_DEFINITIONS(alstream PRIVATE ${CPP_DEFS})
TARGET_INCLUDE_DIRECTORIES(alstream
PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
- TARGET_COMPILE_OPTIONS(alstream PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(alstream
- PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
- OpenAL)
+ PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common)
ADD_EXECUTABLE(alreverb examples/alreverb.c)
- TARGET_COMPILE_DEFINITIONS(alreverb PRIVATE ${CPP_DEFS})
TARGET_INCLUDE_DIRECTORIES(alreverb
PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
- TARGET_COMPILE_OPTIONS(alreverb PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(alreverb
- PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
- OpenAL)
+ PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common)
ADD_EXECUTABLE(almultireverb examples/almultireverb.c)
- TARGET_COMPILE_DEFINITIONS(almultireverb PRIVATE ${CPP_DEFS})
TARGET_INCLUDE_DIRECTORIES(almultireverb
PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
- TARGET_COMPILE_OPTIONS(almultireverb PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(almultireverb
- PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
- OpenAL ${MATH_LIB})
+ PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common
+ ${MATH_LIB})
ADD_EXECUTABLE(allatency examples/allatency.c)
- TARGET_COMPILE_DEFINITIONS(allatency PRIVATE ${CPP_DEFS})
TARGET_INCLUDE_DIRECTORIES(allatency
PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
- TARGET_COMPILE_OPTIONS(allatency PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(allatency
- PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
- OpenAL)
+ PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common)
ADD_EXECUTABLE(alloopback examples/alloopback.c)
- TARGET_COMPILE_DEFINITIONS(alloopback PRIVATE ${CPP_DEFS})
TARGET_INCLUDE_DIRECTORIES(alloopback
PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
- TARGET_COMPILE_OPTIONS(alloopback PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(alloopback
- PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
- OpenAL ${MATH_LIB})
+ PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common ${MATH_LIB})
ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
- TARGET_COMPILE_DEFINITIONS(alhrtf PRIVATE ${CPP_DEFS})
TARGET_INCLUDE_DIRECTORIES(alhrtf
PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
- TARGET_COMPILE_OPTIONS(alhrtf PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(alhrtf
- PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common
- OpenAL ${MATH_LIB})
+ PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common ${MATH_LIB})
IF(ALSOFT_INSTALL)
INSTALL(TARGETS alplay alstream alreverb almultireverb allatency alloopback alhrtf
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- )
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF()
MESSAGE(STATUS "Building SDL_sound example programs")
@@ -1756,20 +1567,16 @@ IF(ALSOFT_EXAMPLES)
ENDIF()
IF(FFVER_OK)
ADD_EXECUTABLE(alffplay examples/alffplay.cpp)
- TARGET_COMPILE_DEFINITIONS(alffplay PRIVATE ${CPP_DEFS})
TARGET_INCLUDE_DIRECTORIES(alffplay
PRIVATE ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
- TARGET_COMPILE_OPTIONS(alffplay PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(alffplay
- PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} ex-common common
- OpenAL)
+ PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} ex-common)
IF(ALSOFT_INSTALL)
INSTALL(TARGETS alffplay
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- )
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF()
MESSAGE(STATUS "Building SDL+FFmpeg example programs")
ENDIF()