From c70b378cec617d9e7280efe8ece92a2f9f3a1571 Mon Sep 17 00:00:00 2001 From: Dmitry Pankov Date: Mon, 22 Aug 2022 22:47:56 +0300 Subject: [PATCH] Fix linux build --- CMakeLists.txt | 17 ++++-- CMakeScripts/FindOGG.cmake | 75 ------------------------- CMakeScripts/FindVorbis.cmake | 83 ---------------------------- CMakeScripts/FindVorbisFile.cmake | 91 ------------------------------- sources/OAL_Device.cpp | 2 +- 5 files changed, 12 insertions(+), 256 deletions(-) delete mode 100644 CMakeScripts/FindOGG.cmake delete mode 100644 CMakeScripts/FindVorbis.cmake delete mode 100644 CMakeScripts/FindVorbisFile.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 31d4800..3fa8918 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,15 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.9) project (OALWrapper) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + add_compile_options(-fdiagnostics-color=always) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_compile_options(-fcolor-diagnostics) +endif() + set(OALWrapper_VERSION_MAJOR 1) set(OALWrapper_VERSION_MINOR 0) @@ -119,11 +128,7 @@ ELSEIF(APP_PRIVATE_LIB_DIR AND APPLE) FIND_PACKAGE(OpenAL) ELSE() - FIND_PACKAGE(OGG) - FIND_PACKAGE(Vorbis) - IF(NOT(APPLE)) - FIND_PACKAGE(VorbisFile) - ENDIF() + FIND_PACKAGE(Ogg) FIND_PACKAGE(OpenAL) IF(USE_SDL2) FIND_PACKAGE(SDL2) diff --git a/CMakeScripts/FindOGG.cmake b/CMakeScripts/FindOGG.cmake deleted file mode 100644 index 8b00a42..0000000 --- a/CMakeScripts/FindOGG.cmake +++ /dev/null @@ -1,75 +0,0 @@ -# Locate OGG -# This module defines XXX_FOUND, XXX_INCLUDE_DIRS and XXX_LIBRARIES standard variables -# -# $OGGDIR is an environment variable that would -# correspond to the ./configure --prefix=$OGGDIR -# used in building OGG. - -SET(OGG_SEARCH_PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) - -SET(MSVC_YEAR_NAME) -IF (MSVC_VERSION GREATER 1599) # >= 1600 - SET(MSVC_YEAR_NAME VS2010) -ELSEIF(MSVC_VERSION GREATER 1499) # >= 1500 - SET(MSVC_YEAR_NAME VS2008) -ELSEIF(MSVC_VERSION GREATER 1399) # >= 1400 - SET(MSVC_YEAR_NAME VS2005) -ELSEIF(MSVC_VERSION GREATER 1299) # >= 1300 - SET(MSVC_YEAR_NAME VS2003) -ELSEIF(MSVC_VERSION GREATER 1199) # >= 1200 - SET(MSVC_YEAR_NAME VS6) -ENDIF() - -FIND_PATH(OGG_INCLUDE_DIR - NAMES ogg/ogg.h ogg/os_types.h - HINTS ENV OGGDIR - PATH_SUFFIXES include - PATHS ${OGG_SEARCH_PATHS} -) - -FIND_LIBRARY(OGG_LIBRARY - NAMES ogg libogg - HINTS ENV OGGDIR - PATH_SUFFIXES lib lib64 win32/Dynamic_Release "Win32/${MSVC_YEAR_NAME}/x64/Release" "Win32/${MSVC_YEAR_NAME}/Win32/Release" - PATHS ${OGG_SEARCH_PATHS} -) - -# First search for d-suffixed libs -FIND_LIBRARY(OGG_LIBRARY_DEBUG - NAMES oggd ogg_d liboggd libogg_d - HINTS ENV OGGDIR - PATH_SUFFIXES lib lib64 win32/Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" - PATHS ${OGG_SEARCH_PATHS} -) - -IF(NOT OGG_LIBRARY_DEBUG) - # Then search for non suffixed libs if necessary, but only in debug dirs - FIND_LIBRARY(OGG_LIBRARY_DEBUG - NAMES ogg libogg - HINTS ENV OGGDIR - PATH_SUFFIXES win32/Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" - PATHS ${OGG_SEARCH_PATHS} - ) -ENDIF() - - -IF(OGG_LIBRARY) - IF(OGG_LIBRARY_DEBUG) - SET(OGG_LIBRARIES optimized "${OGG_LIBRARY}" debug "${OGG_LIBRARY_DEBUG}") - ELSE() - SET(OGG_LIBRARIES "${OGG_LIBRARY}") # Could add "general" keyword, but it is optional - ENDIF() -ENDIF() - -# handle the QUIETLY and REQUIRED arguments and set XXX_FOUND to TRUE if all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGG DEFAULT_MSG OGG_LIBRARIES OGG_INCLUDE_DIR) diff --git a/CMakeScripts/FindVorbis.cmake b/CMakeScripts/FindVorbis.cmake deleted file mode 100644 index 36aa2c1..0000000 --- a/CMakeScripts/FindVorbis.cmake +++ /dev/null @@ -1,83 +0,0 @@ -# Locate Vorbis -# This module defines XXX_FOUND, XXX_INCLUDE_DIRS and XXX_LIBRARIES standard variables -# -# $VORBISDIR is an environment variable that would -# correspond to the ./configure --prefix=$VORBISDIR -# used in building Vorbis. - -SET(VORBIS_SEARCH_PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) - -SET(MSVC_YEAR_NAME) -IF (MSVC_VERSION GREATER 1599) # >= 1600 - SET(MSVC_YEAR_NAME VS2010) -ELSEIF(MSVC_VERSION GREATER 1499) # >= 1500 - SET(MSVC_YEAR_NAME VS2008) -ELSEIF(MSVC_VERSION GREATER 1399) # >= 1400 - SET(MSVC_YEAR_NAME VS2005) -ELSEIF(MSVC_VERSION GREATER 1299) # >= 1300 - SET(MSVC_YEAR_NAME VS2003) -ELSEIF(MSVC_VERSION GREATER 1199) # >= 1200 - SET(MSVC_YEAR_NAME VS6) -ENDIF() - -FIND_PATH(VORBIS_INCLUDE_DIR - NAMES vorbis/codec.h - HINTS - $ENV{VORBISDIR} - $ENV{VORBIS_PATH} - PATH_SUFFIXES include - PATHS ${VORBIS_SEARCH_PATHS} -) - -FIND_LIBRARY(VORBIS_LIBRARY - NAMES vorbis libvorbis - HINTS - $ENV{VORBISDIR} - $ENV{VORBIS_PATH} - PATH_SUFFIXES lib lib64 win32/Vorbis_Dynamic_Release "Win32/${MSVC_YEAR_NAME}/x64/Release" "Win32/${MSVC_YEAR_NAME}/Win32/Release" - PATHS ${VORBIS_SEARCH_PATHS} -) - -# First search for d-suffixed libs -FIND_LIBRARY(VORBIS_LIBRARY_DEBUG - NAMES vorbisd vorbis_d libvorbisd libvorbis_d - HINTS - $ENV{VORBISDIR} - $ENV{VORBIS_PATH} - PATH_SUFFIXES lib lib64 win32/Vorbis_Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" - PATHS ${VORBIS_SEARCH_PATHS} -) - -IF(NOT VORBIS_LIBRARY_DEBUG) - # Then search for non suffixed libs if necessary, but only in debug dirs - FIND_LIBRARY(VORBIS_LIBRARY_DEBUG - NAMES vorbis libvorbis - HINTS - $ENV{VORBISDIR} - $ENV{VORBIS_PATH} - PATH_SUFFIXES win32/Vorbis_Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" - PATHS ${VORBIS_SEARCH_PATHS} - ) -ENDIF() - - -IF(VORBIS_LIBRARY) - IF(VORBIS_LIBRARY_DEBUG) - SET(VORBIS_LIBRARIES optimized "${VORBIS_LIBRARY}" debug "${VORBIS_LIBRARY_DEBUG}") - ELSE() - SET(VORBIS_LIBRARIES "${VORBIS_LIBRARY}") # Could add "general" keyword, but it is optional - ENDIF() -ENDIF() - -# handle the QUIETLY and REQUIRED arguments and set XXX_FOUND to TRUE if all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(VORBIS DEFAULT_MSG VORBIS_LIBRARIES VORBIS_INCLUDE_DIR) diff --git a/CMakeScripts/FindVorbisFile.cmake b/CMakeScripts/FindVorbisFile.cmake deleted file mode 100644 index b16c69b..0000000 --- a/CMakeScripts/FindVorbisFile.cmake +++ /dev/null @@ -1,91 +0,0 @@ -# Locate VorbisFile -# This module defines XXX_FOUND, XXX_INCLUDE_DIRS and XXX_LIBRARIES standard variables -# -# $VORBISDIR is an environment variable that would -# correspond to the ./configure --prefix=$VORBISDIR -# used in building Vorbis. - -SET(VORBISFILE_SEARCH_PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local - /usr - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) - -SET(MSVC_YEAR_NAME) -IF (MSVC_VERSION GREATER 1599) # >= 1600 - SET(MSVC_YEAR_NAME VS2010) -ELSEIF(MSVC_VERSION GREATER 1499) # >= 1500 - SET(MSVC_YEAR_NAME VS2008) -ELSEIF(MSVC_VERSION GREATER 1399) # >= 1400 - SET(MSVC_YEAR_NAME VS2005) -ELSEIF(MSVC_VERSION GREATER 1299) # >= 1300 - SET(MSVC_YEAR_NAME VS2003) -ELSEIF(MSVC_VERSION GREATER 1199) # >= 1200 - SET(MSVC_YEAR_NAME VS6) -ENDIF() - -FIND_PATH(VORBISFILE_INCLUDE_DIR - NAMES vorbis/vorbisfile.h - HINTS - $ENV{VORBISFILEDIR} - $ENV{VORBISFILE_PATH} - $ENV{VORBISDIR} - $ENV{VORBIS_PATH} - PATH_SUFFIXES include - PATHS ${VORBISFILE_SEARCH_PATHS} -) - -FIND_LIBRARY(VORBISFILE_LIBRARY - NAMES vorbisfile libvorbisfile - HINTS - $ENV{VORBISFILEDIR} - $ENV{VORBISFILE_PATH} - $ENV{VORBISDIR} - $ENV{VORBIS_PATH} - PATH_SUFFIXES lib lib64 win32/VorbisFile_Dynamic_Release "Win32/${MSVC_YEAR_NAME}/x64/Release" "Win32/${MSVC_YEAR_NAME}/Win32/Release" - PATHS ${VORBISFILE_SEARCH_PATHS} -) - -# First search for d-suffixed libs -FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG - NAMES vorbisfiled vorbisfile_d libvorbisfiled libvorbisfile_d - HINTS - $ENV{VORBISFILEDIR} - $ENV{VORBISFILE_PATH} - $ENV{VORBISDIR} - $ENV{VORBIS_PATH} - PATH_SUFFIXES lib lib64 win32/VorbisFile_Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" - PATHS ${VORBISFILE_SEARCH_PATHS} -) - -IF(NOT VORBISFILE_LIBRARY_DEBUG) - # Then search for non suffixed libs if necessary, but only in debug dirs - FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG - NAMES vorbisfile libvorbisfile - HINTS - $ENV{VORBISFILEDIR} - $ENV{VORBISFILE_PATH} - $ENV{VORBISDIR} - $ENV{VORBIS_PATH} - PATH_SUFFIXES win32/VorbisFile_Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" - PATHS ${VORBISFILE_SEARCH_PATHS} - ) -ENDIF() - - -IF(VORBISFILE_LIBRARY) - IF(VORBISFILE_LIBRARY_DEBUG) - SET(VORBISFILE_LIBRARIES optimized "${VORBISFILE_LIBRARY}" debug "${VORBISFILE_LIBRARY_DEBUG}") - ELSE() - SET(VORBISFILE_LIBRARIES "${VORBISFILE_LIBRARY}") # Could add "general" keyword, but it is optional - ENDIF() -ENDIF() - -# handle the QUIETLY and REQUIRED arguments and set XXX_FOUND to TRUE if all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(VORBISFILE DEFAULT_MSG VORBISFILE_LIBRARIES VORBISFILE_INCLUDE_DIR) diff --git a/sources/OAL_Device.cpp b/sources/OAL_Device.cpp index 4e88cd7..33bb945 100644 --- a/sources/OAL_Device.cpp +++ b/sources/OAL_Device.cpp @@ -92,7 +92,7 @@ bool cOAL_Device::Init( cOAL_Init_Params& acParams ) LogMsg("",eOAL_LogVerbose_Low, eOAL_LogMsg_Info, "Attempting to open device...\n" ); // Open the device, if fails return false - if(acParams.msDeviceName.empty()) + if(acParams.msDeviceName.empty() || acParams.msDeviceName.compare("NULL") == 0) mpDevice = alcOpenDevice(NULL); else mpDevice = alcOpenDevice( acParams.msDeviceName.c_str() );