Only use the PVR loader if the library for loading has been found.

This commit is contained in:
Pavel Krajcevski 2013-08-22 18:08:29 -04:00
parent 07e9c2c531
commit e6bd4b5317
4 changed files with 24 additions and 4 deletions

View file

@ -44,7 +44,6 @@ SET( SOURCES
"src/ImageWriter.cpp"
"src/ImageLoader.cpp"
"src/ImageFile.cpp"
"src/ImageLoaderPVR.cpp"
)
SET( HEADERS
@ -52,7 +51,6 @@ SET( HEADERS
"config/ImageLoader.h.in"
"include/ImageFile.h"
"include/FileStream.h"
"src/ImageLoaderPVR.h"
)
IF( WIN32 )
@ -74,6 +72,12 @@ IF( PNG_FOUND )
SET( HEADERS ${HEADERS} "src/ImageWriterPNG.h" )
ENDIF()
IF( PVRTEXLIB_FOUND )
INCLUDE_DIRECTORIES( ${PVRTEXLIB_INCLUDE_DIRS} )
SET( SOURCES ${SOURCES} "src/ImageLoaderPVR.cpp" )
SET( HEADERS ${HEADERS} "src/ImageLoaderPVR.h" )
ENDIF( PVRTEXLIB_FOUND )
CONFIGURE_FILE(
"config/ImageLoader.h.in"
"include/ImageLoader.h"
@ -94,6 +98,10 @@ ADD_LIBRARY(TexCompIO
)
IF( PNG_FOUND )
TARGET_LINK_LIBRARIES( TexCompIO ${PNG_LIBRARY} )
TARGET_LINK_LIBRARIES( TexCompIO ${PNG_LIBRARY} )
TARGET_LINK_LIBRARIES( TexCompIO ${ZLIB_LIBRARY} )
ENDIF()
IF( PVRTEXLIB_FOUND )
TARGET_LINK_LIBRARIES( TexCompIO ${PVRTEXLIB_LIBRARIES} )
ENDIF()

View file

@ -135,4 +135,8 @@ class ImageLoader {
#cmakedefine PNG_FOUND
#endif // PNG_FOUND
#ifndef PVRTEXLIB_FOUND
#cmakedefine PVRTEXLIB_FOUND
#endif // PVRTEXLIB_FOUND
#endif // _IMAGE_LOADER_H_

View file

@ -87,4 +87,8 @@ class ImageWriter {
#cmakedefine PNG_FOUND
#endif // PNG_FOUND
#ifndef PVRTEXLIB_FOUND
#cmakedefine PVRTEXLIB_FOUND
#endif // PVRTEXLIB_FOUND
#endif // _IMAGE_LOADER_H_

View file

@ -61,7 +61,9 @@
# include "ImageWriterPNG.h"
#endif
#include "ImageLoaderPVR.h"
#ifdef PVRTEXLIB_FOUND
# include "ImageLoaderPVR.h"
#endif
//////////////////////////////////////////////////////////////////////////////////////////
//
@ -174,9 +176,11 @@ Image *ImageFile::LoadImage(const unsigned char *rawImageData) const {
break;
#endif // PNG_FOUND
#ifdef PVRTEXLIB_FOUND
case eFileFormat_PVR:
loader = new ImageLoaderPVR(rawImageData);
break;
#endif // PVRTEXLIB_FOUND
default:
fprintf(stderr, "Unable to load image: unknown file format.\n");