project (webp C)
cmake_minimum_required(VERSION 2.6)

add_definitions(-DNDEBUG -DWEBP_USE_THREAD)

set(LIBWEBP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../libwebp")

file(GLOB WEBP_DEC_SRCS
	RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
	${LIBWEBP_SOURCE_DIR}/src/dec/*c
)

file(GLOB WEBP_DEMUX_SRCS
	RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
	${LIBWEBP_SOURCE_DIR}/src/demux/*c
)

file(GLOB WEBP_DSP_SRCS
	RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
	${LIBWEBP_SOURCE_DIR}/src/dsp/*c
)

file(GLOB WEBP_ENC_SRCS
	RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
	${LIBWEBP_SOURCE_DIR}/src/enc/*c
)

file(GLOB WEBP_UTILS_SRCS
	RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
	${LIBWEBP_SOURCE_DIR}/src/utils/*c
)

file(GLOB WEBP_MUX_SRCS
	RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
	${LIBWEBP_SOURCE_DIR}/src/mux/*c
)

file(GLOB WEBP_HEADERS
	RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
	${LIBWEBP_SOURCE_DIR}/src/webp/*.h
)

SET(CMAKE_DEBUG_POSTFIX "d")
set(WEBP_SOURCE ${WEBP_DEC_SRCS} ${WEBP_DEMUX_SRCS} ${WEBP_DSP_SRCS} ${WEBP_ENC_SRCS} ${WEBP_UTILS_SRCS} ${WEBP_MUX_SRC})
add_library(${PROJECT_NAME} STATIC ${WEBP_SOURCE} ${WEBP_HEADERS})
