PROJECT(nvimage)

SET(IMAGE_SRCS	
	nvimage.h
	FloatImage.h
	FloatImage.cpp
	Filter.h
	Filter.cpp
	Image.h
	Image.cpp
	ImageIO.h
	ImageIO.cpp
	ColorBlock.h
	ColorBlock.cpp
	BlockDXT.h
	BlockDXT.cpp
	HoleFilling.h
	HoleFilling.cpp
	DirectDrawSurface.h
	DirectDrawSurface.cpp
	Quantize.h
	Quantize.cpp
	NormalMap.h
	NormalMap.cpp
	NormalMipmap.h
	NormalMipmap.cpp
	PsdFile.h
	TgaFile.h)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

IF(PNG_FOUND)
	SET(LIBS ${LIBS} ${PNG_LIBRARIES})
	INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
ENDIF(PNG_FOUND)

IF(JPEG_FOUND)
	SET(LIBS ${LIBS} ${JPEG_LIBRARIES})
	INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
ENDIF(JPEG_FOUND)

IF(TIFF_FOUND)
	SET(LIBS ${LIBS} ${TIFF_LIBRARIES})
	INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
ENDIF(TIFF_FOUND)

IF(OPENEXR_FOUND)
	SET(LIBS ${LIBS} ${OPENEXR_LIBRARIES})
	INCLUDE_DIRECTORIES(${OPENEXR_INCLUDE_PATHS})
ENDIF(OPENEXR_FOUND)

# targets
ADD_DEFINITIONS(-DNVIMAGE_EXPORTS)

IF(NVIMAGE_SHARED)	
	ADD_DEFINITIONS(-DNVIMAGE_SHARED=1)
	ADD_LIBRARY(nvimage SHARED ${IMAGE_SRCS})
ELSE(NVIMAGE_SHARED)
	ADD_LIBRARY(nvimage ${IMAGE_SRCS})
ENDIF(NVIMAGE_SHARED)

TARGET_LINK_LIBRARIES(nvimage ${LIBS} nvcore nvmath posh)

INSTALL(TARGETS nvimage
	RUNTIME DESTINATION ${BINDIR}
	LIBRARY DESTINATION ${LIBDIR} 
	ARCHIVE DESTINATION ${LIBDIR})

