
# sources which should be compiled into the keypoint library
SET( SRCS keypoint.cpp        
          lowe_keys/key.c  
          lowe_keys/main.c  
          lowe_keys/util.c )

IF( USE_GPU_SIFT )
    SET( SRCS ${SRCS} 
              SiftGPU/src/SiftGPU/FrameBufferObject.cpp 
              SiftGPU/src/SiftGPU/GlobalUtil.cpp 
              SiftGPU/src/SiftGPU/GLTexImage.cpp
              SiftGPU/src/SiftGPU/ProgramCG.cpp
              SiftGPU/src/SiftGPU/ProgramGLSL.cpp 
              SiftGPU/src/SiftGPU/ProgramGPU.cpp
              SiftGPU/src/SiftGPU/ShaderMan.cpp
              SiftGPU/src/SiftGPU/SiftGPU.cpp
              SiftGPU/src/SiftGPU/SiftMatch.cpp
              SiftGPU/src/SiftGPU/SiftPyramid.cpp 
              SiftGPU/src/SiftGPU/PyramidGL.cpp 
              SiftGPU/src/SiftGPU/CuTexImage.cpp
              SiftGPU/src/SiftGPU/PyramidCU.cpp
              SiftGPU/src/SiftGPU/SiftMatchCU.cpp
   )
ENDIF( USE_GPU_SIFT )


IF(USE_CUDA_SIFT)
   # Compiling cu to c doesn't work for me on coral, but cu to o does - Ian
   #WRAP_CUDA(CUDA_SRCS cudaSift/cudaSiftH.cu cudaSift/cudaImage.cu)
   WRAP_CUDA_OBJ(CUDA_SRCS cudaSift/cudaSiftH.cu cudaSift/cudaImage.cu)
   SET(SRCS ${SRCS} ${CUDA_SRCS} 
            cudaSift/common/cutil.cpp 
            cudaSift/common/stopwatch.cpp 
            cudaSift/common/bank_checker.cpp 
            cudaSift/common/cmd_arg_reader.cpp 
            cudaSift/common/stopwatch_linux.cpp)
ENDIF(USE_CUDA_SIFT)


# Build the library on 'make'
ADD_LIBRARY( keypoint SHARED ${SRCS} )


IF( USE_GPU_SIFT )
   set (GLEW_LIBRARY /usr/lib/libGLEW.so )
ENDIF( USE_GPU_SIFT )


TARGET_LINK_LIBRARIES( keypoint ${OpenCV_LIBRARIES}
                                ${HDF5_LIBRARIES}
		                ${CG_LIBRARY}
		                ${CG_GL_LIBRARY}
		                ${GLEW_LIBRARY}
		                ${DevIL_LIBRARIES}
		                ${GLUT_LIBRARIES}
		                ${CUDA_LIBRARIES} 
                                ${MAGICK_LIBRARIES} 
                                ${SURF_LIBS} 
                                ${GPU_SURF_LIBS}
                                ${FLANN_LIBRARIES}
                                )

TARGET_INCLUDE_DIRECTORIES(keypoint INTERFACE $<INSTALL_INTERFACE:include/libkeypoint>)

# Install the library on 'make install'
# this should be kept in sync with the binary package name
# and be updated when the ABI (not just API) changes
SET_PROPERTY(TARGET keypoint PROPERTY VERSION ${LIBKEYPOINT_VERSION})
SET_PROPERTY(TARGET keypoint PROPERTY SOVERSION 1)
# Install the library on 'make install'
INSTALL(TARGETS keypoint EXPORT LibKeypointTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")

