PROJECT(k3dsdk-half)

ADD_EXECUTABLE(eLut eLut.cpp)
GET_TARGET_PROPERTY(eLut_EXE eLut LOCATION)

ADD_EXECUTABLE(toFloat toFloat.cpp)
GET_TARGET_PROPERTY(toFloat_EXE toFloat LOCATION)

ADD_CUSTOM_COMMAND(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/eLut.h
	DEPENDS eLut
	COMMAND ${eLut_EXE} > ${CMAKE_CURRENT_BINARY_DIR}/eLut.h
	)

ADD_CUSTOM_COMMAND(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h
	DEPENDS toFloat
	COMMAND ${toFloat_EXE} > ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h
	)

SET(SOURCES
	${CMAKE_CURRENT_BINARY_DIR}/eLut.h
	${CMAKE_CURRENT_BINARY_DIR}/toFloat.h
	half.cpp
	half.h
	halfFunction.h
	halfLimits.h
	)

INCLUDE_DIRECTORIES(${k3dsdk-half_SOURCE_DIR})
INCLUDE_DIRECTORIES(${k3dsdk-half_BINARY_DIR})

K3D_ADD_LIBRARY(k3dsdk-half SHARED ${SOURCES})
K3D_GENERATE_DEF_FILE(k3dsdk-half)

INSTALL(TARGETS k3dsdk-half
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION ${K3D_LIBDIR}
	ARCHIVE DESTINATION ${K3D_LIBDIR}
	)

