Commit 6a1ef45c authored by Romain Garrigues's avatar Romain Garrigues
Browse files

Fichiers CMake modifiés pour permettre la compilation d'ITK dans le projet OTB.

parent 4836215c
......@@ -69,17 +69,6 @@ SET(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}")
# "Cannot build OTB project without VTK. Please set VTK_DIR.")
# ENDIF(VTK_FOUND)
#-------------------------------
# Librairie ITK
#-------------------------------
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build OTB project without ITK. Please set ITK_DIR.")
ENDIF(ITK_FOUND)
#-------------------------------
# Librairie OpenGL
#-------------------------------
......@@ -88,6 +77,27 @@ IF(OPENGL_INCLUDE_PATH)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_PATH})
ENDIF(OPENGL_INCLUDE_PATH)
#-------------------------------
# Librairie ITK
#-------------------------------
OPTION(OTB_USE_EXTERNAL_ITK "Use an outside build of ITK." ON)
MARK_AS_ADVANCED(OTB_USE_EXTERNAL_ITK)
IF(OTB_USE_EXTERNAL_ITK)
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build OTB project without ITK. Please set ITK_DIR or set OTB_USE_EXTERNAL_ITK OFF to use INTERNAL ITK set on OTB/Utilities repository.")
ENDIF(ITK_FOUND)
ELSE(OTB_USE_EXTERNAL_ITK)
# SET(ITK_SOURCE_DIR ${OTB_SOURCE_DIR}/Utilities/ITK)
# SET(ITK_BINARY_DIR ${OTB_BINARY_DIR})
ENDIF(OTB_USE_EXTERNAL_ITK)
#-------------------------------
# Librairie CAI
#-------------------------------
......@@ -117,29 +127,46 @@ ENDIF(OPENGL_INCLUDE_PATH)
#-------------------------------
# Librairie GDAL
#-------------------------------
FIND_LIBRARY(GDAL_LIBRARY NAMES gdal PATHS $ENV{GDAL_DIR_LIB} )
FIND_PATH(GDAL_INCLUDES gdal.h $ENV{GDAL_DIR_INCLUDES} )
IF (NOT GDAL_LIBRARY)
OPTION(OTB_USE_EXTERNAL_GDAL "Use an outside build of GDAL." ON)
MARK_AS_ADVANCED(OTB_USE_EXTERNAL_GDAL)
IF(OTB_USE_EXTERNAL_GDAL)
FIND_LIBRARY(GDAL_LIBRARY NAMES gdal PATHS $ENV{GDAL_DIR_LIB} )
FIND_PATH(GDAL_INCLUDES gdal.h $ENV{GDAL_DIR_INCLUDES} )
IF (NOT GDAL_LIBRARY)
MESSAGE(FATAL_ERROR
"Cannot find GDAL library. Please set GDAL_DIR_LIB.")
ENDIF (NOT GDAL_LIBRARY)
"Cannot find GDAL library. Please set GDAL_DIR_LIB and GDAL_DIR_INCLUDES or set OTB_USE_EXTERNAL_GDAL OFF to use INTERNAL GDAL set on OTB/Utilities repository.")
ENDIF (NOT GDAL_LIBRARY)
INCLUDE_DIRECTORIES(${GDAL_INCLUDES})
LINK_DIRECTORIES( $ENV{GDAL_DIR_LIB} )
INCLUDE_DIRECTORIES(${GDAL_INCLUDES})
LINK_DIRECTORIES( $ENV{GDAL_DIR_LIB} )
ENDIF(OTB_USE_EXTERNAL_GDAL)
#-------------------------------
# Librairie FLTK
#-------------------------------
# Add an option to use or not use FLTK (http://www.fltk.org)
FIND_PACKAGE(FLTK)
IF(FLTK_FOUND)
# INCLUDE(${FLTK_USE_FILE})
OPTION(OTB_USE_EXTERNAL_FLTK "Use an outside build of FLTK." ON)
MARK_AS_ADVANCED(OTB_USE_EXTERNAL_FLTK)
IF(OTB_USE_EXTERNAL_FLTK)
FIND_PACKAGE(FLTK)
IF(FLTK_FOUND)
# INCLUDE(${FLTK_USE_FILE})
INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
ELSE(FLTK_FOUND)
ELSE(FLTK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build OTB project without FLTK. Please set FLTK_DIR.")
ENDIF(FLTK_FOUND)
"Cannot build OTB project without FLTK. Please set FLTK_DIR or set OTB_USE_EXTERNAL_FLTK OFF to use INTERNAL FLTK set on OTB/Utilities repository.")
ENDIF(FLTK_FOUND)
ENDIF(OTB_USE_EXTERNAL_FLTK)
#-------------------------------
# End connections whith external libraries
#-------------------------------
# The fluid-generated fltk sources have many warnings. This macro
# will disable warnings for the generated files on some compilers.
......@@ -222,6 +249,7 @@ INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
#-----------------------------------------------------------------------------
# Repertoire des images de tldetection.
SET( OTB_DATA_DIR "$ENV{OTB_DATA_DIR}" CACHE STRING "Image directory")
......@@ -351,6 +379,14 @@ IF(WIN32)
SET(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -DNOMINMAX")
ENDIF(WIN32)
#-----------------------------------------------------------------------------
#
# See if compiler preprocessor has the __FUNCTION__ directive used by itkExceptionMacro
#
INCLUDE(${OTB_SOURCE_DIR}/CMake/CheckCPPDirective.cmake)
CHECK_CPP_DIRECTIVE_EXISTS(__FUNCTION__ ITK_CPP_FUNCTION)
#-----------------------------------------------------------------------------
# Find platform-specific differences in the handling of IEEE floating point
# special values.
......@@ -542,3 +578,5 @@ ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.7)
"Please upgrade to CMake 1.8.")
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.7)
......@@ -2,3 +2,8 @@
SUBDIRS( CAI )
IF(NOT OTB_USE_EXTERNAL_ITK)
SUBDIRS( ITK )
ENDIF(NOT OTB_USE_EXTERNAL_ITK)
......@@ -20,10 +20,30 @@ SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
#-----------------------------------------------------------------------------
# Include directories from the GDAL build tree.
#INCLUDE(${OTB_SOURCE_DIR}/Utilities/GDAL/gdalIncludeDirectories.cmake)
#SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
#IF(NOT OTB_USE_EXTERNAL_GDAL)
# INCLUDE(${OTB_SOURCE_DIR}/Utilities/GDAL/gdalIncludeDirectories.cmake)
# SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
# ${GDAL_INCLUDE_DIRS_BUILD_TREE}
# )
#ENDIF(NOT OTB_USE_EXTERNAL_GDAL)
#-----------------------------------------------------------------------------
# Include directories from the ITK build tree.e
IF(NOT OTB_USE_EXTERNAL_ITK)
INCLUDE(${OTB_SOURCE_DIR}/Utilities/ITK/itkIncludeDirectories.cmake)
SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
${ITK_INCLUDE_DIRS_BUILD_TREE}
)
ENDIF(NOT OTB_USE_EXTERNAL_ITK)
#-----------------------------------------------------------------------------
# Include directories from the FLTK build tree.
#IF(NOT OTB_USE_EXTERNAL_FLTK)
# INCLUDE(${OTB_SOURCE_DIR}/Utilities/FLTK/fltkIncludeDirectories.cmake)
# SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
# ${FLTK_INCLUDE_DIRS_BUILD_TREE}
# )
#ENDIF(NOT OTB_USE_EXTERNAL_FLTK)
#-----------------------------------------------------------------------------
......@@ -58,6 +78,7 @@ SET(OTB_INCLUDE_DIRS_INSTALL_TREE ${OTB_INCLUDE_DIRS_INSTALL_TREE}
${OTB_INSTALL_INCLUDE_DIR}/Utilities
${OTB_INSTALL_INCLUDE_DIR}/Utilities/CAI
${OTB_INSTALL_INCLUDE_DIR}/Utilities/GDAL
${OTB_INSTALL_INCLUDE_DIR}/Utilities/ITK
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment