Commit dc565c1b authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

COMP: preparing the internal gdal

parent 79668deb
...@@ -422,127 +422,134 @@ ENDIF(OTB_USE_EXTERNAL_BOOST) ...@@ -422,127 +422,134 @@ ENDIF(OTB_USE_EXTERNAL_BOOST)
# GDAL Library # GDAL Library
#------------------------------- #-------------------------------
FIND_PATH(GDAL_INCLUDE_DIRS gdal.h $ENV{GDAL_INCLUDE_DIRS} /usr/include/gdal) # Option for internal/external BOOST
OPTION(OTB_USE_EXTERNAL_GDAL "Use an outside build of GDAL." ON)
IF (NOT GDAL_INCLUDE_DIRS) MARK_AS_ADVANCED(OTB_USE_EXTERNAL_GDAL)
MESSAGE(FATAL_ERROR
"Cannot find GDAL include directory. Please set GDAL_INCLUDE_DIRS.") IF(OTB_USE_EXTERNAL_GDAL)
ENDIF (NOT GDAL_INCLUDE_DIRS) FIND_PATH(GDAL_INCLUDE_DIRS gdal.h $ENV{GDAL_INCLUDE_DIRS} /usr/include/gdal)
INCLUDE_DIRECTORIES(${GDAL_INCLUDE_DIRS}) IF (NOT GDAL_INCLUDE_DIRS)
MESSAGE(FATAL_ERROR
FIND_LIBRARY(GDAL_LIBRARY NAMES gdal gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 PATHS /usr/lib/gdal) "Cannot find GDAL include directory. Please set GDAL_INCLUDE_DIRS.")
ENDIF (NOT GDAL_INCLUDE_DIRS)
IF (NOT GDAL_LIBRARY)
MESSAGE(FATAL_ERROR INCLUDE_DIRECTORIES(${GDAL_INCLUDE_DIRS})
"Cannot find GDAL library. Please set GDAL_LIBRARY.")
ENDIF (NOT GDAL_LIBRARY) FIND_LIBRARY(GDAL_LIBRARY NAMES gdal gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 PATHS /usr/lib/gdal)
MESSAGE(STATUS "GDAL library found: ${GDAL_LIBRARY}")
IF (NOT GDAL_LIBRARY)
# Find geotiff headers MESSAGE(FATAL_ERROR
FIND_PATH(GEOTIFF_INCLUDE_DIRS geotiff.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include/geotiff) "Cannot find GDAL library. Please set GDAL_LIBRARY.")
IF (NOT GEOTIFF_INCLUDE_DIRS) ENDIF (NOT GDAL_LIBRARY)
MESSAGE(FATAL_ERROR MESSAGE(STATUS "GDAL library found: ${GDAL_LIBRARY}")
"Cannot find geotiff headers. Please set GEOTIFF_INCLUDE_DIRS.")
ENDIF (NOT GEOTIFF_INCLUDE_DIRS) # Find geotiff headers
INCLUDE_DIRECTORIES(${GEOTIFF_INCLUDE_DIRS}) FIND_PATH(GEOTIFF_INCLUDE_DIRS geotiff.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include/geotiff)
IF (NOT GEOTIFF_INCLUDE_DIRS)
# Find tiff headers MESSAGE(FATAL_ERROR
FIND_PATH(TIFF_INCLUDE_DIRS tiffio.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include) "Cannot find geotiff headers. Please set GEOTIFF_INCLUDE_DIRS.")
IF (NOT TIFF_INCLUDE_DIRS) ENDIF (NOT GEOTIFF_INCLUDE_DIRS)
MESSAGE(FATAL_ERROR INCLUDE_DIRECTORIES(${GEOTIFF_INCLUDE_DIRS})
"Cannot find libtiff headers. Please set TIFF_INCLUDE_DIRS.")
ENDIF (NOT TIFF_INCLUDE_DIRS) # Find tiff headers
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIRS}) FIND_PATH(TIFF_INCLUDE_DIRS tiffio.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include)
IF (NOT TIFF_INCLUDE_DIRS)
# Find jpeg headers MESSAGE(FATAL_ERROR
FIND_PATH(JPEG_INCLUDE_DIRS jpeglib.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include) "Cannot find libtiff headers. Please set TIFF_INCLUDE_DIRS.")
IF (NOT JPEG_INCLUDE_DIRS) ENDIF (NOT TIFF_INCLUDE_DIRS)
MESSAGE(FATAL_ERROR INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIRS})
"Cannot find jpeg headers. Please set JPEG_INCLUDE_DIRS.")
ENDIF (NOT JPEG_INCLUDE_DIRS) # Find jpeg headers
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIRS}) FIND_PATH(JPEG_INCLUDE_DIRS jpeglib.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include)
IF (NOT JPEG_INCLUDE_DIRS)
# Find ogr headers MESSAGE(FATAL_ERROR
FIND_PATH(OGR_INCLUDE_DIRS ogrsf_frmts.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include) "Cannot find jpeg headers. Please set JPEG_INCLUDE_DIRS.")
IF (NOT OGR_INCLUDE_DIRS) ENDIF (NOT JPEG_INCLUDE_DIRS)
MESSAGE(FATAL_ERROR INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIRS})
"Cannot find ogr headers. Please set OGR_INCLUDE_DIRS.")
ENDIF (NOT OGR_INCLUDE_DIRS) # Find ogr headers
INCLUDE_DIRECTORIES(${OGR_INCLUDE_DIRS}) FIND_PATH(OGR_INCLUDE_DIRS ogrsf_frmts.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include)
IF (NOT OGR_INCLUDE_DIRS)
# Check if ${GDAL_LIBRARY} has tiff library MESSAGE(FATAL_ERROR
TRY_COMPILE(GDAL_HAS_TIFF "Cannot find ogr headers. Please set OGR_INCLUDE_DIRS.")
${CMAKE_CURRENT_BINARY_DIR}/CMake ENDIF (NOT OGR_INCLUDE_DIRS)
${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasTiff.cxx INCLUDE_DIRECTORIES(${OGR_INCLUDE_DIRS})
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${TIFF_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT) # Check if ${GDAL_LIBRARY} has tiff library
IF(GDAL_HAS_TIFF) TRY_COMPILE(GDAL_HAS_TIFF
MESSAGE(STATUS "Testing if GDAL has tiff -- yes") ${CMAKE_CURRENT_BINARY_DIR}/CMake
SET(TIFF_LIBRARY ${GDAL_LIBRARY}) ${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasTiff.cxx
ELSE(GDAL_HAS_TIFF) CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${TIFF_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
MESSAGE(STATUS "Testing if GDAL has tiff -- no") OUTPUT_VARIABLE OUTPUT)
FIND_LIBRARY(TIFF_LIBRARY tiff PATHS) IF(GDAL_HAS_TIFF)
IF (NOT TIFF_LIBRARY) MESSAGE(STATUS "Testing if GDAL has tiff -- yes")
MESSAGE(FATAL_ERROR SET(TIFF_LIBRARY ${GDAL_LIBRARY})
"Cannot find tiff library. Please set TIFF_LIBRARY.") ELSE(GDAL_HAS_TIFF)
ENDIF (NOT TIFF_LIBRARY) MESSAGE(STATUS "Testing if GDAL has tiff -- no")
ENDIF(GDAL_HAS_TIFF) FIND_LIBRARY(TIFF_LIBRARY tiff PATHS)
IF (NOT TIFF_LIBRARY)
# Check if ${GDAL_LIBRARY} has geotiff library MESSAGE(FATAL_ERROR
TRY_COMPILE(GDAL_HAS_GEOTIFF "Cannot find tiff library. Please set TIFF_LIBRARY.")
${CMAKE_CURRENT_BINARY_DIR}/CMake ENDIF (NOT TIFF_LIBRARY)
${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasGeoTiff.cxx ENDIF(GDAL_HAS_TIFF)
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GEOTIFF_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT) # Check if ${GDAL_LIBRARY} has geotiff library
IF(GDAL_HAS_GEOTIFF) TRY_COMPILE(GDAL_HAS_GEOTIFF
MESSAGE(STATUS "Testing if GDAL has geotiff -- yes") ${CMAKE_CURRENT_BINARY_DIR}/CMake
SET(GEOTIFF_LIBRARY ${GDAL_LIBRARY}) ${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasGeoTiff.cxx
ELSE(GDAL_HAS_GEOTIFF) CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GEOTIFF_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
MESSAGE(STATUS "Testing if GDAL has geotiff -- no") OUTPUT_VARIABLE OUTPUT)
FIND_LIBRARY(GEOTIFF_LIBRARY geotiff PATHS) IF(GDAL_HAS_GEOTIFF)
IF (NOT GEOTIFF_LIBRARY) MESSAGE(STATUS "Testing if GDAL has geotiff -- yes")
MESSAGE(FATAL_ERROR SET(GEOTIFF_LIBRARY ${GDAL_LIBRARY})
"Cannot find geotiff library. Please set GEOTIFF_LIBRARY.") ELSE(GDAL_HAS_GEOTIFF)
ENDIF (NOT GEOTIFF_LIBRARY) MESSAGE(STATUS "Testing if GDAL has geotiff -- no")
ENDIF(GDAL_HAS_GEOTIFF) FIND_LIBRARY(GEOTIFF_LIBRARY geotiff PATHS)
IF (NOT GEOTIFF_LIBRARY)
# Check if ${GDAL_LIBRARY} has jpeg library MESSAGE(FATAL_ERROR
TRY_COMPILE(GDAL_HAS_JPEG "Cannot find geotiff library. Please set GEOTIFF_LIBRARY.")
${CMAKE_CURRENT_BINARY_DIR}/CMake ENDIF (NOT GEOTIFF_LIBRARY)
${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasJpeg.cxx ENDIF(GDAL_HAS_GEOTIFF)
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${JPEG_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT) # Check if ${GDAL_LIBRARY} has jpeg library
IF(GDAL_HAS_JPEG) TRY_COMPILE(GDAL_HAS_JPEG
MESSAGE(STATUS "Testing if GDAL has jpeg -- yes") ${CMAKE_CURRENT_BINARY_DIR}/CMake
SET(JPEG_LIBRARY ${GDAL_LIBRARY}) ${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasJpeg.cxx
ELSE(GDAL_HAS_JPEG) CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${JPEG_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
MESSAGE(STATUS "Testing if GDAL has jpeg -- no") OUTPUT_VARIABLE OUTPUT)
FIND_LIBRARY(JPEG_LIBRARY jpeg PATHS) IF(GDAL_HAS_JPEG)
IF (NOT JPEG_LIBRARY) MESSAGE(STATUS "Testing if GDAL has jpeg -- yes")
MESSAGE(FATAL_ERROR SET(JPEG_LIBRARY ${GDAL_LIBRARY})
"Cannot find jpeg library. Please set JPEG_LIBRARY.") ELSE(GDAL_HAS_JPEG)
ENDIF (NOT JPEG_LIBRARY) MESSAGE(STATUS "Testing if GDAL has jpeg -- no")
ENDIF(GDAL_HAS_JPEG) FIND_LIBRARY(JPEG_LIBRARY jpeg PATHS)
IF (NOT JPEG_LIBRARY)
# Check if ${GDAL_LIBRARY} has jpeg library MESSAGE(FATAL_ERROR
TRY_COMPILE(GDAL_HAS_OGR "Cannot find jpeg library. Please set JPEG_LIBRARY.")
${CMAKE_CURRENT_BINARY_DIR}/CMake ENDIF (NOT JPEG_LIBRARY)
${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasOGR.cxx ENDIF(GDAL_HAS_JPEG)
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${OGR_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT) # Check if ${GDAL_LIBRARY} has jpeg library
IF(GDAL_HAS_OGR) TRY_COMPILE(GDAL_HAS_OGR
MESSAGE(STATUS "Testing if GDAL has OGR -- yes") ${CMAKE_CURRENT_BINARY_DIR}/CMake
SET(OGR_LIBRARY ${GDAL_LIBRARY}) ${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasOGR.cxx
ELSE(GDAL_HAS_OGR) CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${OGR_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
MESSAGE(STATUS "Testing if GDAL has OGR -- no") OUTPUT_VARIABLE OUTPUT)
MESSAGE(FATAL_ERROR "OGR MESSAGE: ${OUTPUT}") IF(GDAL_HAS_OGR)
FIND_LIBRARY(OGR_LIBRARY ogr PATHS) MESSAGE(STATUS "Testing if GDAL has OGR -- yes")
IF (NOT OGR_LIBRARY) SET(OGR_LIBRARY ${GDAL_LIBRARY})
MESSAGE(FATAL_ERROR ELSE(GDAL_HAS_OGR)
"Cannot find ogr library. Please set OGR_LIBRARY.") MESSAGE(STATUS "Testing if GDAL has OGR -- no")
ENDIF (NOT OGR_LIBRARY) MESSAGE(FATAL_ERROR "OGR MESSAGE: ${OUTPUT}")
ENDIF(GDAL_HAS_OGR) FIND_LIBRARY(OGR_LIBRARY ogr PATHS)
IF (NOT OGR_LIBRARY)
MESSAGE(FATAL_ERROR
"Cannot find ogr library. Please set OGR_LIBRARY.")
ENDIF (NOT OGR_LIBRARY)
ENDIF(GDAL_HAS_OGR)
ELSE(OTB_USE_EXTERNAL_GDAL)
ENDIF(OTB_USE_EXTERNAL_GDAL)
#------------------------------- #-------------------------------
......
...@@ -154,14 +154,14 @@ ADD_TEST(ioTeDEMToImageGeneratorTest ${EXE_TESTS1} ...@@ -154,14 +154,14 @@ ADD_TEST(ioTeDEMToImageGeneratorTest ${EXE_TESTS1}
${TEMP}/DEMToImageGenerator.tif ${TEMP}/DEMToImageGenerator.tif
DEMToImageGeneratorTest DEMToImageGeneratorTest
${TEMP}/DEMToImageGenerator.tif ${TEMP}/DEMToImageGenerator.tif
${TEMP}/pretty_DEMToImageGenerator.png ${TEMP}/pretty_DEMToImageGenerator.png
6.5 6.5
45.5 45.5
500 500
500 500
0.002 0.002
-0.002 -0.002
${INPUTDATA}/DEM_srtm ${INPUTDATA}/DEM_srtm
) )
IF(OTB_USE_LIBLAS) IF(OTB_USE_LIBLAS)
...@@ -172,7 +172,7 @@ ADD_TEST(ioTeLidarToImageExampleTest ${EXE_TESTS1} ...@@ -172,7 +172,7 @@ ADD_TEST(ioTeLidarToImageExampleTest ${EXE_TESTS1}
LidarToImageExampleTest LidarToImageExampleTest
${DATA}/TO_core_last_zoom.las ${DATA}/TO_core_last_zoom.las
${TEMP}/lidar-image-4.hdr ${TEMP}/lidar-image-4.hdr
${TEMP}/lidar-image-4.png ${TEMP}/lidar-image-4.png
1.0 1.0
5 5
4 4
...@@ -183,7 +183,7 @@ ADD_TEST(ioTeLidarToImageExample2Test ${EXE_TESTS1} ...@@ -183,7 +183,7 @@ ADD_TEST(ioTeLidarToImageExample2Test ${EXE_TESTS1}
LidarToImageExampleTest LidarToImageExampleTest
${DATA}/TO_core_last_zoom.las ${DATA}/TO_core_last_zoom.las
${TEMP}/lidar-image-8.hdr ${TEMP}/lidar-image-8.hdr
${TEMP}/lidar-image-8.png ${TEMP}/lidar-image-8.png
1.0 1.0
5 5
8 8
...@@ -207,12 +207,10 @@ ENDIF( OTB_USE_CURL ) ...@@ -207,12 +207,10 @@ ENDIF( OTB_USE_CURL )
INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code) INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code)
ADD_EXECUTABLE(otbIOExamplesTests1 otbIOExamplesTests1.cxx) ADD_EXECUTABLE(otbIOExamplesTests1 otbIOExamplesTests1.cxx)
# TARGET_LINK_LIBRARIES(otbIOExamplesTests1 OTBIO OTBBasicFilters OTBCommon OTBDisparityMap OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction OTBLearning OTBMultiScale OTBProjections ITKAlgorithms ITKStatistics ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
TARGET_LINK_LIBRARIES(otbIOExamplesTests1 OTBIO OTBCommon OTBTesting) TARGET_LINK_LIBRARIES(otbIOExamplesTests1 OTBIO OTBCommon OTBTesting)
IF( OTB_USE_CURL ) IF( OTB_USE_CURL )
ADD_EXECUTABLE(otbIOExamplesTests2 otbIOExamplesTests2.cxx) ADD_EXECUTABLE(otbIOExamplesTests2 otbIOExamplesTests2.cxx)
# TARGET_LINK_LIBRARIES(otbIOExamplesTests2 OTBCommon OTBIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES} ${CURL_LIBRARY} )
TARGET_LINK_LIBRARIES(otbIOExamplesTests2 OTBCommon OTBIO ${CURL_LIBRARY} OTBTesting) TARGET_LINK_LIBRARIES(otbIOExamplesTests2 OTBCommon OTBIO ${CURL_LIBRARY} OTBTesting)
ENDIF( OTB_USE_CURL ) ENDIF( OTB_USE_CURL )
......
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