Commit aad89f2b authored by Thomas Feuvrier's avatar Thomas Feuvrier
Browse files

Ajout OPTION utilisateur si compiler avec CURL.

parent 55868377
......@@ -81,9 +81,53 @@ IF(OTB_USE_EXTERNAL_ITK)
ENDIF(ITK_FOUND)
ENDIF(OTB_USE_EXTERNAL_ITK)
#SET(CURL_INCLUDE_DIR )
#MARK_AS_ADVANCED(CURL_INCLUDE_DIRS)
#SET(CURL_LIBRARY )
#MARK_AS_ADVANCED(CURL_LIBRARY_DIRS)
#-------------------------------
# Librairie GDAL
# CURL Library
#-------------------------------
OPTION(OTB_USE_CURL "Use curl library." ON)
MARK_AS_ADVANCED(OTB_USE_CURL)
IF(OTB_USE_CURL)
# INCLUDE(CheckIncludeFiles)
# INCLUDE(CheckLibraryExists)
# CHECK_INCLUDE_FILES("curl/curl.h" OTB_HAVE_CURL_HEADER)
# CHECK_LIBRARY_EXISTS("curl" "curl_easy_init" "" OTB_HAVE_CURL_LIBRARY)
# IF( NOT OTB_HAVE_CURL_HEADER )
# MESSAGE("Cannot find CURL include directory. Please set CURL_INCLUDE_DIRS or SET OTB_USE_CURL OFF.")
# ENDIF( NOT OTB_HAVE_CURL_HEADER)
# IF( NOT OTB_HAVE_CURL_LIBRARY )
# MESSAGE("Cannot find CURL include directory. Please set CURL_LIBRARY_DIRS or SET OTB_USE_CURL OFF.")
# ENDIF( NOT OTB_HAVE_CURL_LIBRARY)
FIND_PATH(CURL_INCLUDE_DIR curl/curl.h PATHS)
MARK_AS_ADVANCED(CURL_INCLUDE_DIR)
IF (NOT CURL_INCLUDE_DIR)
MESSAGE(FATAL_ERROR
"Cannot find CURL include directory. Please set CURL_INCLUDE_DIR or SET OTB_USE_CURL OFF.")
ENDIF (NOT CURL_INCLUDE_DIR)
FIND_LIBRARY(CURL_LIBRARY curl )
MARK_AS_ADVANCED(CURL_LIBRARY)
IF (NOT CURL_LIBRARY)
MESSAGE(FATAL_ERROR
"Cannot find CURL library. Please set CURL_LIBRARY or SET OTB_USE_CURL OFF.")
ENDIF (NOT CURL_LIBRARY)
# Add compiler option
ADD_DEFINITIONS(-DOTB_USE_CURL)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
ENDIF(OTB_USE_CURL)
#-------------------------------
# GDAL Library
#-------------------------------
#FIND_LIBRARY(GDAL_LIBRARY_DIRS gdal PATHS $ENV{GDAL_LIBRARY_DIRS} )
......@@ -103,15 +147,6 @@ ENDIF (NOT GDAL_INCLUDE_DIRS)
INCLUDE_DIRECTORIES(${GDAL_INCLUDE_DIRS})
LINK_DIRECTORIES( ${GDAL_LIBRARY_DIRS} )
#-----------------------------------------------------------------------------
INCLUDE(CheckIncludeFiles)
# Check if curl.h header file exist
CHECK_INCLUDE_FILES("curl/curl.h" OTB_HAVE_CURL_H)
IF(OTB_HAVE_CURL_H)
ADD_DEFINITIONS(-DOTB_HAVE_CURL)
ENDIF(OTB_HAVE_CURL_H)
#-----------------------------------------------------------------------------
# Option for generate Visu tools !!!
OPTION(OTB_USE_VISU_GUI "Generate Gui/Visu tools directory. If ON, find OpenGL and FLTK package." ON)
......
......@@ -2,16 +2,16 @@
FILE(GLOB OTBIO_SRCS "*.cxx" )
IF( NOT OTB_HAVE_CURL_H )
IF( NOT OTB_USE_CURL )
LIST(REMOVE_ITEM OTBIO_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/otbNetworkedQuadTreeImageIOFactory.cxx" )
LIST(REMOVE_ITEM OTBIO_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/otbNetworkedQuadTreeImageIO.cxx" )
ENDIF( NOT OTB_HAVE_CURL_H )
ENDIF( NOT OTB_USE_CURL )
ADD_LIBRARY(OTBIO ${OTBIO_SRCS})
TARGET_LINK_LIBRARIES (OTBIO gdal OTBCommon ITKIO ITKCommon otbossim dxf)
IF( OTB_HAVE_CURL_H )
TARGET_LINK_LIBRARIES (OTBIO curl)
ENDIF( OTB_HAVE_CURL_H )
IF( OTB_USE_CURL )
TARGET_LINK_LIBRARIES (OTBIO ${CURL_LIBRARY})
ENDIF( OTB_USE_CURL )
INSTALL(TARGETS OTBIO
RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries
......@@ -21,10 +21,10 @@ ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT Development)
FILE(GLOB __files1 "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
FILE(GLOB __files2 "${CMAKE_CURRENT_SOURCE_DIR}/*.txx")
IF( NOT OTB_HAVE_CURL_H )
IF( NOT OTB_USE_CURL )
LIST(REMOVE_ITEM __files1 "${CMAKE_CURRENT_SOURCE_DIR}/otbNetworkedQuadTreeImageIOFactory.h" )
LIST(REMOVE_ITEM __files1 "${CMAKE_CURRENT_SOURCE_DIR}/otbNetworkedQuadTreeImageIO.h" )
ENDIF( NOT OTB_HAVE_CURL_H )
ENDIF( NOT OTB_USE_CURL )
INSTALL(FILES ${__files1} ${__files2}
DESTINATION ${OTB_INSTALL_INCLUDE_DIR}/IO
......
......@@ -28,7 +28,7 @@
#include "otbGDALImageIOFactory.h"
#include "otbLUMImageIOFactory.h"
#include "otbBSQImageIOFactory.h"
#ifdef OTB_HAVE_CURL
#ifdef OTB_USE_CURL
#include "otbNetworkedQuadTreeImageIOFactory.h"
#endif
......@@ -69,7 +69,7 @@ ImageIOFactory::RegisterBuiltInFactories()
// GDAL : New format for OTB
itk::ObjectFactoryBase::RegisterFactory( GDALImageIOFactory::New() );
#ifdef OTB_HAVE_CURL
#ifdef OTB_USE_CURL
// NetworkedQuadTree : New format for OTB
itk::ObjectFactoryBase::RegisterFactory( NetworkedQuadTreeImageIOFactory::New() );
#endif
......
......@@ -2,9 +2,9 @@ FILE(GLOB OTBProjections_SRCS "*.cxx" )
ADD_LIBRARY(OTBProjections ${OTBProjections_SRCS})
TARGET_LINK_LIBRARIES(OTBProjections OTBIO)
IF( OTB_HAVE_CURL_H )
TARGET_LINK_LIBRARIES (OTBProjections curl)
ENDIF( OTB_HAVE_CURL_H )
IF( OTB_USE_CURL )
TARGET_LINK_LIBRARIES (OTBProjections ${CURL_LIBRARY})
ENDIF( OTB_USE_CURL )
INSTALL(TARGETS OTBProjections
RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries
......@@ -14,10 +14,10 @@ ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT Development)
FILE(GLOB __files1 "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
FILE(GLOB __files2 "${CMAKE_CURRENT_SOURCE_DIR}/*.txx")
IF( NOT OTB_HAVE_CURL_H )
IF( NOT OTB_USE_CURL )
LIST(REMOVE_ITEM __files1 "${CMAKE_CURRENT_SOURCE_DIR}/otbPlaceNameToLonLat.h" )
LIST(REMOVE_ITEM __files2 "${CMAKE_CURRENT_SOURCE_DIR}/otbPlaceNameToLonLat.txx" )
ENDIF( NOT OTB_HAVE_CURL_H )
ENDIF( NOT OTB_USE_CURL )
INSTALL(FILES ${__files1} ${__files2}
DESTINATION ${OTB_INSTALL_INCLUDE_DIR}/Projections
......
......@@ -49,6 +49,12 @@ SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
# Include directories from the GDAL build tree.
SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
${GDAL_INCLUDE_DIRS} )
#-----------------------------------------------------------------------------
# Include directories from the CURL build tree.
IF(OTB_USE_CURL)
SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
${CURL_INCLUDE_DIR} )
ENDIF(OTB_USE_CURL)
#-----------------------------------------------------------------------------
# Include directories from the ITK build tree.
......@@ -160,6 +166,11 @@ SET(OTB_INCLUDE_DIRS_INSTALL_TREE ${OTB_INCLUDE_DIRS_INSTALL_TREE}
SET(OTB_INCLUDE_DIRS_INSTALL_TREE ${OTB_INCLUDE_DIRS_INSTALL_TREE}
${GDAL_INCLUDE_DIRS} )
IF(OTB_USE_CURL)
SET(OTB_INCLUDE_DIRS_INSTALL_TREE ${OTB_INCLUDE_DIRS_INSTALL_TREE}
${CURL_INCLUDE_DIR} )
ENDIF(OTB_USE_CURL)
IF(OTB_USE_EXTERNAL_FLTK)
SET(OTB_INCLUDE_DIRS_INSTALL_TREE ${OTB_INCLUDE_DIRS_INSTALL_TREE}
${FLTK_INCLUDE_DIRS})
......
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