# Author: Ramon Casero <rcasero@gmail.com>
# Copyright © 2011-2013 University of Oxford
# Version: 0.6.9
#
# University of Oxford means the Chancellor, Masters and Scholars of
# the University of Oxford, having an administrative office at
# Wellington Square, Oxford OX1 2JD, UK. 
#
# This file is part of Gerardus.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details. The offer of this
# program under the terms of the License is subject to the License
# being interpreted in accordance with English Law and subject to any
# action against the University of Oxford being under the jurisdiction
# of the English Courts.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see
# <http://www.gnu.org/licenses/>.

# add include and linking paths
include_directories(
  ..
  ${Boost_INCLUDE_DIRS}
  ${GMP_INCLUDE_DIR}
  ${MPFR_INCLUDE_DIR}
  ${GERARDUS_SOURCE_DIR}/include
  ${GERARDUS_CPP_SOURCE_DIR}/third-party/CGAL-4.2/include
  ${GERARDUS_CPP_SOURCE_DIR}/third-party/IJ-Vessel_Enhancement_Diffusion.1
  ${GERARDUS_CPP_SOURCE_DIR}/third-party/itkBinaryThinningImageFilter3D/Source
  )
link_directories(${Boost_LIBRARY_DIRS})

################################################################
## itk_imfilter()
################################################################

add_mex_file(itk_imfilter 
  ItkImFilter.cpp)

target_link_libraries(itk_imfilter
  CGAL
  CGAL_ImageIO
  ${ITK_LIBRARIES})

# add dependency to compiler_config.h, a header file generated by CGAL
# and only available once CGAL has installed
add_dependencies(itk_imfilter copy_compiler_config.h)

################################################################
## itk_pstransform
################################################################

add_mex_file(itk_pstransform ItkPSTransform.cpp)
target_link_libraries(itk_pstransform
  CGAL
  CGAL_ImageIO
  ${ITK_LIBRARIES})

# add dependency to compiler_config.h, a header file generated by CGAL
# and only available once CGAL has installed
add_dependencies(itk_pstransform copy_compiler_config.h)

################################################################
## itk_icp_registration
################################################################

add_mex_file(itk_icp_registration ItkICPRegistration.cpp)
target_link_libraries(itk_icp_registration
  CGAL
  CGAL_ImageIO
  ${ITK_LIBRARIES})

# add dependency to compiler_config.h, a header file generated by CGAL
# and only available once CGAL has installed
add_dependencies(itk_icp_registration copy_compiler_config.h)

################################################################
## itk_tri_rasterization
################################################################

add_mex_file(itk_tri_rasterization ItkTriRasterization.cpp)
target_link_libraries(itk_tri_rasterization
  CGAL
  CGAL_ImageIO
  ${ITK_LIBRARIES})

# add dependency to compiler_config.h, a header file generated by CGAL
# and only available once CGAL has installed
add_dependencies(itk_tri_rasterization copy_compiler_config.h)

################################################################
## installation of targets
################################################################

IF(WIN32)
  INSTALL(TARGETS
    itk_imfilter
    itk_pstransform
    itk_icp_registration
    itk_tri_rasterization
    RUNTIME
    DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
ELSE(WIN32)
  INSTALL(TARGETS
    itk_imfilter
    itk_pstransform
    itk_icp_registration
    itk_tri_rasterization
    LIBRARY
    DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
ENDIF(WIN32)
