Commit dc565c1b authored by Emmanuel Christophe's avatar Emmanuel Christophe

COMP: preparing the internal gdal

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