Commit 19c30a28 authored by Julien Michel's avatar Julien Michel
Browse files

COMP: Adding more tests on GDAL symbols

parent 4f779480
#include <cstdio>
//---
// Using windows .NET compiler there is a conflict in the libjpeg with INT32
// in the file jmorecfg.h. Defining XMD_H fixes this.
//---
#if defined(__BORLANDC__)
#include <iostream>
using std::size_t;
#include <stdlib.h>
#include <stdio.h>
#endif
extern "C"
{
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__BORLANDC__)
# ifndef XMD_H
# define XMD_H
# endif
#endif
#include "jpeglib.h"
}
int main(int argc,char * argv[])
{
struct jpeg_decompress_struct theCinfo;
jpeg_create_decompress(&theCinfo);
return 0;
}
#include "ogrsf_frmts.h"
int main(int argc,char * argv[])
{
OGRSFDriverRegistrar::Open(argv[1], FALSE);
return 0;
}
......@@ -333,7 +333,7 @@ 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} /usr/include/geotiff)
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.")
......@@ -341,24 +341,41 @@ ENDIF (NOT GEOTIFF_INCLUDE_DIRS)
INCLUDE_DIRECTORIES(${GEOTIFF_INCLUDE_DIRS})
# Find tiff headers
FIND_PATH(TIFF_INCLUDE_DIRS tiffio.h $ENV{GDAL_INCLUDE_DIRS} /usr/include)
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
SET(TIFF_LIBRARY ${GDAL_LIBRARY})
TRY_COMPILE(GDAL_HAS_TIFF
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}CMake
${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasTiff.cxx
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${TIFF_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_DIRECTORIES:PATH=${GDAL_LIBRARY_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT)
IF(GDAL_HAS_TIFF)
MESSAGE("-- Testing if GDAL has tiff -- yes.")
MESSAGE(STATUS "Testing if GDAL has tiff -- yes")
ELSE(GDAL_HAS_TIFF)
MESSAGE("-- Testing if GDAL has tiff -- no.")
MESSAGE(STATUS "Testing if GDAL has tiff -- no")
MESSAGE(${OUTPUT})
FIND_LIBRARY(TIFF_LIBRARY tiff PATHS)
IF (NOT TIFF_LIBRARY)
MESSAGE(FATAL_ERROR
......@@ -369,14 +386,15 @@ ENDIF(GDAL_HAS_TIFF)
# Check if ${GDAL_LIBRARY} has geotiff library
SET(GEOTIFF_LIBRARY ${GDAL_LIBRARY})
TRY_COMPILE(GDAL_HAS_GEOTIFF
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/CMake
${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestGDALHasGeoTiff.cxx
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GEOTIFF_INCLUDE_DIRS};${GDAL_INCLUDE_DIRS}" "-DLINK_DIRECTORIES:PATH=${GDAL_LIBRARY_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT)
IF(GDAL_HAS_GEOTIFF)
MESSAGE("-- Testing if GDAL has geotiff -- yes.")
MESSAGE(STATUS "Testing if GDAL has geotiff -- yes")
ELSE(GDAL_HAS_GEOTIFF)
MESSAGE("-- Testing if GDAL has geotiff -- no.")
MESSAGE(STATUS "Testing if GDAL has geotiff -- no")
MESSAGE(${OUTPUT})
FIND_LIBRARY(GEOTIFF_LIBRARY geotiff PATHS)
IF (NOT GEOTIFF_LIBRARY)
MESSAGE(FATAL_ERROR
......@@ -384,9 +402,44 @@ MESSAGE(FATAL_ERROR
ENDIF (NOT GEOTIFF_LIBRARY)
ENDIF(GDAL_HAS_GEOTIFF)
# Check if ${GDAL_LIBRARY} has jpeg library
SET(JPEG_LIBRARY ${GDAL_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_DIRECTORIES:PATH=${GDAL_LIBRARY_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT)
IF(GDAL_HAS_JPEG)
MESSAGE(STATUS "Testing if GDAL has jpeg -- yes")
ELSE(GDAL_HAS_JPEG)
MESSAGE(STATUS "Testing if GDAL has jpeg -- no")
MESSAGE(${OUTPUT})
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
SET(OGR_LIBRARY ${GDAL_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_DIRECTORIES:PATH=${GDAL_LIBRARY_DIRS}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT)
IF(GDAL_HAS_OGR)
MESSAGE(STATUS "Testing if GDAL has OGR -- yes")
ELSE(GDAL_HAS_OGR)
MESSAGE(STATUS "Testing if GDAL has OGR -- no")
MESSAGE(${OUTPUT})
FIND_LIBRARY(OGR_LIBRARY ogr PATHS)
IF (NOT OGR_LIBRARY)
MESSAGE(FATAL_ERROR
"Cannot find jpeg library. Please set OGR_LIBRARY.")
ENDIF (NOT OGR_LIBRARY)
ENDIF(GDAL_HAS_OGR)
# Include jpeg headers (FLTK ones)
INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Utilities/FLTK/jpeg)
#-------------------------------
# End connections whith external libraries
......
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