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 20, 2020
1 parent 6dae817 commit 08a8df1
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 14 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
1 change: 0 additions & 1 deletion Sources/Plasma/Apps/plClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,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
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})
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
15 changes: 15 additions & 0 deletions vcpkg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bzip2
curl
expat
freetype
libjpeg-turbo
libogg
libpng
libvorbis
libvpx
openal-soft
openssl
opus
speex
string-theory
zlib

0 comments on commit 08a8df1

Please sign in to comment.