#
#  Define the list of source files forming the IGSTK Library
#
# The header files

SET(IGSTK_HEADS
  igstkUSImageObject.h
  igstkUSImageObjectRepresentation.h
  igstkUSImageReader.h
  igstkAnnotation2D.h
  igstkAxesObject.h
  igstkAxesObjectRepresentation.h
  igstkBoxObject.h
  igstkBoxObjectRepresentation.h
  igstkConeObject.h
  igstkConeObjectRepresentation.h
  igstkImageReader.h
  igstkDICOMImageReader.h
  igstkCTImageReader.h
  igstkMRImageReader.h
  igstkImageSpatialObject.h
  igstkCTImageSpatialObject.h
  igstkMRImageSpatialObject.h
  igstkImageSpatialObjectRepresentation.h
  igstkCTImageSpatialObjectRepresentation.h
  igstkMRImageSpatialObjectRepresentation.h
  igstkLandmark3DRegistration.h
  igstkLandmark3DRegistrationErrorEstimator.h
  igstkAuroraTracker.h
  igstkAuroraTrackerTool.h
  igstkBinaryData.h
  igstkCommunication.h
  igstkCylinderObject.h
  igstkCylinderObjectRepresentation.h
  igstkEllipsoidObject.h  
  igstkEllipsoidObjectRepresentation.h  
  igstkEvents.h
  igstkMacros.h
  igstkMeshObject.h
  igstkMeshObjectRepresentation.h
  igstkMultipleOutput.h
  igstkNDICommandInterpreter.h
  igstkNDIErrorEvent.h
  igstkObjectRepresentation.h
  igstkObject.h
  igstkPolarisTracker.h
  igstkPolarisTrackerTool.h
  igstkPulseGenerator.h
  igstkRenderWindowInteractor.h
  igstkRealTimeClock.h
  igstkSerialCommunication.h
  igstkSerialCommunicationSimulator.h
  igstkSpatialObject.h
  igstkStateMachine.h
  igstkStateMachineInput.h
  igstkStateMachineState.h
  igstkTimeStamp.h
  igstkTransform.h
  igstkToken.h
  igstkTracker.h
  igstkTrackerTool.h
  igstkTubeObject.h
  igstkTubeObjectRepresentation.h
  igstkUltrasoundProbeObject.h
  igstkUltrasoundProbeObjectRepresentation.h
  igstkVTKLoggerOutput.h
  igstkSpatialObjectReader.h
  igstkTubeReader.h
  igstkMeshReader.h
  igstkGroupObject.h
  igstkLogger.h
  igstkCoordinateSystem.h
  igstkCoordinateSystemDelegator.h
  igstkCoordinateSystemTransformToResult.h
  igstkCoordinateSystemTransformToErrorResult.h

  igstkCircularSimulatedTracker.h
  igstkSimulatedTrackerTool.h
  igstkSimulatedTracker.h
  igstkNDITracker.h

  igstkView.h
  igstkView2D.h
  igstkView3D.h
)

IF(IGSTK_USE_FLTK)
  SET(IGSTK_HEADS
    ${IGSTK_HEADS}
    igstkFLTKTextBufferLogOutput.h
    igstkFLTKTextLogOutput.h
    igstkMouseTracker.h
    igstkMouseTrackerTool.h
    igstkFLTKWidget.h
    )
ENDIF(IGSTK_USE_FLTK)

IF(IGSTK_USE_Qt)
  SET(IGSTK_HEADS
      ${IGSTK_HEADS}
      igstkQMouseTracker.h
      igstkQMouseTrackerTool.h
      igstkQTWidget.h
   )
ENDIF(IGSTK_USE_Qt)

IF(IGSTK_USE_MicronTracker)
  SET(IGSTK_HEADS
      ${IGSTK_HEADS}
      igstkMicronTracker.h
      igstkMicronTrackerTool.h
     )
ENDIF(IGSTK_USE_MicronTracker)



# The implementation files

SET(IGSTK_SRCS  
  igstkUSImageObject.cxx
  igstkUSImageObjectRepresentation.cxx
  igstkUSImageReader.cxx
  igstkMR3DImageToUS3DImageRegistration.cxx
  igstkAnnotation2D.cxx
  igstkAxesObject.cxx
  igstkAxesObjectRepresentation.cxx
  igstkBoxObject.cxx
  igstkBoxObjectRepresentation.cxx
  igstkConeObject.cxx
  igstkConeObjectRepresentation.cxx
  igstkImageReader.txx
  igstkDICOMImageReader.txx
  igstkCTImageReader.cxx
  igstkMRImageReader.cxx
  igstkImageSpatialObject.txx
  igstkCTImageSpatialObject.cxx
  igstkMRImageSpatialObject.cxx
  igstkImageSpatialObjectRepresentation.txx
  igstkCTImageSpatialObjectRepresentation.cxx
  igstkMRImageSpatialObjectRepresentation.cxx
  igstkLandmark3DRegistration.cxx
  igstkLandmark3DRegistrationErrorEstimator.cxx
  igstkAuroraTracker.cxx
  igstkAuroraTrackerTool.cxx
  igstkBinaryData.cxx
  igstkCommunication.cxx
  igstkCylinderObject.cxx
  igstkCylinderObjectRepresentation.cxx
  igstkEllipsoidObject.cxx
  igstkEllipsoidObjectRepresentation.cxx
  igstkMeshObject.cxx
  igstkMeshObjectRepresentation.cxx
  igstkMultipleOutput.cxx
  igstkNDICommandInterpreter.cxx
  igstkObject.cxx
  igstkObjectRepresentation.cxx
  igstkPolarisTracker.cxx
  igstkPolarisTrackerTool.cxx
  igstkPulseGenerator.cxx
  igstkRenderWindowInteractor.cxx
  igstkRealTimeClock.cxx
  igstkSerialCommunication.cxx
  igstkSerialCommunicationSimulator.cxx
  igstkSpatialObject.cxx
  igstkStateMachine.txx
  igstkTimeStamp.cxx
  igstkToken.cxx
  igstkTracker.cxx
  igstkTrackerTool.cxx
  igstkTransform.cxx
  igstkTubeObject.cxx
  igstkTubeObjectRepresentation.cxx
  igstkUltrasoundProbeObject.cxx
  igstkUltrasoundProbeObjectRepresentation.cxx
  igstkVTKLoggerOutput.cxx
  igstkTubeReader.cxx
  igstkMeshReader.cxx
  igstkGroupObject.cxx
  igstkLogger.cxx
  igstkCoordinateSystem.cxx
  igstkCoordinateSystemDelegator.cxx
  igstkCoordinateSystemTransformToResult.cxx
  igstkCoordinateSystemTransformToErrorResult.cxx

  igstkCircularSimulatedTracker.cxx
  igstkSimulatedTrackerTool.cxx
  igstkSimulatedTracker.cxx
  igstkNDITracker.cxx

  igstkView.cxx
  igstkView2D.cxx
  igstkView3D.cxx
  igstkViewProxyBase.cxx
)

IF(IGSTK_USE_FLTK)
  SET(IGSTK_SRCS  
    ${IGSTK_SRCS}
    igstkFLTKTextBufferLogOutput.cxx
    igstkFLTKTextLogOutput.cxx
    igstkMouseTracker.cxx
    igstkMouseTrackerTool.cxx
    igstkFLTKWidget.cxx
    )
ENDIF(IGSTK_USE_FLTK)

IF(IGSTK_USE_Qt)
  SET(IGSTK_SRCS
      ${IGSTK_SRCS}
      igstkQMouseTracker.cxx
      igstkQMouseTrackerTool.cxx
      igstkQTWidget.cxx
   )
ENDIF(IGSTK_USE_Qt)

IF(IGSTK_USE_MicronTracker)
  SET(IGSTK_SRCS
      ${IGSTK_SRCS}
      igstkMicronTracker.cxx
      igstkMicronTrackerTool.cxx
 
     )
ENDIF(IGSTK_USE_MicronTracker)

IF( WIN32 )
  SET(IGSTK_HEADS ${IGSTK_HEADS} 
    igstkSerialCommunicationForWindows.h
  )
  SET(IGSTK_SRCS ${IGSTK_SRCS} 
    igstkSerialCommunicationForWindows.cxx
  )
ELSE( WIN32 )
  SET(IGSTK_HEADS ${IGSTK_HEADS} 
    igstkSerialCommunicationForPosix.h
  )
  SET(IGSTK_SRCS ${IGSTK_SRCS} 
    igstkSerialCommunicationForPosix.cxx
  )
ENDIF( WIN32 )

# Variable for holding extra libraries
SET(EXTRA_LIBS)
IF(IGSTK_USE_Qt)
  IF(APPLE)
   SET(EXTRA_LIBS ${EXTRA_LIBS} QVTK  "-framework QtTest")
  ELSE(APPLE)
    SET(EXTRA_LIBS ${EXTRA_LIBS} QVTK  ${QT_QTTEST_LIBRARY})
  ENDIF(APPLE)
ENDIF(IGSTK_USE_Qt)

IF(IGSTK_USE_MicronTracker)
  SET(EXTRA_LIBS ${EXTRA_LIBS} igstkMTCu)
   
  IF(WIN32)
    SET(EXTRA_LIBS ${EXTRA_LIBS}  comctl32 wsock32 odbc32 odbccp32 )
  ELSE(WIN32)
    SET(EXTRA_LIBS ${EXTRA_LIBS} raw1394 dc1394_control )
  ENDIF(WIN32)
  
ENDIF(IGSTK_USE_MicronTracker)

# Adding the IGSTK library

ADD_LIBRARY(IGSTK ${IGSTK_HEADS} ${IGSTK_SRCS})

# Linking with the FLTK, ITK and VTK libraries
TARGET_LINK_LIBRARIES( IGSTK
    ITKIO ITKBasicFilters ITKNumerics ITKCommon ITKSpatialObject
    vtkRendering vtkGraphics vtkHybrid vtkImaging 
    vtkIO vtkFiltering vtkCommon vtksys
    ${EXTRA_LIBS}
)

SET_TARGET_PROPERTIES(IGSTK PROPERTIES
#   BUILD_WITH_INSTALL_RPATH OFF
#   INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
#   INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib
   VERSION ${IGSTK_VERSION_MAJOR}.${IGSTK_VERSION_MINOR}.${IGSTK_VERSION_PATCH}
   SOVERSION ${IGSTK_VERSION_MAJOR}
)

IF(IGSTK_USE_FLTK)
  TARGET_LINK_LIBRARIES( IGSTK ${FLTK_LIBRARIES} )
ENDIF(IGSTK_USE_FLTK)

INSTALL(TARGETS IGSTK
   DESTINATION ${IGSTK_INSTALL_LIB_DIR}
)

FILE(GLOB __files1 "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
FILE(GLOB __files2 "${CMAKE_CURRENT_SOURCE_DIR}/*.txx")

INSTALL(FILES ${__files1} ${__files2}
   DESTINATION ${IGSTK_INSTALL_INCLUDE_DIR}
)
