From 28e57fb88da8c9864cbc93aadd5ce695e97b7148 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 20 May 2020 14:39:06 -0400 Subject: [PATCH] Use openal-soft CMake config when possible. This fixes the issue in which trying to build a debug client would fail with compile errors on MSVC due to mismatched iterator debug levels. --- CMakeLists.txt | 7 ---- Sources/Plasma/Apps/plClient/CMakeLists.txt | 2 -- .../Plasma/FeatureLib/pfAudio/CMakeLists.txt | 2 -- .../Plasma/FeatureLib/pfCamera/CMakeLists.txt | 2 -- .../FeatureLib/pfConsole/CMakeLists.txt | 1 - .../Plasma/FeatureLib/pfPython/CMakeLists.txt | 1 - .../PubUtilLib/plAudible/CMakeLists.txt | 2 -- .../Plasma/PubUtilLib/plAudio/CMakeLists.txt | 34 ++++++++++++++++++- .../Plasma/PubUtilLib/plAvatar/CMakeLists.txt | 2 -- .../PubUtilLib/plInputCore/CMakeLists.txt | 1 - .../PubUtilLib/plModifier/CMakeLists.txt | 2 -- .../PubUtilLib/plPhysical/CMakeLists.txt | 2 -- .../PubUtilLib/plPipeline/CMakeLists.txt | 1 - .../FeatureTests/pfPythonTest/CMakeLists.txt | 3 -- Sources/Tools/MaxMain/CMakeLists.txt | 1 - appveyor.yml | 2 +- 16 files changed, 34 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 679ccdb2f8..b48116d31c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,13 +59,6 @@ set_package_properties(OpenSSL PROPERTIES TYPE REQUIRED ) -find_package(OpenAL REQUIRED) -set_package_properties(OpenAL PROPERTIES - URL "http://www.openal.org/" - DESCRIPTION "3D audio and EAX library" - TYPE REQUIRED -) - set(Python_ADDITIONAL_VERSIONS 2.7) find_package(PythonLibs REQUIRED) set_package_properties(PythonLibs PROPERTIES diff --git a/Sources/Plasma/Apps/plClient/CMakeLists.txt b/Sources/Plasma/Apps/plClient/CMakeLists.txt index e8166b1637..503ffa1459 100644 --- a/Sources/Plasma/Apps/plClient/CMakeLists.txt +++ b/Sources/Plasma/Apps/plClient/CMakeLists.txt @@ -7,7 +7,6 @@ include_directories("../../NucleusLib") include_directories("../../PubUtilLib/inc") include_directories("../../PubUtilLib") -include_directories(${OPENAL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${PYTHON_INCLUDE_DIR}) include_directories(${CURL_INCLUDE_DIR}) @@ -160,7 +159,6 @@ target_link_libraries(plClient pnUtils) target_link_libraries(plClient pnUUID) target_link_libraries(plClient ${PYTHON_LIBRARIES}) -target_link_libraries(plClient ${OPENAL_LIBRARY}) target_link_libraries(plClient ${OPENSSL_LIBRARIES}) target_link_libraries(plClient ${EXPAT_LIBRARY}) target_link_libraries(plClient ${JPEG_LIBRARY}) diff --git a/Sources/Plasma/FeatureLib/pfAudio/CMakeLists.txt b/Sources/Plasma/FeatureLib/pfAudio/CMakeLists.txt index a5f69befa6..bf45402945 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/CMakeLists.txt +++ b/Sources/Plasma/FeatureLib/pfAudio/CMakeLists.txt @@ -5,8 +5,6 @@ include_directories(../../NucleusLib/inc) include_directories(../../PubUtilLib) #include_directories(../../PubUtilLib/inc) -include_directories(${OPENAL_INCLUDE_DIR}) - set(pfAudio_SOURCES plListener.cpp plRandomSoundMod.cpp diff --git a/Sources/Plasma/FeatureLib/pfCamera/CMakeLists.txt b/Sources/Plasma/FeatureLib/pfCamera/CMakeLists.txt index 087b488af2..5b0c80f280 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/CMakeLists.txt +++ b/Sources/Plasma/FeatureLib/pfCamera/CMakeLists.txt @@ -4,8 +4,6 @@ include_directories(../../NucleusLib) include_directories(../../NucleusLib/inc) include_directories(../../PubUtilLib) -include_directories(${OPENAL_INCLUDE_DIR}) - set(pfCamera_SOURCES pfCameraProxy.cpp plCameraBrain.cpp diff --git a/Sources/Plasma/FeatureLib/pfConsole/CMakeLists.txt b/Sources/Plasma/FeatureLib/pfConsole/CMakeLists.txt index b5cca38941..d2af6aef76 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/CMakeLists.txt +++ b/Sources/Plasma/FeatureLib/pfConsole/CMakeLists.txt @@ -4,7 +4,6 @@ include_directories(../../NucleusLib) include_directories(../../NucleusLib/inc) include_directories(../../PubUtilLib) -include_directories(${OPENAL_INCLUDE_DIR}) include_directories(${PYTHON_INCLUDE_DIR}) set(pfConsole_SOURCES diff --git a/Sources/Plasma/FeatureLib/pfPython/CMakeLists.txt b/Sources/Plasma/FeatureLib/pfPython/CMakeLists.txt index a5f062a377..ce90ec54e0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/CMakeLists.txt +++ b/Sources/Plasma/FeatureLib/pfPython/CMakeLists.txt @@ -6,7 +6,6 @@ include_directories(../../PubUtilLib) include_directories(../../) include_directories(${PYTHON_INCLUDE_DIR}) -include_directories(${OPENAL_INCLUDE_DIR}) set(pfPython_SOURCES cyAccountManagement.cpp diff --git a/Sources/Plasma/PubUtilLib/plAudible/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plAudible/CMakeLists.txt index 887a02561c..b47832b0df 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plAudible/CMakeLists.txt @@ -3,8 +3,6 @@ include_directories("../../NucleusLib/inc") include_directories("../../NucleusLib") include_directories("../../PubUtilLib") -include_directories(${OPENAL_INCLUDE_DIR}) - set(plAudible_SOURCES plAudibleNull.cpp plWinAudible.cpp diff --git a/Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt index 4a5a83a21c..ad0f2fc1e0 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt @@ -3,10 +3,41 @@ include_directories("../../NucleusLib/inc") include_directories("../../NucleusLib") include_directories("../../PubUtilLib") +# Skip CMake's built in FindOpenAL module and use OpenAL-Soft's config instead, if possible +find_package(OpenAL CONFIG QUIET) +if(NOT TARGET OpenAL::OpenAL) + message(DEBUG "OpenAL CMake Config not found, using FindOpenAL module.") + find_package(OpenAL REQUIRED) + add_library(OpenAL::OpenAL STATIC IMPORTED) + set_target_properties(OpenAL::OpenAL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${OPENAL_INCLUDE_DIR} + IMPORTED_LOCATION ${OPENAL_LIBRARY} + ) + if(WIN32) + set_target_properties(OpenAL::OpenAL PROPERTIES + INTERFACE_LINK_LIBRARIES WinMM + ) + endif() +else() + # Ensure the default RelWithDebInfo and MinSizeRel configs use the Release library with Visual C++. + # Otherwise, compile-time assertions occur due to iterator debug level + if(MSVC) + set_target_properties(OpenAL::OpenAL PROPERTIES + MAP_IMPORTED_CONFIG_MINSIZEREL Release + MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release + ) + endif() +endif() + +set_package_properties(OpenAL PROPERTIES + URL "https://openal-soft.org/" + DESCRIPTION "3D audio and EAX library" + TYPE REQUIRED +) + if(WIN32) include_directories(${DirectX_INCLUDE_DIR}) endif(WIN32) -include_directories(${OPENAL_INCLUDE_DIR}) if(PLASMA_USE_OPUS) include_directories(${Opus_INCLUDE_DIR}) @@ -53,6 +84,7 @@ set(plAudio_HEADERS ) add_library(plAudio STATIC ${plAudio_SOURCES} ${plAudio_HEADERS}) +target_link_libraries(plAudio OpenAL::OpenAL) source_group("Source Files" FILES ${plAudio_SOURCES}) source_group("Header Files" FILES ${plAudio_HEADERS}) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plAvatar/CMakeLists.txt index b45a9a835f..77ca2dfd3d 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plAvatar/CMakeLists.txt @@ -4,8 +4,6 @@ include_directories("../../NucleusLib/inc") include_directories("../../NucleusLib") include_directories("../../PubUtilLib") -include_directories(${OPENAL_INCLUDE_DIR}) - set(plAvatar_SOURCES plAnimStage.cpp plArmatureEffects.cpp diff --git a/Sources/Plasma/PubUtilLib/plInputCore/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plInputCore/CMakeLists.txt index 10d501dbf3..2120c33aff 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plInputCore/CMakeLists.txt @@ -6,7 +6,6 @@ include_directories("../../PubUtilLib") if(WIN32) include_directories(${DirectX_INCLUDE_DIR}) endif(WIN32) -include_directories(${OPENAL_INCLUDE_DIR}) set(plInputCore_SOURCES plAvatarInputInterface.cpp diff --git a/Sources/Plasma/PubUtilLib/plModifier/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plModifier/CMakeLists.txt index a2cd2ee319..b74fbf7c68 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plModifier/CMakeLists.txt @@ -4,8 +4,6 @@ include_directories("../../NucleusLib/inc") include_directories("../../NucleusLib") include_directories("../../PubUtilLib") -include_directories(${OPENAL_INCLUDE_DIR}) - set(plModifier_SOURCES plAGMasterSDLModifier.cpp plAnimEventModifier.cpp diff --git a/Sources/Plasma/PubUtilLib/plPhysical/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plPhysical/CMakeLists.txt index afcf190b04..ed6626976b 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plPhysical/CMakeLists.txt @@ -4,8 +4,6 @@ include_directories("../../NucleusLib/inc") include_directories("../../NucleusLib") include_directories("../../PubUtilLib") -include_directories(${OPENAL_INCLUDE_DIR}) - set(plPhysical_SOURCES plCollisionDetector.cpp plPhysicalProxy.cpp diff --git a/Sources/Plasma/PubUtilLib/plPipeline/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plPipeline/CMakeLists.txt index e5a3618cbb..d61ea47ea4 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plPipeline/CMakeLists.txt @@ -7,7 +7,6 @@ include_directories("../../PubUtilLib") if(PLASMA_PIPELINE STREQUAL "DirectX") include_directories(${DirectX_INCLUDE_DIR}) endif(PLASMA_PIPELINE STREQUAL "DirectX") -include_directories(${OPENAL_INCLUDE_DIR}) set(plPipeline_SOURCES hsG3DDeviceSelector.cpp diff --git a/Sources/Tests/FeatureTests/pfPythonTest/CMakeLists.txt b/Sources/Tests/FeatureTests/pfPythonTest/CMakeLists.txt index add491ffa6..518bc0a21c 100644 --- a/Sources/Tests/FeatureTests/pfPythonTest/CMakeLists.txt +++ b/Sources/Tests/FeatureTests/pfPythonTest/CMakeLists.txt @@ -1,6 +1,5 @@ include_directories(${GTEST_INCLUDE_DIR}) include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) -include_directories(${OPENAL_INCLUDE_DIR}) include_directories(../../../Plasma/CoreLib) include_directories(../../../Plasma/NucleusLib) include_directories(../../../Plasma/NucleusLib/inc) @@ -96,8 +95,6 @@ target_link_libraries(test_pfPython pnUtils) target_link_libraries(test_pfPython pnUUID) target_link_libraries(test_pfPython ${PYTHON_LIBRARIES}) - -target_link_libraries(test_pfPython ${OPENAL_LIBRARY}) target_link_libraries(test_pfPython ${OPENSSL_LIBRARIES}) target_link_libraries(test_pfPython ${EXPAT_LIBRARY}) target_link_libraries(test_pfPython ${JPEG_LIBRARY}) diff --git a/Sources/Tools/MaxMain/CMakeLists.txt b/Sources/Tools/MaxMain/CMakeLists.txt index 63a497f7e8..f046c0d30a 100644 --- a/Sources/Tools/MaxMain/CMakeLists.txt +++ b/Sources/Tools/MaxMain/CMakeLists.txt @@ -98,7 +98,6 @@ target_link_libraries(MaxMain ${DirectX_LIBRARIES}) target_link_libraries(MaxMain ${JPEG_LIBRARY}) target_link_libraries(MaxMain ${PNG_LIBRARY}) target_link_libraries(MaxMain ${Ogg_LIBRARIES}) -target_link_libraries(MaxMain ${OPENAL_LIBRARY}) target_link_libraries(MaxMain ${OPENSSL_LIBRARIES}) target_link_libraries(MaxMain ${PHYSX_LIBRARIES}) target_link_libraries(MaxMain ${PYTHON_LIBRARIES}) diff --git a/appveyor.yml b/appveyor.yml index 9246a5031c..04b8bd917f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -59,7 +59,7 @@ install: git pull 2> $null bootstrap-vcpkg.bat vcpkg integrate install - vcpkg install curl[sspi] expat freetype libjpeg-turbo libogg libpng libtheora libvorbis libvpx opus pcre speex string-theory zlib --triplet x86-windows-static-dyncrt 2> $null + vcpkg install curl[sspi] expat freetype libjpeg-turbo libogg libpng libtheora libvorbis libvpx openal-soft opus pcre speex string-theory zlib --triplet x86-windows-static-dyncrt 2> $null Write-Host "OK" -foregroundColor Green Set-Location $path