Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

small updates

- correct issues with cmake
- fix mismatched include guard
- missing includes
- only copy memory if len > 0
  • Loading branch information...
commit 668ad1f2ae88241d244a171388e929991a97de30 1 parent cb0f189
Edward Rudd urkle authored
74 CMakeLists.txt
View
@@ -6,7 +6,7 @@ set(OALWrapper_VERSION_MINOR 0)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts)
-SET(PRIVATE_LIB_DIR
+SET(PRIVATE_LIB_DIR ""
CACHE PATH "Location of local private library path to use"
)
IF(NOT APP_PRIVATE_LIB_DIR AND PRIVATE_LIB_DIR)
@@ -42,55 +42,26 @@ IF(APP_PRIVATE_LIB_DIR AND "${CMAKE_SYSTEM}" MATCHES "Linux")
MESSAGE(FATAL_ERROR "could not find lib directory in private lib dir ${APP_PRIVATE_LIB_DIR}")
ENDIF()
- IF(EXISTS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libogg.so)
- SET(OGG_LIBRARY "${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libogg.so" CACHE FILEPATH "Ogg")
- ENDIF()
- IF(NOT OGG_LIBRARY)
- MESSAGE(FATAL_ERROR "Could not find ogg library")
- ENDIF()
-
- IF(EXISTS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libvorbis.so)
- SET(VORBIS_LIBRARY "${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libvorbis.so" CACHE FILEPATH "Vorbis")
- ENDIF()
- IF(NOT VORBIS_LIBRARY)
- MESSAGE(FATAL_ERROR "Could not find vorbis library")
- ENDIF()
+ FIND_LIBRARY(OGG_LIBRARY ogg PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} PATH_SUFFIXES lib NO_DEFAULT_PATH)
+ FIND_LIBRARY(VORBIS_LIBRARY vorbis PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} PATH_SUFFIXES lib NO_DEFAULT_PATH)
+ FIND_LIBRARY(VORBISFILE_LIBRARY vorbisfile PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} PATH_SUFFIXES lib NO_DEFAULT_PATH)
- IF(EXISTS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libvorbisfile.so)
- SET(VORBISFILE_LIBRARY "${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libvorbisfile.so" CACHE FILEPATH "VorbisFile")
- ENDIF()
- IF(NOT VORBISFILE_LIBRARY)
- MESSAGE(FATAL_ERROR "Could not find vorbisfile library")
- ENDIF()
-
- IF(EXISTS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libopenal.so)
- SET(OPENAL_LIBRARY "${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libopenal.so" CACHE FILEPATH "OpenAL")
- ENDIF()
- IF(NOT OPENAL_LIBRARY)
- MESSAGE(FATAL_ERROR "Could not find openal library")
- ENDIF()
+ FIND_LIBRARY(OPENAL_LIBRARY openal PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} PATH_SUFFIXES lib NO_DEFAULT_PATH)
- if(USE_SDL2)
- IF(EXISTS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libSDL2.so)
- SET(SDL_LIBRARY "${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libSDL2.so" CACHE FILEPATH "SDL")
- FIND_PATH(SDL_INCLUDE_DIR SDL.h
- PATHS ${APP_PRIVATE_LIB_DIR}/include
- PATH_SUFFIXES SDL2
- NO_DEFAULT_PATH
- )
- ENDIF()
+ IF(USE_SDL2)
+ FIND_LIBRARY(SDL_LIBRARY SDL2 PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} PATH_SUFFIXES lib NO_DEFAULT_PATH)
+ FIND_PATH(SDL_INCLUDE_DIR SDL.h
+ PATHS ${APP_PRIVATE_LIB_DIR}/include
+ PATH_SUFFIXES SDL2
+ NO_DEFAULT_PATH
+ )
ELSE()
- IF(EXISTS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libSDL.so)
- SET(SDL_LIBRARY "${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX}/libSDL.so" CACHE FILEPATH "SDL")
- FIND_PATH(SDL_INCLUDE_DIR SDL.h
- PATHS ${APP_PRIVATE_LIB_DIR}/include
- PATH_SUFFIXES SDL
- NO_DEFAULT_PATH
- )
- ENDIF()
- ENDIF()
- IF(NOT SDL_LIBRARY)
- MESSAGE(FATAL_ERROR "Could not find SDL library")
+ FIND_LIBRARY(SDL_LIBRARY SDL PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} PATH_SUFFIXES lib NO_DEFAULT_PATH)
+ FIND_PATH(SDL_INCLUDE_DIR SDL.h
+ PATHS ${APP_PRIVATE_LIB_DIR}/include
+ PATH_SUFFIXES SDL
+ NO_DEFAULT_PATH
+ )
ENDIF()
ELSEIF(APP_PRIVATE_LIB_DIR AND EMSCRIPTEN)
SET(PRIVATE_LIB_SUFFIX emscripten)
@@ -109,6 +80,7 @@ ELSEIF(APP_PRIVATE_LIB_DIR AND EMSCRIPTEN)
PATHS ${APP_PRIVATE_LIB_DIR}/include
PATH_SUFFIXES SDL2
NO_DEFAULT_PATH
+ NO_CMAKE_FIND_ROOT_PATH
)
# We don't need to find an OpenAL library as it's built-in to emscripten
@@ -122,9 +94,15 @@ ELSEIF(APP_PRIVATE_LIB_DIR AND APPLE)
FIND_LIBRARY(VORBIS_LIBRARY vorbis PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} NO_DEFAULT_PATH)
FIND_LIBRARY(VORBISFILE_LIBRARY vorbisfile PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} NO_DEFAULT_PATH)
else()
- SET(PRIVATE_LIB_SUFFIX macosx)
+ IF(NOT PRIVATE_LIB_SUFFIX)
+ SET(PRIVATE_LIB_SUFFIX macosx)
+ ENDIF()
+ SET(EXTRA_INCLUDE_DIR ${APP_PRIVATE_LIB_DIR}/include)
FIND_LIBRARY(OGG_LIBRARY Ogg PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} NO_DEFAULT_PATH)
FIND_LIBRARY(VORBIS_LIBRARY Vorbis PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} NO_DEFAULT_PATH)
+ if (VORBIS_LIBRARY AND NOT VORBIS_LIBRARY MATCHES /.framework$/)
+ FIND_LIBRARY(VORBISFILE_LIBRARY vorbisfile PATHS ${APP_PRIVATE_LIB_DIR}/${PRIVATE_LIB_SUFFIX} NO_DEFAULT_PATH)
+ endif()
endif()
IF(USE_SDL2)
2  include/OALWrapper/OAL_CustomStream.h
View
@@ -13,7 +13,7 @@
Declaration of class for containing Custom streams
*/
-#ifndef _OAL_CUSTMSTREAM_H
+#ifndef _OAL_CUSTOMSTREAM_H
#define _OAL_CUSTOMSTREAM_H
#include "OAL_Stream.h"
2  sources/OAL_Device.cpp
View
@@ -721,8 +721,8 @@ void cOAL_Device::SetDistanceModel(eOAL_DistanceModel aModel)
distModel = AL_EXPONENT_DISTANCE_CLAMPED;
break;
case eOAL_DistanceModel_None:
- distModel = AL_NONE;
default:
+ distModel = AL_NONE;
break;
}
4 sources/OAL_OggStream.cpp
View
@@ -18,6 +18,7 @@
#include "OALWrapper/OAL_Buffer.h"
#include <cstdio>
#include <cstdlib>
+#include <cstring>
using namespace std;
@@ -44,7 +45,8 @@ size_t memoryRead(void * buff, size_t b, size_t nelts, void *data)
if (of->buff_pos + len > of->buff_size) {
len = of->buff_size - of->buff_pos;
}
- memcpy(buff, of->buff + of->buff_pos, len );
+ if (len)
+ memcpy(buff, of->buff + of->buff_pos, len );
of->buff_pos += len;
return len;
}
Please sign in to comment.
Something went wrong with that request. Please try again.