Skip to content

Commit

Permalink
Use openal-soft CMake config when possible.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Hoikas committed May 21, 2020
1 parent 1b40e02 commit 28e57fb
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 31 deletions.
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Sources/Plasma/Apps/plClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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})
Expand Down
2 changes: 0 additions & 2 deletions Sources/Plasma/FeatureLib/pfAudio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Sources/Plasma/FeatureLib/pfCamera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Sources/Plasma/FeatureLib/pfConsole/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Sources/Plasma/FeatureLib/pfPython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include_directories(../../PubUtilLib)
include_directories(../../)

include_directories(${PYTHON_INCLUDE_DIR})
include_directories(${OPENAL_INCLUDE_DIR})

set(pfPython_SOURCES
cyAccountManagement.cpp
Expand Down
2 changes: 0 additions & 2 deletions Sources/Plasma/PubUtilLib/plAudible/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 33 additions & 1 deletion Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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})
2 changes: 0 additions & 2 deletions Sources/Plasma/PubUtilLib/plAvatar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Sources/Plasma/PubUtilLib/plInputCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Sources/Plasma/PubUtilLib/plModifier/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Sources/Plasma/PubUtilLib/plPhysical/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Sources/Plasma/PubUtilLib/plPipeline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions Sources/Tests/FeatureTests/pfPythonTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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})
Expand Down
1 change: 0 additions & 1 deletion Sources/Tools/MaxMain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 28e57fb

Please sign in to comment.