mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-22 11:13:59 +00:00
Add support for cmake to look for libpng and then add the proper files if available.
This commit is contained in:
parent
6d39ab49c1
commit
afd1e274fd
5 changed files with 33 additions and 4 deletions
|
@ -8,6 +8,15 @@ SET( HEADERS
|
|||
ImageFile.h
|
||||
)
|
||||
|
||||
FIND_PACKAGE( PNG )
|
||||
IF( PNG_FOUND )
|
||||
INCLUDE_DIRECTORIES( ${PNG_INCLUDE_DIR} )
|
||||
TARGET_LINK_LIBRARIES( ${PNG_LIBRARY} )
|
||||
|
||||
SET( SOURCES ${SOURCES} ImageLoaderPNG.cpp )
|
||||
SET( HEADERS ${HEADERS} ImageLoaderPNG.h )
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE(
|
||||
"ImageLoader.h.in"
|
||||
"ImageLoader.h"
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
#include "ImageFile.h"
|
||||
#include <string.h>
|
||||
#include "ImageFile.h"
|
||||
|
||||
#ifdef PNG_FOUND
|
||||
# include "ImageLoaderPNG.h"
|
||||
#endif
|
||||
|
||||
ImageFile::ImageFile(const char *filename) :
|
||||
m_PixelData(0),
|
||||
|
|
|
@ -43,4 +43,6 @@ class ImageLoader {
|
|||
unsigned char * GetAlphaPixelData() const { return m_AlphaData; }
|
||||
};
|
||||
|
||||
#cmakedefine PNG_FOUND
|
||||
|
||||
#endif // _IMAGE_LOADER_H_
|
||||
|
|
14
IO/ImageLoaderPNG.cpp
Normal file
14
IO/ImageLoaderPNG.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "ImageLoaderPNG.h"
|
||||
|
||||
#include <png.h>
|
||||
|
||||
ImageLoaderPNG::ImageLoaderPNG(const unsigned char *rawData)
|
||||
: ImageLoader(rawData)
|
||||
{
|
||||
}
|
||||
|
||||
ImageLoaderPNG::~ImageLoaderPNG() {
|
||||
}
|
||||
|
||||
void ImageLoaderPNG::ReadData() {
|
||||
}
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
class ImageLoaderPNG : public ImageLoader {
|
||||
public:
|
||||
ImageLoader(const unsigned char *rawData);
|
||||
virtual ~ImageLoader();
|
||||
ImageLoaderPNG(const unsigned char *rawData);
|
||||
virtual ~ImageLoaderPNG();
|
||||
|
||||
void ReadData();
|
||||
virtual void ReadData();
|
||||
};
|
||||
|
||||
#endif // _IMAGE_LOADER_H_
|
||||
|
|
Loading…
Reference in a new issue