2007-11-13 18:02:18 -08:00
|
|
|
# CMake build file list for OpenAL
|
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
cmake_minimum_required(VERSION 3.0.2)
|
|
|
|
|
2020-08-24 14:26:47 -07:00
|
|
|
# The workaround for try_compile failing with code signing
|
2020-08-24 14:09:02 -07:00
|
|
|
# since cmake-3.18.2, not required
|
|
|
|
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
|
|
|
|
"CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED"
|
|
|
|
"CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED")
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
|
|
|
|
|
2020-08-24 14:26:47 -07:00
|
|
|
# Fix compile failure with armv7 deployment target >= 11.0, xcode clang will
|
|
|
|
# report:
|
|
|
|
# error: invalid iOS deployment version '--target=armv7-apple-ios13.6',
|
|
|
|
# iOS 10 is the maximum deployment target for 32-bit targets
|
|
|
|
# If CMAKE_OSX_DEPLOYMENT_TARGET is not defined, cmake will choose latest
|
|
|
|
# deployment target
|
2020-08-24 14:09:02 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
|
|
|
if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*armv7.*")
|
2020-08-24 14:26:47 -07:00
|
|
|
if(NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET
|
|
|
|
OR NOT CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "11.0")
|
|
|
|
message(STATUS "Forcing iOS deployment target to 10.0 for armv7")
|
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.0" CACHE STRING "Minimum OS X deployment version"
|
|
|
|
FORCE)
|
2020-08-24 14:09:02 -07:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
project(OpenAL)
|
|
|
|
|
|
|
|
if(COMMAND CMAKE_POLICY)
|
|
|
|
cmake_policy(SET CMP0003 NEW)
|
|
|
|
cmake_policy(SET CMP0005 NEW)
|
|
|
|
if(POLICY CMP0020)
|
|
|
|
cmake_policy(SET CMP0020 NEW)
|
|
|
|
endif(POLICY CMP0020)
|
|
|
|
if(POLICY CMP0042)
|
|
|
|
cmake_policy(SET CMP0042 NEW)
|
|
|
|
endif(POLICY CMP0042)
|
|
|
|
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
|
2019-09-18 08:58:36 -07:00
|
|
|
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
|
|
|
|
FORCE)
|
2020-06-11 07:46:59 -07:00
|
|
|
endif()
|
|
|
|
if(NOT CMAKE_DEBUG_POSTFIX)
|
|
|
|
set(CMAKE_DEBUG_POSTFIX "" CACHE STRING
|
2019-09-18 08:58:36 -07:00
|
|
|
"Library postfix for debug builds. Normally left blank."
|
|
|
|
FORCE)
|
2020-06-11 07:46:59 -07:00
|
|
|
endif()
|
2019-09-18 08:58:36 -07:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
set(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
|
2009-12-09 08:46:35 -08:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
include(CheckFunctionExists)
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
include(CheckCXXSourceCompiles)
|
2016-10-04 17:19:47 -07:00
|
|
|
include(CheckStructHasMember)
|
2016-09-06 21:35:34 +02:00
|
|
|
include(GNUInstallDirs)
|
2007-11-13 18:02:18 -08:00
|
|
|
|
|
|
|
|
2020-04-19 00:50:12 -07:00
|
|
|
option(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON)
|
2014-08-10 19:40:29 -07:00
|
|
|
|
2020-04-19 00:50:12 -07:00
|
|
|
option(ALSOFT_WERROR "Treat compile warnings as errors" OFF)
|
2014-08-10 19:40:29 -07:00
|
|
|
|
2020-04-19 00:50:12 -07:00
|
|
|
option(ALSOFT_UTILS "Build utility programs" ON)
|
|
|
|
option(ALSOFT_NO_CONFIG_UTIL "Disable building the alsoft-config utility" OFF)
|
2014-08-10 19:40:29 -07:00
|
|
|
|
2020-04-19 00:50:12 -07:00
|
|
|
option(ALSOFT_EXAMPLES "Build example programs" ON)
|
2014-08-10 19:40:29 -07:00
|
|
|
|
2020-05-07 00:02:23 -07:00
|
|
|
option(ALSOFT_INSTALL "Install main library" ON)
|
2020-04-19 00:50:12 -07:00
|
|
|
option(ALSOFT_INSTALL_CONFIG "Install alsoft.conf sample configuration file" ON)
|
2020-08-13 18:04:09 -07:00
|
|
|
option(ALSOFT_INSTALL_HRTF_DATA "Install HRTF data files" ON)
|
2020-04-19 00:50:12 -07:00
|
|
|
option(ALSOFT_INSTALL_AMBDEC_PRESETS "Install AmbDec preset files" ON)
|
|
|
|
option(ALSOFT_INSTALL_EXAMPLES "Install example programs (alplay, alstream, ...)" ON)
|
|
|
|
option(ALSOFT_INSTALL_UTILS "Install utility programs (openal-info, alsoft-config, ...)" ON)
|
|
|
|
option(ALSOFT_UPDATE_BUILD_VERSION "Update git build version info" ON)
|
2014-08-10 19:40:29 -07:00
|
|
|
|
2016-09-06 21:35:34 +02:00
|
|
|
if(DEFINED SHARE_INSTALL_DIR)
|
|
|
|
message(WARNING "SHARE_INSTALL_DIR is deprecated. Use the variables provided by the GNUInstallDirs module instead")
|
|
|
|
set(CMAKE_INSTALL_DATADIR "${SHARE_INSTALL_DIR}")
|
|
|
|
endif()
|
2014-08-10 19:40:29 -07:00
|
|
|
|
2016-09-06 21:35:34 +02:00
|
|
|
if(DEFINED LIB_SUFFIX)
|
|
|
|
message(WARNING "LIB_SUFFIX is deprecated. Use the variables provided by the GNUInstallDirs module instead")
|
|
|
|
endif()
|
2020-04-19 00:50:12 -07:00
|
|
|
if(DEFINED ALSOFT_CONFIG)
|
|
|
|
message(WARNING "ALSOFT_CONFIG is deprecated. Use ALSOFT_INSTALL_CONFIG instead")
|
|
|
|
endif()
|
|
|
|
if(DEFINED ALSOFT_HRTF_DEFS)
|
2020-08-13 18:04:09 -07:00
|
|
|
message(WARNING "ALSOFT_HRTF_DEFS is deprecated. Use ALSOFT_INSTALL_HRTF_DATA instead")
|
2020-04-19 00:50:12 -07:00
|
|
|
endif()
|
|
|
|
if(DEFINED ALSOFT_AMBDEC_PRESETS)
|
|
|
|
message(WARNING "ALSOFT_AMBDEC_PRESETS is deprecated. Use ALSOFT_INSTALL_AMBDEC_PRESETS instead")
|
|
|
|
endif()
|
2015-12-19 17:47:07 +01:00
|
|
|
|
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
set(CPP_DEFS ) # C pre-processor, not C++
|
|
|
|
set(INC_PATHS )
|
|
|
|
set(C_FLAGS )
|
|
|
|
set(LINKER_FLAGS )
|
|
|
|
set(EXTRA_LIBS )
|
2017-12-15 12:25:50 -08:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
if(WIN32)
|
|
|
|
set(CPP_DEFS ${CPP_DEFS} _WIN32)
|
2014-08-10 19:40:29 -07:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
option(ALSOFT_BUILD_ROUTER "Build the router (EXPERIMENTAL; creates OpenAL32.dll and soft_oal.dll)" OFF)
|
|
|
|
if(MINGW)
|
|
|
|
option(ALSOFT_BUILD_IMPORT_LIB "Build an import .lib using dlltool (requires sed)" ON)
|
|
|
|
endif()
|
2020-08-24 14:09:02 -07:00
|
|
|
elseif(APPLE)
|
|
|
|
option(ALSOFT_OSX_FRAMEWORK "Build as macOS framework" OFF)
|
2020-06-11 07:46:59 -07:00
|
|
|
endif()
|
2014-08-05 05:05:05 -07:00
|
|
|
|
2014-04-19 01:02:36 -07:00
|
|
|
|
2013-03-14 01:29:20 -07:00
|
|
|
# QNX's gcc do not uses /usr/include and /usr/lib pathes by default
|
2020-06-11 07:46:59 -07:00
|
|
|
if("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
|
|
|
|
set(INC_PATHS ${INC_PATHS} /usr/include)
|
|
|
|
set(LINKER_FLAGS ${LINKER_FLAGS} -L/usr/lib)
|
|
|
|
endif()
|
2013-03-14 01:29:20 -07:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
if(NOT LIBTYPE)
|
|
|
|
set(LIBTYPE SHARED)
|
|
|
|
endif()
|
2010-11-28 16:19:11 -08:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
set(LIB_MAJOR_VERSION "1")
|
|
|
|
set(LIB_MINOR_VERSION "20")
|
|
|
|
set(LIB_REVISION "1")
|
|
|
|
set(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
|
|
|
|
set(LIB_VERSION_NUM ${LIB_MAJOR_VERSION},${LIB_MINOR_VERSION},${LIB_REVISION},0)
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
set(EXPORT_DECL "")
|
2011-05-17 09:13:55 -07:00
|
|
|
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2020-03-22 08:05:22 -07:00
|
|
|
# Require C++14
|
2020-06-11 07:46:59 -07:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
2019-07-27 18:58:19 -07:00
|
|
|
|
|
|
|
# Prefer C11, but support C99 and C90 too.
|
2020-06-11 07:46:59 -07:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
2013-10-03 05:45:12 -07:00
|
|
|
|
2015-12-11 09:41:46 -08:00
|
|
|
if(NOT WIN32)
|
2016-01-21 06:08:18 -08:00
|
|
|
# Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions
|
2020-06-11 07:46:59 -07:00
|
|
|
check_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_DEFAULT)
|
|
|
|
if(NOT HAVE_POSIX_MEMALIGN_DEFAULT)
|
|
|
|
set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600")
|
|
|
|
check_symbol_exists(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_POSIX)
|
|
|
|
if(NOT HAVE_POSIX_MEMALIGN_POSIX)
|
|
|
|
set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
|
|
|
|
else()
|
|
|
|
set(CPP_DEFS ${CPP_DEFS} _POSIX_C_SOURCE=200112L _XOPEN_SOURCE=600)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
unset(OLD_REQUIRED_FLAGS)
|
|
|
|
endif()
|
2015-12-04 18:52:46 -08:00
|
|
|
|
2018-10-27 18:58:58 -07:00
|
|
|
# C99 has restrict, but C++ does not, so we can only utilize __restrict.
|
2020-06-11 07:46:59 -07:00
|
|
|
set(RESTRICT_DECL )
|
|
|
|
check_cxx_source_compiles("int *__restrict foo;
|
2019-09-18 08:58:36 -07:00
|
|
|
int main() { return 0; }" HAVE___RESTRICT)
|
2020-06-11 07:46:59 -07:00
|
|
|
if(HAVE___RESTRICT)
|
|
|
|
set(RESTRICT_DECL "__restrict")
|
|
|
|
endif()
|
2018-10-27 18:58:58 -07:00
|
|
|
|
2019-09-18 08:58:36 -07:00
|
|
|
# Some systems may need libatomic for atomic functions to work
|
2020-06-11 07:46:59 -07:00
|
|
|
set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES} atomic)
|
|
|
|
check_cxx_source_compiles("#include <atomic>
|
2019-09-18 08:58:36 -07:00
|
|
|
std::atomic<int> foo{0};
|
|
|
|
int main() { return foo.fetch_add(2); }"
|
2016-09-13 12:11:52 -07:00
|
|
|
HAVE_LIBATOMIC)
|
2020-06-11 07:46:59 -07:00
|
|
|
if(NOT HAVE_LIBATOMIC)
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES "${OLD_REQUIRED_LIBRARIES}")
|
|
|
|
else()
|
|
|
|
set(EXTRA_LIBS atomic ${EXTRA_LIBS})
|
|
|
|
endif()
|
|
|
|
unset(OLD_REQUIRED_LIBRARIES)
|
2016-09-12 12:42:11 -07:00
|
|
|
|
2017-01-26 18:05:34 -08:00
|
|
|
# Include liblog for Android logging
|
2020-06-11 07:46:59 -07:00
|
|
|
check_library_exists(log __android_log_print "" HAVE_LIBLOG)
|
|
|
|
if(HAVE_LIBLOG)
|
|
|
|
set(EXTRA_LIBS log ${EXTRA_LIBS})
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} log)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
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 /wd5030)
|
|
|
|
|
|
|
|
if(NOT DXSDK_DIR)
|
|
|
|
string(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}")
|
|
|
|
else()
|
|
|
|
string(REGEX REPLACE "\\\\" "/" DXSDK_DIR "${DXSDK_DIR}")
|
|
|
|
endif()
|
|
|
|
if(DXSDK_DIR)
|
|
|
|
message(STATUS "Using DirectX SDK directory: ${DXSDK_DIR}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
|
|
|
|
if(FORCE_STATIC_VCRT)
|
|
|
|
foreach(flag_var
|
2011-02-08 00:34:25 -08:00
|
|
|
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
2020-01-26 05:36:30 +07:00
|
|
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
|
|
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
|
|
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
2020-06-11 07:46:59 -07:00
|
|
|
if(${flag_var} MATCHES "/MD")
|
|
|
|
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
|
|
|
endif()
|
|
|
|
endforeach(flag_var)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(C_FLAGS ${C_FLAGS} -Winline -Wunused -Wall -Wextra -Wshadow -Wconversion -Wcast-align
|
2019-09-18 12:16:08 -07:00
|
|
|
-Wpedantic
|
2019-09-14 18:27:57 -07:00
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast -Wnon-virtual-dtor -Woverloaded-virtual>)
|
2007-12-06 21:50:28 -08:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
if(ALSOFT_WERROR)
|
|
|
|
set(C_FLAGS ${C_FLAGS} -Werror)
|
|
|
|
endif()
|
2007-12-06 23:57:14 -08:00
|
|
|
|
2014-08-16 19:57:56 -07:00
|
|
|
# We want RelWithDebInfo to actually include debug stuff (define _DEBUG
|
|
|
|
# instead of NDEBUG)
|
2020-06-11 07:46:59 -07:00
|
|
|
foreach(flag_var CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
|
|
|
if(${flag_var} MATCHES "-DNDEBUG")
|
|
|
|
string(REGEX REPLACE "-DNDEBUG" "-D_DEBUG" ${flag_var} "${${flag_var}}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
check_c_compiler_flag(-fno-math-errno HAVE_FNO_MATH_ERRNO)
|
|
|
|
if(HAVE_FNO_MATH_ERRNO)
|
|
|
|
set(C_FLAGS ${C_FLAGS} -fno-math-errno)
|
|
|
|
endif()
|
2017-04-26 18:35:05 -07:00
|
|
|
|
2016-01-17 15:45:42 -08:00
|
|
|
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)
|
2019-09-18 08:58:36 -07:00
|
|
|
check_cxx_source_compiles("int main() { }" HAVE_STATIC_LIBGCC_SWITCH)
|
2016-01-17 15:45:42 -08:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
|
|
|
|
unset(OLD_REQUIRED_LIBRARIES)
|
2018-10-30 09:24:39 -07:00
|
|
|
|
|
|
|
if(NOT HAVE_STATIC_LIBGCC_SWITCH)
|
|
|
|
message(FATAL_ERROR "Cannot static link libgcc")
|
|
|
|
endif()
|
|
|
|
set(LINKER_FLAGS ${LINKER_FLAGS} -static-libgcc)
|
2016-01-17 15:45:42 -08:00
|
|
|
endif()
|
2018-10-29 20:55:45 -07:00
|
|
|
|
2018-10-30 09:24:39 -07:00
|
|
|
option(ALSOFT_STATIC_STDCXX "Static link libstdc++" OFF)
|
2018-10-29 20:55:45 -07:00
|
|
|
if(ALSOFT_STATIC_STDCXX)
|
|
|
|
set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
2018-10-30 09:24:39 -07:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,--push-state,-Bstatic,-lstdc++,--pop-state")
|
2019-09-18 08:58:36 -07:00
|
|
|
check_cxx_source_compiles("int main() { }" HAVE_STATIC_LIBSTDCXX_SWITCH)
|
2018-10-29 20:55:45 -07:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
|
|
|
|
unset(OLD_REQUIRED_LIBRARIES)
|
2018-10-30 09:24:39 -07:00
|
|
|
|
|
|
|
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")
|
2019-09-18 08:58:36 -07:00
|
|
|
check_cxx_source_compiles("int main() { }" HAVE_STATIC_LIBWINPTHREAD_SWITCH)
|
2018-10-30 09:24:39 -07:00
|
|
|
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()
|
2018-10-29 20:55:45 -07:00
|
|
|
endif()
|
2020-06-11 07:46:59 -07:00
|
|
|
endif()
|
2010-11-28 14:27:07 -08:00
|
|
|
|
2011-05-17 09:13:55 -07:00
|
|
|
# Set visibility/export options if available
|
2020-06-10 21:03:04 -07:00
|
|
|
if(WIN32)
|
|
|
|
if(NOT LIBTYPE STREQUAL "STATIC")
|
|
|
|
set(EXPORT_DECL "__declspec(dllexport)")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
2011-09-21 23:41:52 -07:00
|
|
|
# Yes GCC, really don't accept visibility modes you don't support
|
2020-06-10 21:03:04 -07:00
|
|
|
set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Wattributes -Werror")
|
2011-09-20 16:53:05 -07:00
|
|
|
|
2020-06-10 21:03:04 -07:00
|
|
|
check_c_source_compiles("int foo() __attribute__((visibility(\"protected\")));
|
2011-09-20 16:53:05 -07:00
|
|
|
int main() {return 0;}" HAVE_GCC_PROTECTED_VISIBILITY)
|
2020-06-10 21:03:04 -07:00
|
|
|
if(HAVE_GCC_PROTECTED_VISIBILITY)
|
|
|
|
if(NOT LIBTYPE STREQUAL "STATIC")
|
|
|
|
set(EXPORT_DECL "__attribute__((visibility(\"protected\")))")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
check_c_source_compiles("int foo() __attribute__((visibility(\"default\")));
|
2011-09-20 16:53:05 -07:00
|
|
|
int main() {return 0;}" HAVE_GCC_DEFAULT_VISIBILITY)
|
2020-06-10 21:03:04 -07:00
|
|
|
if(HAVE_GCC_DEFAULT_VISIBILITY)
|
|
|
|
if(NOT LIBTYPE STREQUAL "STATIC")
|
|
|
|
set(EXPORT_DECL "__attribute__((visibility(\"default\")))")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2011-09-20 16:53:05 -07:00
|
|
|
|
2020-06-10 21:03:04 -07:00
|
|
|
if(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY)
|
|
|
|
check_c_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
|
|
|
|
if(HAVE_VISIBILITY_HIDDEN_SWITCH)
|
|
|
|
set(C_FLAGS ${C_FLAGS} -fvisibility=hidden)
|
|
|
|
endif()
|
|
|
|
endif()
|
2011-09-20 16:53:05 -07:00
|
|
|
|
2020-06-10 21:03:04 -07:00
|
|
|
set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
|
|
|
|
endif()
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2012-08-15 01:46:42 -07:00
|
|
|
|
2020-04-19 02:47:11 -07:00
|
|
|
set(SSE2_SWITCH "")
|
|
|
|
set(SSE3_SWITCH "")
|
|
|
|
set(SSE4_1_SWITCH "")
|
|
|
|
set(FPU_NEON_SWITCH "")
|
|
|
|
|
|
|
|
set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
|
|
|
if(NOT MSVC)
|
|
|
|
# Yes GCC, really don't accept command line options you don't support
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Werror")
|
|
|
|
endif()
|
|
|
|
check_c_compiler_flag(-msse2 HAVE_MSSE2_SWITCH)
|
|
|
|
if(HAVE_MSSE2_SWITCH)
|
|
|
|
set(SSE2_SWITCH "-msse2")
|
|
|
|
check_c_compiler_flag(-msse3 HAVE_MSSE3_SWITCH)
|
|
|
|
if(HAVE_MSSE3_SWITCH)
|
|
|
|
set(SSE3_SWITCH "-msse3")
|
|
|
|
check_c_compiler_flag(-msse4.1 HAVE_MSSE4_1_SWITCH)
|
|
|
|
if(HAVE_MSSE4_1_SWITCH)
|
|
|
|
set(SSE4_1_SWITCH "-msse4.1")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
check_c_compiler_flag(-mfpu=neon HAVE_MFPU_NEON_SWITCH)
|
|
|
|
if(HAVE_MFPU_NEON_SWITCH)
|
|
|
|
set(FPU_NEON_SWITCH "-mfpu=neon")
|
|
|
|
endif()
|
|
|
|
set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
|
|
|
|
unset(OLD_REQUIRED_FLAGS)
|
|
|
|
|
|
|
|
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})
|
2019-03-18 20:05:15 -07:00
|
|
|
|
2020-04-14 22:02:59 -07:00
|
|
|
set(SSE_FLAGS )
|
|
|
|
set(FPMATH_SET "0")
|
|
|
|
if(CMAKE_SIZEOF_VOID_P MATCHES "4" AND (SSE2_SWITCH OR MSVC))
|
|
|
|
option(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE)
|
|
|
|
if(ALSOFT_ENABLE_SSE2_CODEGEN)
|
|
|
|
if(SSE2_SWITCH)
|
|
|
|
check_c_compiler_flag("${SSE2_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE_2)
|
|
|
|
if(HAVE_MFPMATH_SSE_2)
|
|
|
|
set(SSE_FLAGS ${SSE_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
|
|
|
|
set(C_FLAGS ${C_FLAGS} ${SSE_FLAGS})
|
|
|
|
set(FPMATH_SET 2)
|
|
|
|
endif()
|
2020-08-05 17:43:51 -07:00
|
|
|
# SSE depends on a 16-byte aligned stack, and by default, GCC
|
|
|
|
# assumes the stack is suitably aligned. Older Linux code or other
|
|
|
|
# OSs don't guarantee this on 32-bit, so externally-callable
|
|
|
|
# functions need to ensure an aligned stack.
|
2020-08-05 14:16:56 +00:00
|
|
|
set(EXPORT_DECL "${EXPORT_DECL} __attribute__((force_align_arg_pointer))")
|
2020-04-14 22:02:59 -07:00
|
|
|
elseif(MSVC)
|
|
|
|
check_c_compiler_flag("/arch:SSE2" HAVE_ARCH_SSE2)
|
|
|
|
if(HAVE_ARCH_SSE2)
|
|
|
|
set(SSE_FLAGS ${SSE_FLAGS} "/arch:SSE2")
|
|
|
|
set(C_FLAGS ${C_FLAGS} ${SSE_FLAGS})
|
|
|
|
set(FPMATH_SET 2)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2018-07-16 08:41:56 -07:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
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()
|
2019-03-18 20:05:15 -07:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
check_c_source_compiles("#include <emmintrin.h>
|
2019-03-18 20:05:15 -07:00
|
|
|
int main() {_mm_pause(); return 0;}" HAVE_SSE_INTRINSICS)
|
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
|
|
|
|
endif()
|
2019-03-18 20:05:15 -07:00
|
|
|
|
2018-07-16 08:41:56 -07:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
check_include_file(malloc.h HAVE_MALLOC_H)
|
|
|
|
check_include_file(cpuid.h HAVE_CPUID_H)
|
|
|
|
check_include_file(intrin.h HAVE_INTRIN_H)
|
|
|
|
check_include_file(guiddef.h HAVE_GUIDDEF_H)
|
|
|
|
if(NOT HAVE_GUIDDEF_H)
|
|
|
|
check_include_file(initguid.h HAVE_INITGUID_H)
|
|
|
|
endif()
|
2007-11-30 01:16:57 -08:00
|
|
|
|
2019-07-29 13:46:25 -07:00
|
|
|
# Some systems need libm for some math functions to work
|
2020-06-11 07:46:59 -07:00
|
|
|
set(MATH_LIB )
|
|
|
|
check_library_exists(m pow "" HAVE_LIBM)
|
|
|
|
if(HAVE_LIBM)
|
|
|
|
set(MATH_LIB ${MATH_LIB} m)
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
|
|
|
|
endif()
|
2016-01-21 21:51:20 -08:00
|
|
|
|
2019-10-01 22:35:33 -07:00
|
|
|
# Some systems need to link with -lrt for clock_gettime as used by the common
|
|
|
|
# eaxmple functions.
|
2020-06-11 07:46:59 -07:00
|
|
|
set(RT_LIB )
|
|
|
|
check_library_exists(rt clock_gettime "" HAVE_LIBRT)
|
|
|
|
if(HAVE_LIBRT)
|
|
|
|
set(RT_LIB rt)
|
|
|
|
endif()
|
2019-10-01 22:35:33 -07:00
|
|
|
|
2016-01-21 21:51:20 -08:00
|
|
|
# Check for the dlopen API (for dynamicly loading backend libs)
|
2020-06-11 07:46:59 -07:00
|
|
|
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()
|
|
|
|
endif()
|
2016-01-21 21:51:20 -08:00
|
|
|
|
|
|
|
# Check for a cpuid intrinsic
|
2020-06-11 07:46:59 -07:00
|
|
|
if(HAVE_CPUID_H)
|
|
|
|
check_c_source_compiles("#include <cpuid.h>
|
2014-08-11 13:38:43 -07:00
|
|
|
int main()
|
|
|
|
{
|
|
|
|
unsigned int eax, ebx, ecx, edx;
|
2014-09-05 02:57:24 -07:00
|
|
|
return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
|
2014-08-11 13:38:43 -07:00
|
|
|
}" HAVE_GCC_GET_CPUID)
|
2020-06-11 07:46:59 -07:00
|
|
|
endif()
|
|
|
|
if(HAVE_INTRIN_H)
|
|
|
|
check_c_source_compiles("#include <intrin.h>
|
2014-08-11 14:19:15 -07:00
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int regs[4];
|
|
|
|
__cpuid(regs, 0);
|
|
|
|
return regs[0];
|
|
|
|
}" HAVE_CPUID_INTRINSIC)
|
2020-06-11 07:46:59 -07:00
|
|
|
endif()
|
2014-08-11 14:19:15 -07:00
|
|
|
|
2020-05-19 08:13:13 -07:00
|
|
|
check_cxx_source_compiles("#include <cstdlib>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
void *ptr{std::aligned_alloc(alignof(int), sizeof(int))};
|
|
|
|
std::free(ptr);
|
|
|
|
return 0;
|
|
|
|
}" HAVE_STD_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)
|
2011-09-24 00:42:14 -07:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
if(NOT WIN32)
|
2019-07-29 13:46:25 -07:00
|
|
|
# We need pthreads outside of Windows, for semaphores. It's also used to
|
|
|
|
# set the priority and name of threads, when possible.
|
2020-06-11 07:46:59 -07:00
|
|
|
check_include_file(pthread.h HAVE_PTHREAD_H)
|
|
|
|
if(NOT HAVE_PTHREAD_H)
|
|
|
|
message(FATAL_ERROR "PThreads is required for non-Windows builds!")
|
|
|
|
endif()
|
2008-05-15 21:35:51 -07:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
check_c_compiler_flag(-pthread HAVE_PTHREAD)
|
|
|
|
if(HAVE_PTHREAD)
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
|
|
|
|
set(C_FLAGS ${C_FLAGS} -pthread)
|
|
|
|
set(LINKER_FLAGS ${LINKER_FLAGS} -pthread)
|
|
|
|
endif()
|
2013-03-13 21:20:00 -07:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
check_symbol_exists(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
|
2013-10-26 12:39:19 -07:00
|
|
|
|
2019-07-29 13:46:25 -07:00
|
|
|
# Some systems need pthread_np.h to get pthread_setname_np
|
2020-06-11 07:46:59 -07:00
|
|
|
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)
|
|
|
|
check_symbol_exists(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
|
|
|
|
else()
|
|
|
|
check_c_source_compiles("
|
2016-01-21 02:33:45 -08:00
|
|
|
#include <pthread.h>
|
|
|
|
#include <pthread_np.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
pthread_setname_np(\"testname\");
|
|
|
|
return 0;
|
|
|
|
}"
|
|
|
|
PTHREAD_SETNAME_NP_ONE_PARAM
|
|
|
|
)
|
2020-06-11 07:46:59 -07:00
|
|
|
check_c_source_compiles("
|
2017-09-15 22:09:37 -07:00
|
|
|
#include <pthread.h>
|
|
|
|
#include <pthread_np.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
pthread_setname_np(pthread_self(), \"%s\", \"testname\");
|
|
|
|
return 0;
|
|
|
|
}"
|
|
|
|
PTHREAD_SETNAME_NP_THREE_PARAMS
|
|
|
|
)
|
2020-06-11 07:46:59 -07:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
check_symbol_exists(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
|
|
|
|
if(NOT HAVE_PTHREAD_SETNAME_NP)
|
|
|
|
check_symbol_exists(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
|
|
|
|
else()
|
|
|
|
check_c_source_compiles("
|
2016-01-21 02:33:45 -08:00
|
|
|
#include <pthread.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
pthread_setname_np(\"testname\");
|
|
|
|
return 0;
|
|
|
|
}"
|
|
|
|
PTHREAD_SETNAME_NP_ONE_PARAM
|
|
|
|
)
|
2020-06-11 07:46:59 -07:00
|
|
|
check_c_source_compiles("
|
2017-09-15 22:09:37 -07:00
|
|
|
#include <pthread.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
pthread_setname_np(pthread_self(), \"%s\", \"testname\");
|
|
|
|
return 0;
|
|
|
|
}"
|
|
|
|
PTHREAD_SETNAME_NP_THREE_PARAMS
|
|
|
|
)
|
2020-06-11 07:46:59 -07:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2020-06-11 07:46:59 -07:00
|
|
|
check_symbol_exists(getopt unistd.h HAVE_GETOPT)
|
2017-08-20 04:30:53 -07:00
|
|
|
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2019-04-29 23:59:36 +02:00
|
|
|
# Common sources used by both the OpenAL implementation library and potentially
|
|
|
|
# the OpenAL router.
|
2020-06-11 07:46:59 -07:00
|
|
|
set(COMMON_OBJS
|
2019-05-24 06:11:21 -07:00
|
|
|
common/albyte.h
|
2018-11-17 04:14:57 -08:00
|
|
|
common/alcomplex.cpp
|
2018-05-15 18:31:41 -07:00
|
|
|
common/alcomplex.h
|
2019-05-04 18:03:25 -07:00
|
|
|
common/alexcpt.cpp
|
2019-04-09 20:48:01 -07:00
|
|
|
common/alexcpt.h
|
2019-09-22 12:23:41 -07:00
|
|
|
common/alfstream.cpp
|
|
|
|
common/alfstream.h
|
2018-11-17 19:01:10 -08:00
|
|
|
common/almalloc.cpp
|
2018-04-21 23:42:04 -07:00
|
|
|
common/almalloc.h
|
2019-02-11 11:07:06 -08:00
|
|
|
common/alnumeric.h
|
2019-06-30 11:21:29 -07:00
|
|
|
common/aloptional.h
|
2019-05-23 08:15:02 -07:00
|
|
|
common/alspan.h
|
2019-09-16 13:45:14 -07:00
|
|
|
common/alstring.cpp
|
|
|
|
common/alstring.h
|
2018-04-21 23:42:04 -07:00
|
|
|
common/atomic.h
|
2019-08-10 21:54:30 -07:00
|
|
|
common/dynload.cpp
|
|
|
|
common/dynload.h
|
2019-08-05 15:03:18 -07:00
|
|
|
common/endiantest.h
|
2019-08-01 13:28:53 -07:00
|
|
|
common/intrusive_ptr.h
|
2018-04-21 23:42:04 -07:00
|
|
|
common/math_defs.h
|
2019-01-07 01:12:09 -08:00
|
|
|
common/opthelpers.h
|
2019-11-28 10:54:47 -08:00
|
|
|
common/polyphase_resampler.cpp
|
|
|
|
common/polyphase_resampler.h
|
2019-10-07 15:17:45 -07:00
|
|
|
common/pragmadefs.h
|
2019-08-12 03:59:52 -07:00
|
|
|
common/strutils.cpp
|
2019-08-11 18:50:07 -07:00
|
|
|
common/strutils.h
|
2018-11-17 05:31:29 -08:00
|
|
|
common/threads.cpp
|
2018-04-21 23:42:04 -07:00
|
|
|
common/threads.h
|
2018-11-17 23:21:37 -08:00
|
|
|
common/vecmat.h
|
2019-08-11 20:53:20 -07:00
|
|
|
common/vector.h
|
2014-05-06 18:57:42 -07:00
|
|
|
)
|
2020-06-11 08:42:30 -07:00
|
|
|
set(OPENAL_OBJS
|
2019-07-29 17:54:07 -07:00
|
|
|
al/auxeffectslot.cpp
|
|
|
|
al/auxeffectslot.h
|
|
|
|
al/buffer.cpp
|
|
|
|
al/buffer.h
|
|
|
|
al/effect.cpp
|
|
|
|
al/effect.h
|
|
|
|
al/error.cpp
|
2019-08-12 14:56:17 -07:00
|
|
|
al/event.cpp
|
|
|
|
al/event.h
|
2019-07-29 17:54:07 -07:00
|
|
|
al/extension.cpp
|
|
|
|
al/filter.cpp
|
|
|
|
al/filter.h
|
|
|
|
al/listener.cpp
|
|
|
|
al/listener.h
|
|
|
|
al/source.cpp
|
|
|
|
al/source.h
|
|
|
|
al/state.cpp
|
2007-11-13 18:02:18 -08:00
|
|
|
)
|
2020-06-11 08:42:30 -07:00
|
|
|
set(ALC_OBJS
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/alc.cpp
|
|
|
|
alc/alcmain.h
|
|
|
|
alc/alu.cpp
|
|
|
|
alc/alu.h
|
|
|
|
alc/alconfig.cpp
|
|
|
|
alc/alconfig.h
|
|
|
|
alc/alcontext.h
|
2019-08-12 14:56:17 -07:00
|
|
|
alc/ambdec.cpp
|
|
|
|
alc/ambdec.h
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/ambidefs.h
|
2019-08-12 14:56:17 -07:00
|
|
|
alc/bformatdec.cpp
|
|
|
|
alc/bformatdec.h
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/bs2b.cpp
|
|
|
|
alc/bs2b.h
|
2020-05-11 02:24:08 -07:00
|
|
|
alc/bsinc_defs.h
|
|
|
|
alc/bsinc_tables.cpp
|
|
|
|
alc/bsinc_tables.h
|
2020-05-19 10:21:19 -07:00
|
|
|
alc/bufferline.h
|
2020-08-24 17:59:07 -07:00
|
|
|
alc/buffer_formats.cpp
|
|
|
|
alc/buffer_formats.h
|
2019-08-12 14:56:17 -07:00
|
|
|
alc/compat.h
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/converter.cpp
|
|
|
|
alc/converter.h
|
2020-03-20 15:29:29 -07:00
|
|
|
alc/cpu_caps.cpp
|
2019-08-12 14:56:17 -07:00
|
|
|
alc/cpu_caps.h
|
2019-08-05 15:03:18 -07:00
|
|
|
alc/devformat.h
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/effects/base.h
|
|
|
|
alc/effects/autowah.cpp
|
|
|
|
alc/effects/chorus.cpp
|
|
|
|
alc/effects/compressor.cpp
|
2020-08-24 20:04:16 -07:00
|
|
|
alc/effects/convolution.cpp
|
2019-07-28 18:56:04 -07:00
|
|
|
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
|
2020-03-20 15:01:45 -07:00
|
|
|
alc/fpu_ctrl.cpp
|
|
|
|
alc/fpu_ctrl.h
|
2020-03-30 01:16:15 -07:00
|
|
|
alc/front_stablizer.h
|
2019-08-12 14:56:17 -07:00
|
|
|
alc/helpers.cpp
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/hrtf.cpp
|
|
|
|
alc/hrtf.h
|
2019-08-12 14:56:17 -07:00
|
|
|
alc/inprogext.h
|
|
|
|
alc/logging.h
|
|
|
|
alc/mastering.cpp
|
|
|
|
alc/mastering.h
|
|
|
|
alc/panning.cpp
|
|
|
|
alc/ringbuffer.cpp
|
|
|
|
alc/ringbuffer.h
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/uhjfilter.cpp
|
|
|
|
alc/uhjfilter.h
|
2019-08-12 14:56:17 -07:00
|
|
|
alc/uiddefs.cpp
|
2019-10-02 15:29:01 -07:00
|
|
|
alc/voice.cpp
|
2019-10-02 16:53:23 -07:00
|
|
|
alc/voice.h
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/mixer/defs.h
|
|
|
|
alc/mixer/hrtfbase.h
|
|
|
|
alc/mixer/mixer_c.cpp
|
2012-08-15 01:01:55 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
set(CPU_EXTS "Default")
|
|
|
|
set(HAVE_SSE 0)
|
|
|
|
set(HAVE_SSE2 0)
|
|
|
|
set(HAVE_SSE3 0)
|
|
|
|
set(HAVE_SSE4_1 0)
|
|
|
|
set(HAVE_NEON 0)
|
2014-08-05 01:48:30 -07:00
|
|
|
|
2019-03-18 17:38:02 -07:00
|
|
|
# Check for SSE+SSE2 support
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
|
|
|
|
option(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
|
|
|
|
if(HAVE_XMMINTRIN_H AND HAVE_EMMINTRIN_H)
|
|
|
|
option(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
|
|
|
|
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
|
2019-03-18 17:38:02 -07:00
|
|
|
PROPERTIES COMPILE_FLAGS "${SSE2_SWITCH}")
|
2020-06-11 08:42:30 -07:00
|
|
|
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()
|
|
|
|
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)
|
|
|
|
if(HAVE_EMMINTRIN_H)
|
|
|
|
option(ALSOFT_CPUEXT_SSE3 "Enable SSE3 support" ON)
|
|
|
|
if(HAVE_SSE2 AND ALSOFT_CPUEXT_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)
|
|
|
|
message(FATAL_ERROR "Failed to enable required SSE3 CPU extensions")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
|
|
|
|
if(HAVE_SMMINTRIN_H)
|
|
|
|
option(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
|
|
|
|
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)
|
|
|
|
message(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
|
|
|
|
endif()
|
2012-08-15 01:01:55 -07:00
|
|
|
|
|
|
|
# Check for ARM Neon support
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF)
|
|
|
|
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.cpp)
|
|
|
|
if(FPU_NEON_SWITCH)
|
|
|
|
set_source_files_properties(alc/mixer/mixer_neon.cpp PROPERTIES
|
|
|
|
COMPILE_FLAGS "${FPU_NEON_SWITCH}")
|
|
|
|
endif()
|
|
|
|
set(CPU_EXTS "${CPU_EXTS}, Neon")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required ARM Neon CPU extensions")
|
|
|
|
endif()
|
2012-08-15 01:01:55 -07:00
|
|
|
|
|
|
|
|
2020-04-19 03:34:46 -07:00
|
|
|
set(HAVE_ALSA 0)
|
|
|
|
set(HAVE_OSS 0)
|
|
|
|
set(HAVE_SOLARIS 0)
|
|
|
|
set(HAVE_SNDIO 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_OBOE 0)
|
|
|
|
set(HAVE_WAVE 0)
|
|
|
|
set(HAVE_SDL2 0)
|
|
|
|
|
|
|
|
if(WIN32 OR HAVE_DLFCN_H)
|
|
|
|
set(IS_LINKED "")
|
|
|
|
macro(ADD_BACKEND_LIBS _LIBS)
|
|
|
|
endmacro()
|
|
|
|
else()
|
|
|
|
set(IS_LINKED " (linked)")
|
|
|
|
macro(ADD_BACKEND_LIBS _LIBS)
|
|
|
|
set(EXTRA_LIBS ${_LIBS} ${EXTRA_LIBS})
|
|
|
|
endmacro()
|
|
|
|
endif()
|
2014-08-05 01:48:30 -07:00
|
|
|
|
2020-04-19 03:34:46 -07:00
|
|
|
set(BACKENDS "")
|
|
|
|
set(ALC_OBJS ${ALC_OBJS}
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/backends/base.cpp
|
|
|
|
alc/backends/base.h
|
2018-04-21 23:42:04 -07:00
|
|
|
# Default backends, always available
|
2019-07-28 18:56:04 -07:00
|
|
|
alc/backends/loopback.cpp
|
|
|
|
alc/backends/loopback.h
|
|
|
|
alc/backends/null.cpp
|
|
|
|
alc/backends/null.h
|
2007-11-13 18:02:18 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
# Check ALSA backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
|
|
|
|
find_package(ALSA)
|
|
|
|
if(ALSA_FOUND)
|
|
|
|
option(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_ALSA)
|
|
|
|
set(HAVE_ALSA 1)
|
|
|
|
set(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
|
|
|
|
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()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required ALSA backend")
|
|
|
|
endif()
|
2007-11-13 18:02:18 -08:00
|
|
|
|
|
|
|
# Check OSS backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
|
|
|
|
find_package(OSS)
|
|
|
|
if(OSS_FOUND)
|
|
|
|
option(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_OSS)
|
|
|
|
set(HAVE_OSS 1)
|
|
|
|
set(BACKENDS "${BACKENDS} OSS,")
|
|
|
|
set(ALC_OBJS ${ALC_OBJS} alc/backends/oss.cpp alc/backends/oss.h)
|
|
|
|
if(OSS_LIBRARIES)
|
|
|
|
set(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS})
|
|
|
|
endif()
|
|
|
|
set(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required OSS backend")
|
|
|
|
endif()
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2008-09-07 14:34:14 -07:00
|
|
|
# Check Solaris backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
|
|
|
|
find_package(AudioIO)
|
|
|
|
if(AUDIOIO_FOUND)
|
|
|
|
option(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_SOLARIS)
|
|
|
|
set(HAVE_SOLARIS 1)
|
|
|
|
set(BACKENDS "${BACKENDS} Solaris,")
|
|
|
|
set(ALC_OBJS ${ALC_OBJS} alc/backends/solaris.cpp alc/backends/solaris.h)
|
|
|
|
set(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required Solaris backend")
|
|
|
|
endif()
|
2008-09-07 14:34:14 -07:00
|
|
|
|
2011-06-22 19:29:13 -07:00
|
|
|
# Check SndIO backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
|
|
|
|
find_package(SoundIO)
|
|
|
|
if(SOUNDIO_FOUND)
|
|
|
|
option(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_SNDIO)
|
|
|
|
set(HAVE_SNDIO 1)
|
|
|
|
set(BACKENDS "${BACKENDS} SndIO (linked),")
|
|
|
|
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()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required SndIO backend")
|
|
|
|
endif()
|
2011-06-22 19:29:13 -07:00
|
|
|
|
2014-08-11 09:13:08 -07:00
|
|
|
# Check Windows-only backends
|
2020-06-11 08:42:30 -07:00
|
|
|
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(WIN32)
|
|
|
|
set(WINSDK_LIB_DIRS )
|
|
|
|
set(WINSDK_INCLUDE_DIRS )
|
2020-07-09 00:07:33 -07:00
|
|
|
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)
|
2020-06-11 08:42:30 -07:00
|
|
|
endif()
|
2019-07-10 20:06:50 -07:00
|
|
|
|
2014-08-11 09:13:08 -07:00
|
|
|
# Check MMSystem backend
|
2020-04-26 07:59:08 -07:00
|
|
|
check_include_files("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
|
|
|
|
find_library(WINMM_LIBRARY NAMES winmm
|
|
|
|
PATHS ${WINSDK_LIB_DIRS})
|
|
|
|
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()
|
2014-08-11 09:13:08 -07:00
|
|
|
|
|
|
|
# Check DSound backend
|
2020-06-11 08:42:30 -07:00
|
|
|
find_package(DSound)
|
|
|
|
if(DSOUND_FOUND)
|
|
|
|
option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_DSOUND)
|
|
|
|
set(HAVE_DSOUND 1)
|
|
|
|
set(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
|
|
|
|
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()
|
|
|
|
endif()
|
2014-08-11 09:13:08 -07:00
|
|
|
|
2018-03-09 18:56:24 -08:00
|
|
|
# Check for WASAPI backend
|
2020-06-11 08:42:30 -07:00
|
|
|
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
|
|
|
|
if(HAVE_MMDEVICEAPI_H)
|
|
|
|
option(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_WASAPI)
|
|
|
|
set(HAVE_WASAPI 1)
|
|
|
|
set(BACKENDS "${BACKENDS} WASAPI,")
|
|
|
|
set(ALC_OBJS ${ALC_OBJS} alc/backends/wasapi.cpp alc/backends/wasapi.h)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required WinMM backend")
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required DSound backend")
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_WASAPI AND NOT HAVE_WASAPI)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required WASAPI backend")
|
|
|
|
endif()
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2009-03-10 00:55:29 -07:00
|
|
|
# Check PortAudio backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
|
|
|
|
find_package(PortAudio)
|
|
|
|
if(PORTAUDIO_FOUND)
|
|
|
|
option(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_PORTAUDIO)
|
|
|
|
set(HAVE_PORTAUDIO 1)
|
|
|
|
set(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
|
|
|
|
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()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required PortAudio backend")
|
|
|
|
endif()
|
2009-03-10 00:55:29 -07:00
|
|
|
|
2011-06-23 17:02:57 -07:00
|
|
|
# Check PulseAudio backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
|
|
|
|
find_package(PulseAudio)
|
|
|
|
if(PULSEAUDIO_FOUND)
|
|
|
|
option(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_PULSEAUDIO)
|
|
|
|
set(HAVE_PULSEAUDIO 1)
|
|
|
|
set(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
|
|
|
|
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()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required PulseAudio backend")
|
|
|
|
endif()
|
2009-04-16 05:17:42 -07:00
|
|
|
|
2014-12-21 15:51:16 -08:00
|
|
|
# Check JACK backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_JACK "Require JACK backend" OFF)
|
|
|
|
find_package(JACK)
|
|
|
|
if(JACK_FOUND)
|
|
|
|
option(ALSOFT_BACKEND_JACK "Enable JACK backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_JACK)
|
|
|
|
set(HAVE_JACK 1)
|
|
|
|
set(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
|
|
|
|
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()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_JACK AND NOT HAVE_JACK)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required JACK backend")
|
|
|
|
endif()
|
2014-12-21 15:51:16 -08:00
|
|
|
|
2011-03-15 04:58:56 -07:00
|
|
|
# Check CoreAudio backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
|
|
|
|
find_library(COREAUDIO_FRAMEWORK NAMES CoreAudio)
|
|
|
|
find_path(AUDIOUNIT_INCLUDE_DIR NAMES AudioUnit/AudioUnit.h)
|
|
|
|
if(COREAUDIO_FRAMEWORK AND AUDIOUNIT_INCLUDE_DIR)
|
|
|
|
option(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_COREAUDIO)
|
|
|
|
set(HAVE_COREAUDIO 1)
|
|
|
|
set(ALC_OBJS ${ALC_OBJS} alc/backends/coreaudio.cpp alc/backends/coreaudio.h)
|
|
|
|
set(BACKENDS "${BACKENDS} CoreAudio,")
|
2020-06-11 08:55:52 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
|
|
|
find_library(COREFOUNDATION_FRAMEWORK NAMES CoreFoundation)
|
|
|
|
set(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} ${COREFOUNDATION_FRAMEWORK} ${EXTRA_LIBS})
|
|
|
|
else()
|
|
|
|
set(EXTRA_LIBS ${COREAUDIO_FRAMEWORK} /System/Library/Frameworks/AudioUnit.framework
|
|
|
|
/System/Library/Frameworks/ApplicationServices.framework ${EXTRA_LIBS})
|
|
|
|
endif()
|
2012-01-23 03:45:04 -08:00
|
|
|
|
|
|
|
# Some versions of OSX may need the AudioToolbox framework. Add it if
|
|
|
|
# it's found.
|
2020-06-11 08:42:30 -07:00
|
|
|
find_library(AUDIOTOOLBOX_LIBRARY NAMES AudioToolbox)
|
|
|
|
if(AUDIOTOOLBOX_LIBRARY)
|
|
|
|
set(EXTRA_LIBS ${AUDIOTOOLBOX_LIBRARY} ${EXTRA_LIBS})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(INC_PATHS ${INC_PATHS} ${AUDIOUNIT_INCLUDE_DIR})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required CoreAudio backend")
|
|
|
|
endif()
|
2011-03-15 04:58:56 -07:00
|
|
|
|
2011-06-12 04:41:42 -07:00
|
|
|
# Check for OpenSL (Android) backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
|
|
|
|
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)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required OpenSL backend")
|
|
|
|
endif()
|
2011-06-12 04:41:42 -07:00
|
|
|
|
2020-04-18 15:17:53 -07:00
|
|
|
# Check for Oboe (Android) backend
|
|
|
|
set(OBOE_TARGET )
|
|
|
|
if(ANDROID)
|
|
|
|
set(OBOE_SOURCE "" CACHE STRING "Source directory for Oboe.")
|
|
|
|
if(OBOE_SOURCE)
|
2020-04-18 23:03:50 -07:00
|
|
|
# Force Oboe to build with hidden symbols. Don't want to be exporting
|
|
|
|
# them from OpenAL.
|
|
|
|
set(OLD_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
|
|
check_cxx_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH)
|
|
|
|
if(HAVE_VISIBILITY_HIDDEN_SWITCH)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
|
|
|
endif()
|
2020-04-18 15:17:53 -07:00
|
|
|
add_subdirectory(${OBOE_SOURCE} ./oboe)
|
2020-04-18 23:03:50 -07:00
|
|
|
set(CMAKE_CXX_FLAGS ${OLD_CXX_FLAGS})
|
|
|
|
unset(OLD_CXX_FLAGS)
|
|
|
|
|
2020-04-18 15:17:53 -07:00
|
|
|
set(OBOE_TARGET oboe)
|
|
|
|
else()
|
|
|
|
find_package(Oboe)
|
|
|
|
if(OBOE_FOUND)
|
|
|
|
set(OBOE_TARGET "oboe::oboe")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(ALSOFT_REQUIRE_OBOE "Require Oboe backend" OFF)
|
|
|
|
if(OBOE_TARGET)
|
|
|
|
option(ALSOFT_BACKEND_OBOE "Enable Oboe backend" ON)
|
|
|
|
if(ALSOFT_BACKEND_OBOE)
|
|
|
|
set(HAVE_OBOE 1)
|
|
|
|
set(ALC_OBJS ${ALC_OBJS} alc/backends/oboe.cpp alc/backends/oboe.h)
|
|
|
|
set(BACKENDS "${BACKENDS} Oboe,")
|
|
|
|
set(EXTRA_LIBS ${OBOE_TARGET} ${EXTRA_LIBS})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_OBOE AND NOT HAVE_OBOE)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required Oboe backend")
|
|
|
|
endif()
|
|
|
|
|
2018-03-07 20:53:56 +01:00
|
|
|
# Check for SDL2 backend
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF)
|
|
|
|
find_package(SDL2)
|
|
|
|
if(SDL2_FOUND)
|
2018-03-07 20:53:56 +01:00
|
|
|
# Off by default, since it adds a runtime dependency
|
2020-06-11 08:42:30 -07:00
|
|
|
option(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF)
|
|
|
|
if(ALSOFT_BACKEND_SDL2)
|
|
|
|
set(HAVE_SDL2 1)
|
|
|
|
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})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND)
|
|
|
|
message(FATAL_ERROR "Failed to enabled required SDL2 backend")
|
|
|
|
endif()
|
2018-03-07 20:53:56 +01:00
|
|
|
|
2010-06-08 02:01:11 -07:00
|
|
|
# Optionally enable the Wave Writer backend
|
2020-06-11 08:42:30 -07:00
|
|
|
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.cpp alc/backends/wave.h)
|
|
|
|
set(BACKENDS "${BACKENDS} WaveFile,")
|
|
|
|
endif()
|
2010-06-08 02:01:11 -07:00
|
|
|
|
2008-01-11 09:32:22 -08:00
|
|
|
# This is always available
|
2020-06-11 08:42:30 -07:00
|
|
|
set(BACKENDS "${BACKENDS} Null")
|
2008-01-11 09:32:22 -08:00
|
|
|
|
2017-08-26 02:21:50 -07:00
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
find_package(Git)
|
|
|
|
if(ALSOFT_UPDATE_BUILD_VERSION AND GIT_FOUND AND EXISTS "${OpenAL_SOURCE_DIR}/.git")
|
2017-08-26 02:21:50 -07:00
|
|
|
# Get the current working branch and its latest abbreviated commit hash
|
2020-06-11 08:42:30 -07:00
|
|
|
add_custom_target(build_version
|
2019-09-18 08:58:36 -07:00
|
|
|
${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
|
2017-08-26 02:21:50 -07:00
|
|
|
WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
|
2017-05-05 13:29:52 +03:00
|
|
|
VERBATIM
|
|
|
|
)
|
2020-06-11 08:42:30 -07:00
|
|
|
else()
|
|
|
|
set(GIT_BRANCH "UNKNOWN")
|
|
|
|
set(GIT_COMMIT_HASH "unknown")
|
|
|
|
configure_file(
|
2017-08-26 02:21:50 -07:00
|
|
|
"${OpenAL_SOURCE_DIR}/version.h.in"
|
|
|
|
"${OpenAL_BINARY_DIR}/version.h")
|
2020-06-11 08:42:30 -07:00
|
|
|
endif()
|
2017-08-26 02:21:50 -07:00
|
|
|
|
2018-12-08 17:22:10 -08:00
|
|
|
|
2018-08-29 15:31:04 -07:00
|
|
|
option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" ON)
|
2017-08-26 02:21:50 -07:00
|
|
|
if(ALSOFT_EMBED_HRTF_DATA)
|
2020-06-11 08:42:30 -07:00
|
|
|
macro(make_hrtf_header FILENAME VARNAME)
|
|
|
|
set(infile "${OpenAL_SOURCE_DIR}/hrtf/${FILENAME}")
|
|
|
|
set(outfile "${OpenAL_BINARY_DIR}/${VARNAME}.h")
|
2017-05-05 13:29:52 +03:00
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
add_custom_command(OUTPUT "${outfile}"
|
2020-04-04 08:46:18 -07:00
|
|
|
COMMAND ${CMAKE_COMMAND} -D "INPUT_FILE=${infile}" -D "OUTPUT_FILE=${outfile}"
|
|
|
|
-D "VARIABLE_NAME=${VARNAME}" -P "${CMAKE_MODULE_PATH}/bin2h.script.cmake"
|
|
|
|
WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}"
|
|
|
|
DEPENDS "${infile}" "${CMAKE_MODULE_PATH}/bin2h.script.cmake"
|
2017-05-05 13:29:52 +03:00
|
|
|
VERBATIM
|
|
|
|
)
|
2020-06-11 08:42:30 -07:00
|
|
|
set(ALC_OBJS ${ALC_OBJS} "${outfile}")
|
|
|
|
endmacro()
|
2017-05-05 13:29:52 +03:00
|
|
|
|
2019-11-28 15:47:16 -08:00
|
|
|
make_hrtf_header("Default HRTF.mhr" "hrtf_default")
|
2016-07-12 14:22:17 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
if(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL)
|
2020-04-15 00:09:45 -07:00
|
|
|
find_package(Qt5Widgets)
|
2020-06-11 08:42:30 -07:00
|
|
|
endif()
|
|
|
|
if(ALSOFT_EXAMPLES)
|
|
|
|
find_package(SndFile)
|
|
|
|
find_package(SDL2)
|
|
|
|
if(SDL2_FOUND)
|
|
|
|
find_package(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
set(LIBNAME "openal")
|
|
|
|
else()
|
|
|
|
set(LIBNAME "OpenAL32")
|
|
|
|
endif()
|
2017-03-18 20:24:19 -07:00
|
|
|
|
2008-07-22 18:42:53 -07:00
|
|
|
# Needed for openal.pc.in
|
2020-06-11 08:42:30 -07:00
|
|
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set(exec_prefix "\${prefix}")
|
|
|
|
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
|
|
|
|
set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
|
|
|
|
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
|
|
|
set(PACKAGE_VERSION "${LIB_VERSION}")
|
|
|
|
set(PKG_CONFIG_CFLAGS )
|
|
|
|
set(PKG_CONFIG_PRIVATE_LIBS )
|
|
|
|
if(LIBTYPE STREQUAL "STATIC")
|
|
|
|
set(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC)
|
|
|
|
foreach(FLAG ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
|
2018-03-29 18:57:48 -07:00
|
|
|
# If this is already a linker flag, or is a full path+file, add it
|
|
|
|
# as-is. Otherwise, it's a name intended to be dressed as -lname.
|
2020-06-11 08:42:30 -07:00
|
|
|
if(FLAG MATCHES "^-.*" OR EXISTS "${FLAG}")
|
|
|
|
set(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} ${FLAG}")
|
|
|
|
else()
|
|
|
|
set(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} -l${FLAG}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2008-07-22 18:42:53 -07:00
|
|
|
|
2007-11-13 18:02:18 -08:00
|
|
|
# End configuration
|
2020-06-11 08:42:30 -07:00
|
|
|
configure_file(
|
2007-11-13 18:02:18 -08:00
|
|
|
"${OpenAL_SOURCE_DIR}/config.h.in"
|
|
|
|
"${OpenAL_BINARY_DIR}/config.h")
|
2020-06-11 08:42:30 -07:00
|
|
|
configure_file(
|
2009-12-09 07:36:06 -08:00
|
|
|
"${OpenAL_SOURCE_DIR}/openal.pc.in"
|
|
|
|
"${OpenAL_BINARY_DIR}/openal.pc"
|
2008-07-22 18:42:53 -07:00
|
|
|
@ONLY)
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2017-12-16 15:53:24 -08:00
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
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)
|
2019-09-16 14:46:41 -07:00
|
|
|
|
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
unset(HAS_ROUTER)
|
|
|
|
set(IMPL_TARGET OpenAL) # Either OpenAL or soft_oal.
|
2017-07-10 01:57:22 -07:00
|
|
|
|
2014-05-07 19:51:42 -07:00
|
|
|
# Build main library
|
2020-06-11 08:42:30 -07:00
|
|
|
if(LIBTYPE STREQUAL "STATIC")
|
2020-04-10 08:43:59 -07:00
|
|
|
add_library(${IMPL_TARGET} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS})
|
|
|
|
target_compile_definitions(${IMPL_TARGET} PUBLIC AL_LIBTYPE_STATIC)
|
|
|
|
target_link_libraries(${IMPL_TARGET} PRIVATE ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
|
|
|
|
if(WIN32)
|
|
|
|
# This option is for static linking OpenAL Soft into another project
|
|
|
|
# that already defines the IDs. It is up to that project to ensure all
|
|
|
|
# required IDs are defined.
|
|
|
|
option(ALSOFT_NO_UID_DEFS "Do not define GUIDs, IIDs, CLSIDs, or PropertyKeys" OFF)
|
|
|
|
if(ALSOFT_NO_UID_DEFS)
|
|
|
|
target_compile_definitions(${IMPL_TARGET} PRIVATE AL_NO_UID_DEFS)
|
|
|
|
endif()
|
|
|
|
endif()
|
2020-06-11 08:42:30 -07:00
|
|
|
else()
|
|
|
|
set(RC_CONFIG resources/openal32.rc)
|
|
|
|
if(WIN32 AND ALSOFT_BUILD_ROUTER)
|
|
|
|
add_library(OpenAL SHARED
|
2019-06-30 22:01:04 -07:00
|
|
|
resources/router.rc
|
2019-04-29 23:59:36 +02:00
|
|
|
router/router.cpp
|
|
|
|
router/router.h
|
|
|
|
router/alc.cpp
|
|
|
|
router/al.cpp
|
|
|
|
)
|
2020-06-11 08:42:30 -07:00
|
|
|
target_compile_definitions(OpenAL
|
2017-12-15 12:25:50 -08:00
|
|
|
PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
|
2020-06-11 08:42:30 -07:00
|
|
|
target_compile_options(OpenAL PRIVATE ${C_FLAGS})
|
|
|
|
target_link_libraries(OpenAL PRIVATE common ${LINKER_FLAGS})
|
|
|
|
target_include_directories(OpenAL
|
2019-04-29 23:59:36 +02:00
|
|
|
PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${OpenAL_SOURCE_DIR}/include>
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
PRIVATE
|
|
|
|
${OpenAL_SOURCE_DIR}/common
|
|
|
|
${OpenAL_BINARY_DIR}
|
|
|
|
)
|
2020-06-11 08:42:30 -07:00
|
|
|
set_target_properties(OpenAL PROPERTIES PREFIX "")
|
|
|
|
set_target_properties(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME})
|
|
|
|
if(TARGET build_version)
|
|
|
|
add_dependencies(OpenAL build_version)
|
|
|
|
endif()
|
|
|
|
set(HAS_ROUTER 1)
|
|
|
|
|
|
|
|
set(LIBNAME "soft_oal")
|
|
|
|
set(IMPL_TARGET soft_oal)
|
|
|
|
set(RC_CONFIG resources/soft_oal.rc)
|
|
|
|
endif()
|
|
|
|
|
2020-08-24 14:26:47 -07:00
|
|
|
# !important: for osx framework public header works, the headers must be in
|
|
|
|
# the project
|
2020-08-24 14:09:02 -07:00
|
|
|
set(TARGET_PUBLIC_HEADERS include/AL/al.h include/AL/alc.h include/AL/alext.h include/AL/efx.h)
|
2020-08-24 14:26:47 -07:00
|
|
|
add_library(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS} ${RC_CONFIG}
|
|
|
|
${TARGET_PUBLIC_HEADERS})
|
2020-06-11 08:42:30 -07:00
|
|
|
if(WIN32)
|
|
|
|
set_target_properties(${IMPL_TARGET} PROPERTIES PREFIX "")
|
|
|
|
endif()
|
|
|
|
target_link_libraries(${IMPL_TARGET} PRIVATE common ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
|
2020-08-24 14:09:02 -07:00
|
|
|
|
|
|
|
if(APPLE AND ALSOFT_OSX_FRAMEWORK)
|
2020-08-24 14:26:47 -07:00
|
|
|
# Sets framework name to soft_oal to avoid ambiguity with the system OpenAL.framework
|
2020-08-24 14:09:02 -07:00
|
|
|
set(LIBNAME "soft_oal")
|
|
|
|
if(GIT_FOUND)
|
|
|
|
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-list --count head
|
|
|
|
TIMEOUT 5
|
|
|
|
OUTPUT_VARIABLE BUNDLE_VERSION
|
2020-08-24 14:26:47 -07:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2020-08-24 14:09:02 -07:00
|
|
|
else()
|
|
|
|
set(BUNDLE_VERSION 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Build: Fix rpath in iOS shared libraries
|
2020-08-24 14:26:47 -07:00
|
|
|
# If this flag is not set, the final dylib binary ld path will be
|
|
|
|
# /User/xxx/*/soft_oal.framework/soft_oal, which can't be loaded by iOS devices.
|
2020-08-24 14:09:02 -07:00
|
|
|
# See also: https://github.com/libjpeg-turbo/libjpeg-turbo/commit/c80ddef7a4ce21ace9e3ca0fd190d320cc8cdaeb
|
|
|
|
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
|
|
|
|
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(${IMPL_TARGET} PROPERTIES
|
|
|
|
FRAMEWORK TRUE
|
|
|
|
FRAMEWORK_VERSION C
|
|
|
|
MACOSX_FRAMEWORK_NAME "${IMPL_TARGET}"
|
|
|
|
MACOSX_FRAMEWORK_IDENTIFIER "org.openal-soft.openal"
|
|
|
|
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LIB_VERSION}
|
|
|
|
MACOSX_FRAMEWORK_BUNDLE_VERSION ${BUNDLE_VERSION}
|
|
|
|
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
|
|
|
|
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
|
|
|
|
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
|
|
|
|
PUBLIC_HEADER "${TARGET_PUBLIC_HEADERS}"
|
2020-08-24 14:26:47 -07:00
|
|
|
MACOSX_RPATH TRUE)
|
2020-08-24 14:09:02 -07:00
|
|
|
endif()
|
2020-06-11 08:42:30 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
target_include_directories(${IMPL_TARGET}
|
2019-04-29 23:59:36 +02:00
|
|
|
PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${OpenAL_SOURCE_DIR}/include>
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
PRIVATE
|
|
|
|
${INC_PATHS}
|
|
|
|
${OpenAL_BINARY_DIR}
|
2019-07-29 17:54:07 -07:00
|
|
|
${OpenAL_SOURCE_DIR}
|
2019-07-28 18:56:04 -07:00
|
|
|
${OpenAL_SOURCE_DIR}/alc
|
2019-04-29 23:59:36 +02:00
|
|
|
${OpenAL_SOURCE_DIR}/common
|
|
|
|
)
|
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
set_target_properties(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME}
|
2017-07-09 22:19:34 -07:00
|
|
|
VERSION ${LIB_VERSION}
|
|
|
|
SOVERSION ${LIB_MAJOR_VERSION}
|
|
|
|
)
|
2020-06-11 08:42:30 -07:00
|
|
|
target_compile_definitions(${IMPL_TARGET}
|
2017-12-15 12:25:50 -08:00
|
|
|
PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS})
|
2020-06-11 08:42:30 -07:00
|
|
|
target_compile_options(${IMPL_TARGET} PRIVATE ${C_FLAGS})
|
|
|
|
|
|
|
|
if(TARGET build_version)
|
|
|
|
add_dependencies(${IMPL_TARGET} build_version)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32 AND MINGW AND ALSOFT_BUILD_IMPORT_LIB AND NOT LIBTYPE STREQUAL "STATIC")
|
|
|
|
find_program(SED_EXECUTABLE NAMES sed DOC "sed executable")
|
2020-08-20 16:46:51 -07:00
|
|
|
if(NOT SED_EXECUTABLE OR NOT CMAKE_DLLTOOL)
|
2020-06-11 08:42:30 -07:00
|
|
|
message(STATUS "")
|
|
|
|
if(NOT SED_EXECUTABLE)
|
|
|
|
message(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation")
|
|
|
|
endif()
|
2020-08-20 16:46:51 -07:00
|
|
|
if(NOT CMAKE_DLLTOOL)
|
2020-06-11 08:42:30 -07:00
|
|
|
message(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation")
|
|
|
|
endif()
|
|
|
|
else()
|
2020-06-12 12:54:05 -07:00
|
|
|
set_property(TARGET OpenAL APPEND_STRING PROPERTY
|
2019-09-18 08:58:36 -07:00
|
|
|
LINK_FLAGS " -Wl,--output-def,OpenAL32.def")
|
2020-06-11 08:42:30 -07:00
|
|
|
add_custom_command(TARGET OpenAL POST_BUILD
|
2017-12-15 12:25:50 -08:00
|
|
|
COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def
|
2020-08-20 16:46:51 -07:00
|
|
|
COMMAND "${CMAKE_DLLTOOL}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll
|
2017-12-15 12:25:50 -08:00
|
|
|
COMMENT "Stripping ordinals from OpenAL32.def and generating OpenAL32.lib..."
|
|
|
|
VERBATIM
|
|
|
|
)
|
2020-06-11 08:42:30 -07:00
|
|
|
endif()
|
|
|
|
endif()
|
2017-06-28 12:42:20 -07:00
|
|
|
|
2017-07-10 01:57:22 -07:00
|
|
|
if(HAS_ROUTER)
|
|
|
|
message(STATUS "")
|
|
|
|
message(STATUS "Building DLL router")
|
|
|
|
endif()
|
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
message(STATUS "
|
|
|
|
Building OpenAL with support for the following backends:
|
|
|
|
${BACKENDS}
|
|
|
|
|
|
|
|
Building with support for CPU extensions:
|
|
|
|
${CPU_EXTS}
|
|
|
|
")
|
|
|
|
if(FPMATH_SET)
|
|
|
|
message(STATUS "Building with SSE${FPMATH_SET} codegen
|
|
|
|
")
|
|
|
|
endif()
|
2010-07-17 01:02:51 -07:00
|
|
|
|
2016-07-12 14:22:17 -07:00
|
|
|
if(ALSOFT_EMBED_HRTF_DATA)
|
2020-06-11 08:42:30 -07:00
|
|
|
message(STATUS "Embedding HRTF datasets
|
|
|
|
")
|
2016-07-12 14:22:17 -07:00
|
|
|
endif()
|
|
|
|
|
2020-05-07 00:02:23 -07:00
|
|
|
# Install main library
|
|
|
|
if(ALSOFT_INSTALL)
|
|
|
|
install(TARGETS OpenAL EXPORT OpenAL
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2020-08-24 14:09:02 -07:00
|
|
|
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2020-05-07 00:02:23 -07:00
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL)
|
|
|
|
export(TARGETS OpenAL
|
|
|
|
NAMESPACE OpenAL::
|
|
|
|
FILE OpenALConfig.cmake)
|
|
|
|
install(EXPORT OpenAL
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL
|
|
|
|
NAMESPACE OpenAL::
|
|
|
|
FILE OpenALConfig.cmake)
|
|
|
|
install(DIRECTORY include/AL
|
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
install(FILES "${OpenAL_BINARY_DIR}/openal.pc"
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
|
|
|
if(TARGET soft_oal)
|
|
|
|
install(TARGETS soft_oal
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
endif()
|
|
|
|
message(STATUS "Installing library and headers")
|
|
|
|
else()
|
|
|
|
message(STATUS "NOT installing library and headers")
|
|
|
|
endif()
|
|
|
|
|
2020-04-19 04:38:44 -07:00
|
|
|
if(ALSOFT_INSTALL_CONFIG)
|
|
|
|
install(FILES alsoftrc.sample
|
2019-09-18 08:58:36 -07:00
|
|
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/openal)
|
2020-04-19 04:38:44 -07:00
|
|
|
message(STATUS "Installing sample configuration")
|
|
|
|
endif()
|
2009-05-17 22:36:45 -07:00
|
|
|
|
2020-08-13 18:04:09 -07:00
|
|
|
if(ALSOFT_INSTALL_HRTF_DATA)
|
2020-04-19 04:38:44 -07:00
|
|
|
install(DIRECTORY hrtf
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/openal)
|
2020-08-13 18:04:09 -07:00
|
|
|
message(STATUS "Installing HRTF data files")
|
2020-04-19 04:38:44 -07:00
|
|
|
endif()
|
2014-02-23 20:51:30 -08:00
|
|
|
|
2020-04-19 04:38:44 -07:00
|
|
|
if(ALSOFT_INSTALL_AMBDEC_PRESETS)
|
|
|
|
install(DIRECTORY presets
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/openal)
|
|
|
|
message(STATUS "Installing AmbDec presets")
|
|
|
|
endif()
|
2020-05-07 00:02:23 -07:00
|
|
|
message(STATUS "")
|
2016-04-23 17:29:51 -07:00
|
|
|
|
2020-08-12 17:40:00 -07:00
|
|
|
set(UNICODE_FLAG )
|
|
|
|
if(MINGW)
|
|
|
|
set(UNICODE_FLAG ${UNICODE_FLAG} -municode)
|
|
|
|
endif()
|
2020-04-15 00:21:36 -07:00
|
|
|
set(EXTRA_INSTALLS )
|
2020-04-14 23:25:47 -07:00
|
|
|
if(ALSOFT_UTILS)
|
2020-06-11 08:42:30 -07:00
|
|
|
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})
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(openal-info PRIVATE ${LINKER_FLAGS} OpenAL ${UNICODE_FLAG})
|
2020-04-15 00:21:36 -07:00
|
|
|
if(ALSOFT_INSTALL_EXAMPLES)
|
|
|
|
set(EXTRA_INSTALLS ${EXTRA_INSTALLS} openal-info)
|
|
|
|
endif()
|
2012-03-22 22:45:03 -07:00
|
|
|
|
2019-01-21 10:23:17 -08:00
|
|
|
find_package(MySOFA)
|
|
|
|
if(MYSOFA_FOUND)
|
2019-12-11 00:48:03 -08:00
|
|
|
set(SOFA_SUPPORT_SRCS
|
|
|
|
utils/sofa-support.cpp
|
|
|
|
utils/sofa-support.h)
|
|
|
|
add_library(sofa-support STATIC EXCLUDE_FROM_ALL ${SOFA_SUPPORT_SRCS})
|
|
|
|
target_compile_definitions(sofa-support PRIVATE ${CPP_DEFS})
|
|
|
|
target_include_directories(sofa-support PUBLIC ${OpenAL_SOURCE_DIR}/common)
|
|
|
|
target_compile_options(sofa-support PRIVATE ${C_FLAGS})
|
|
|
|
target_link_libraries(sofa-support PUBLIC common MySOFA::MySOFA PRIVATE ${LINKER_FLAGS})
|
|
|
|
|
2019-03-24 17:31:10 -07:00
|
|
|
set(MAKEMHR_SRCS
|
|
|
|
utils/makemhr/loaddef.cpp
|
|
|
|
utils/makemhr/loaddef.h
|
|
|
|
utils/makemhr/loadsofa.cpp
|
|
|
|
utils/makemhr/loadsofa.h
|
2019-03-24 19:00:58 -07:00
|
|
|
utils/makemhr/makemhr.cpp
|
|
|
|
utils/makemhr/makemhr.h)
|
2019-01-22 11:13:14 -08:00
|
|
|
if(NOT HAVE_GETOPT)
|
2019-03-24 17:31:10 -07:00
|
|
|
set(MAKEMHR_SRCS ${MAKEMHR_SRCS} utils/getopt.c utils/getopt.h)
|
2019-01-22 11:13:14 -08:00
|
|
|
endif()
|
2019-03-24 17:31:10 -07:00
|
|
|
add_executable(makemhr ${MAKEMHR_SRCS})
|
|
|
|
target_compile_definitions(makemhr PRIVATE ${CPP_DEFS})
|
2019-04-29 20:03:51 -07:00
|
|
|
target_include_directories(makemhr
|
2019-12-11 00:48:03 -08:00
|
|
|
PRIVATE ${OpenAL_BINARY_DIR} ${OpenAL_SOURCE_DIR}/utils)
|
2019-03-24 17:31:10 -07:00
|
|
|
target_compile_options(makemhr PRIVATE ${C_FLAGS})
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(makemhr PRIVATE ${LINKER_FLAGS} sofa-support ${UNICODE_FLAG})
|
2020-04-15 00:21:36 -07:00
|
|
|
if(ALSOFT_INSTALL_EXAMPLES)
|
|
|
|
set(EXTRA_INSTALLS ${EXTRA_INSTALLS} makemhr)
|
|
|
|
endif()
|
2019-01-22 11:13:14 -08:00
|
|
|
|
2019-01-21 10:23:17 -08:00
|
|
|
set(SOFAINFO_SRCS utils/sofa-info.cpp)
|
|
|
|
add_executable(sofa-info ${SOFAINFO_SRCS})
|
|
|
|
target_compile_definitions(sofa-info PRIVATE ${CPP_DEFS})
|
2019-12-11 00:48:03 -08:00
|
|
|
target_include_directories(sofa-info PRIVATE ${OpenAL_SOURCE_DIR}/utils)
|
2019-01-21 10:23:17 -08:00
|
|
|
target_compile_options(sofa-info PRIVATE ${C_FLAGS})
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(sofa-info PRIVATE ${LINKER_FLAGS} sofa-support ${UNICODE_FLAG})
|
2019-01-21 10:23:17 -08:00
|
|
|
endif()
|
2020-04-14 23:37:48 -07:00
|
|
|
message(STATUS "Building utility programs")
|
2020-04-15 00:09:45 -07:00
|
|
|
|
|
|
|
if(NOT ALSOFT_NO_CONFIG_UTIL)
|
|
|
|
add_subdirectory(utils/alsoft-config)
|
2020-04-14 23:37:48 -07:00
|
|
|
endif()
|
|
|
|
message(STATUS "")
|
2020-04-14 23:25:47 -07:00
|
|
|
endif()
|
2012-01-01 12:36:41 -08:00
|
|
|
|
2019-09-24 01:16:57 -07:00
|
|
|
|
|
|
|
# Add a static library with common functions used by multiple example targets
|
2020-06-11 08:42:30 -07:00
|
|
|
add_library(ex-common STATIC EXCLUDE_FROM_ALL
|
2019-10-01 19:56:39 -07:00
|
|
|
examples/common/alhelpers.c
|
|
|
|
examples/common/alhelpers.h)
|
2020-06-11 08:42:30 -07:00
|
|
|
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})
|
2019-07-29 13:46:25 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
if(ALSOFT_EXAMPLES)
|
|
|
|
add_executable(altonegen examples/altonegen.c)
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(altonegen PRIVATE ${LINKER_FLAGS} ${MATH_LIB} ex-common ${UNICODE_FLAG})
|
2016-07-12 19:05:56 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
add_executable(alrecord examples/alrecord.c)
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(alrecord PRIVATE ${LINKER_FLAGS} ex-common ${UNICODE_FLAG})
|
2017-06-23 05:19:24 -07:00
|
|
|
|
2020-04-14 23:25:47 -07:00
|
|
|
if(ALSOFT_INSTALL_EXAMPLES)
|
2020-04-15 00:21:36 -07:00
|
|
|
set(EXTRA_INSTALLS ${EXTRA_INSTALLS} altonegen alrecord)
|
2020-04-14 23:25:47 -07:00
|
|
|
endif()
|
2017-06-23 05:19:24 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
message(STATUS "Building example programs")
|
2017-06-23 05:19:24 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
if(SNDFILE_FOUND)
|
|
|
|
add_executable(alplay examples/alplay.c)
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(alplay PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common
|
|
|
|
${UNICODE_FLAG})
|
2020-03-24 13:36:49 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
add_executable(alstream examples/alstream.c)
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(alstream PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common
|
|
|
|
${UNICODE_FLAG})
|
2020-03-24 15:46:47 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
add_executable(alreverb examples/alreverb.c)
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(alreverb PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common
|
|
|
|
${UNICODE_FLAG})
|
2020-03-24 15:46:47 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
add_executable(almultireverb examples/almultireverb.c)
|
|
|
|
target_link_libraries(almultireverb
|
2020-08-12 17:40:00 -07:00
|
|
|
PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common ${MATH_LIB} ${UNICODE_FLAG})
|
2020-03-24 15:46:47 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
add_executable(allatency examples/allatency.c)
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(allatency PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common
|
|
|
|
${UNICODE_FLAG})
|
2020-03-24 15:46:47 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
add_executable(alhrtf examples/alhrtf.c)
|
|
|
|
target_link_libraries(alhrtf
|
2020-08-12 17:40:00 -07:00
|
|
|
PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common ${MATH_LIB} ${UNICODE_FLAG})
|
2020-03-24 15:46:47 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
add_executable(alstreamcb examples/alstreamcb.cpp)
|
2020-08-12 17:40:00 -07:00
|
|
|
target_link_libraries(alstreamcb PRIVATE ${LINKER_FLAGS} SndFile::SndFile ex-common
|
|
|
|
${UNICODE_FLAG})
|
2020-03-24 15:46:47 -07:00
|
|
|
|
2020-08-25 04:59:04 -07:00
|
|
|
add_executable(alconvolve examples/alconvolve.cpp)
|
|
|
|
target_link_libraries(alconvolve PRIVATE ${LINKER_FLAGS} common SndFile::SndFile ex-common
|
|
|
|
${UNICODE_FLAG})
|
|
|
|
|
2020-04-14 23:25:47 -07:00
|
|
|
if(ALSOFT_INSTALL_EXAMPLES)
|
2020-04-15 00:21:36 -07:00
|
|
|
set(EXTRA_INSTALLS ${EXTRA_INSTALLS} alplay alstream alreverb almultireverb allatency
|
|
|
|
alhrtf)
|
2020-04-14 23:25:47 -07:00
|
|
|
endif()
|
2020-03-24 13:36:49 -07:00
|
|
|
|
2020-04-19 04:00:01 -07:00
|
|
|
message(STATUS "Building SndFile example programs")
|
|
|
|
endif()
|
2020-03-24 13:36:49 -07:00
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
if(SDL2_FOUND)
|
|
|
|
add_executable(alloopback examples/alloopback.c)
|
|
|
|
target_include_directories(alloopback PRIVATE ${SDL2_INCLUDE_DIR})
|
|
|
|
target_link_libraries(alloopback
|
2020-03-24 15:46:47 -07:00
|
|
|
PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ex-common ${MATH_LIB})
|
2017-02-12 08:37:42 -08:00
|
|
|
|
2020-04-14 23:25:47 -07:00
|
|
|
if(ALSOFT_INSTALL_EXAMPLES)
|
2020-04-15 00:21:36 -07:00
|
|
|
set(EXTRA_INSTALLS ${EXTRA_INSTALLS} alloopback)
|
2020-04-14 23:25:47 -07:00
|
|
|
endif()
|
2012-01-01 12:36:41 -08:00
|
|
|
|
2020-06-11 08:42:30 -07:00
|
|
|
message(STATUS "Building SDL example programs")
|
|
|
|
|
|
|
|
set(FFVER_OK FALSE)
|
|
|
|
if(FFMPEG_FOUND)
|
|
|
|
set(FFVER_OK TRUE)
|
|
|
|
if(AVFORMAT_VERSION VERSION_LESS "57.56.101")
|
|
|
|
message(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 57.56.101)")
|
|
|
|
set(FFVER_OK FALSE)
|
|
|
|
endif()
|
|
|
|
if(AVCODEC_VERSION VERSION_LESS "57.64.101")
|
|
|
|
message(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 57.64.101)")
|
|
|
|
set(FFVER_OK FALSE)
|
|
|
|
endif()
|
|
|
|
if(AVUTIL_VERSION VERSION_LESS "55.34.101")
|
|
|
|
message(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 55.34.101)")
|
|
|
|
set(FFVER_OK FALSE)
|
|
|
|
endif()
|
|
|
|
if(SWSCALE_VERSION VERSION_LESS "4.2.100")
|
|
|
|
message(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 4.2.100)")
|
|
|
|
set(FFVER_OK FALSE)
|
|
|
|
endif()
|
|
|
|
if(SWRESAMPLE_VERSION VERSION_LESS "2.3.100")
|
|
|
|
message(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 2.3.100)")
|
|
|
|
set(FFVER_OK FALSE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(FFVER_OK)
|
|
|
|
add_executable(alffplay examples/alffplay.cpp)
|
|
|
|
target_include_directories(alffplay
|
2017-12-15 12:25:50 -08:00
|
|
|
PRIVATE ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
|
2020-06-11 08:42:30 -07:00
|
|
|
target_link_libraries(alffplay
|
2019-04-29 23:59:36 +02:00
|
|
|
PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} ex-common)
|
2014-06-02 17:33:11 -07:00
|
|
|
|
2020-04-14 23:25:47 -07:00
|
|
|
if(ALSOFT_INSTALL_EXAMPLES)
|
2020-04-15 00:21:36 -07:00
|
|
|
set(EXTRA_INSTALLS ${EXTRA_INSTALLS} alffplay)
|
2020-04-14 23:25:47 -07:00
|
|
|
endif()
|
|
|
|
message(STATUS "Building SDL+FFmpeg example programs")
|
2020-06-11 08:42:30 -07:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
message(STATUS "")
|
|
|
|
endif()
|
2020-04-15 00:21:36 -07:00
|
|
|
|
|
|
|
if(EXTRA_INSTALLS)
|
|
|
|
install(TARGETS ${EXTRA_INSTALLS}
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2020-08-24 14:09:02 -07:00
|
|
|
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2020-04-15 00:21:36 -07:00
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
endif()
|