Commit c4d4d627 authored by Emmanuel Christophe's avatar Emmanuel Christophe

ENH: use the FIND_PACKAGE(GDAL) first

parent 4999e599
......@@ -439,7 +439,7 @@ IF(OTB_USE_EXTERNAL_BOOST)
TRY_COMPILE(BOOST_IS_COMPLETE
${CMAKE_CURRENT_BINARY_DIR}/CMake
${CMAKE_CURRENT_SOURCE_DIR}/CMake/otbTestCompileBoost.cxx
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${Boost_INCLUDE_DIR}"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${Boost_INCLUDE_DIR}"
OUTPUT_VARIABLE OUTPUT)
IF(BOOST_IS_COMPLETE)
MESSAGE(STATUS "Testing external Boost library -- yes")
......@@ -461,16 +461,19 @@ OPTION(OTB_USE_EXTERNAL_GDAL "Use an outside build of GDAL. (OFF is EXPERIMENTAL
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)
FIND_PACKAGE(GDAL)
IF (NOT GDAL_INCLUDE_DIRS)
MESSAGE(FATAL_ERROR
"Cannot find GDAL include directory. Please set GDAL_INCLUDE_DIRS.")
ENDIF (NOT GDAL_INCLUDE_DIRS)
IF (NOT GDAL_FOUND)
FIND_PATH(GDAL_INCLUDE_DIR gdal.h $ENV{GDAL_INCLUDE_DIR} /usr/include/gdal)
FIND_LIBRARY(GDAL_LIBRARY NAMES gdal gdal1.5.0 gdal1.4.0 gdal1.3.2 PATHS /usr/lib/gdal)
ENDIF(NOT GDAL_FOUND)
INCLUDE_DIRECTORIES(${GDAL_INCLUDE_DIRS})
IF (NOT GDAL_INCLUDE_DIR)
MESSAGE(FATAL_ERROR
"Cannot find GDAL include directory. Please set GDAL_INCLUDE_DIR.")
ENDIF (NOT GDAL_INCLUDE_DIR)
FIND_LIBRARY(GDAL_LIBRARY NAMES gdal gdal1.5.0 gdal1.4.0 gdal1.3.2 PATHS /usr/lib/gdal)
INCLUDE_DIRECTORIES(${GDAL_INCLUDE_DIR})
IF (NOT GDAL_LIBRARY)
MESSAGE(FATAL_ERROR
......@@ -479,7 +482,7 @@ IF(OTB_USE_EXTERNAL_GDAL)
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)
FIND_PATH(GEOTIFF_INCLUDE_DIRS geotiff.h $ENV{GDAL_INCLUDE_DIR} ${GDAL_INCLUDE_DIR} /usr/include/geotiff)
IF (NOT GEOTIFF_INCLUDE_DIRS)
MESSAGE(FATAL_ERROR
"Cannot find geotiff headers. Please set GEOTIFF_INCLUDE_DIRS.")
......@@ -487,7 +490,7 @@ IF(OTB_USE_EXTERNAL_GDAL)
INCLUDE_DIRECTORIES(${GEOTIFF_INCLUDE_DIRS})
# Find tiff headers
FIND_PATH(TIFF_INCLUDE_DIRS tiffio.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include)
FIND_PATH(TIFF_INCLUDE_DIRS tiffio.h $ENV{GDAL_INCLUDE_DIR} ${GDAL_INCLUDE_DIR} /usr/include)
IF (NOT TIFF_INCLUDE_DIRS)
MESSAGE(FATAL_ERROR
"Cannot find libtiff headers. Please set TIFF_INCLUDE_DIRS.")
......@@ -495,7 +498,7 @@ IF(OTB_USE_EXTERNAL_GDAL)
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIRS})
# Find jpeg headers
FIND_PATH(JPEG_INCLUDE_DIRS jpeglib.h $ENV{GDAL_INCLUDE_DIRS} ${GDAL_INCLUDE_DIRS} /usr/include)
FIND_PATH(JPEG_INCLUDE_DIRS jpeglib.h $ENV{GDAL_INCLUDE_DIR} ${GDAL_INCLUDE_DIR} /usr/include)
IF (NOT JPEG_INCLUDE_DIRS)
MESSAGE(FATAL_ERROR
"Cannot find jpeg headers. Please set JPEG_INCLUDE_DIRS.")
......@@ -503,7 +506,7 @@ IF(OTB_USE_EXTERNAL_GDAL)
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)
FIND_PATH(OGR_INCLUDE_DIRS ogrsf_frmts.h $ENV{GDAL_INCLUDE_DIR} ${GDAL_INCLUDE_DIR} /usr/include)
IF (NOT OGR_INCLUDE_DIRS)
MESSAGE(FATAL_ERROR
"Cannot find ogr headers. Please set OGR_INCLUDE_DIRS.")
......@@ -514,7 +517,7 @@ IF(OTB_USE_EXTERNAL_GDAL)
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}"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${TIFF_INCLUDE_DIRS};${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT)
IF(GDAL_HAS_TIFF)
MESSAGE(STATUS "Testing if GDAL has tiff -- yes")
......@@ -532,7 +535,7 @@ IF(OTB_USE_EXTERNAL_GDAL)
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}"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GEOTIFF_INCLUDE_DIRS};${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT)
IF(GDAL_HAS_GEOTIFF)
MESSAGE(STATUS "Testing if GDAL has geotiff -- yes")
......@@ -550,7 +553,7 @@ IF(OTB_USE_EXTERNAL_GDAL)
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}"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${JPEG_INCLUDE_DIRS};${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT)
IF(GDAL_HAS_JPEG)
MESSAGE(STATUS "Testing if GDAL has jpeg -- yes")
......@@ -568,7 +571,7 @@ IF(OTB_USE_EXTERNAL_GDAL)
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}"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${OGR_INCLUDE_DIRS};${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}"
OUTPUT_VARIABLE OUTPUT)
IF(GDAL_HAS_OGR)
MESSAGE(STATUS "Testing if GDAL has OGR -- yes")
......
......@@ -77,14 +77,14 @@ NB: On some linux plateforms, you may (and should) use the official distribution
--> set BUILD_SHARED_LIBS to OFF within CMake
--> set BUILD_TESTING to OFF within CMake
--> set CMAKE_INSTALL_PREFIX to INSTALL_DIR within CMake
--> set GDAL_INCLUDE_DIRS to INSTALL_DIR/include within CMake
--> set GDAL_INCLUDE_DIR to INSTALL_DIR/include within CMake
--> set GDAL_LIBRARY to INSTALL_DIR/lib/ gdal library within CMake
--> set OTB_USE_EXTERNAL_ITK to OFF within CMake
--> set FLTK_DIR to INSTALL_DIR/Fltk-Binary within CMake
--> generate the configuration with 'g'
make
make install
Installation on Microsoft Visual Studio .NET 2003 (7.1)
-------------------------------------------------------
......@@ -97,7 +97,7 @@ Installation on Microsoft Visual Studio .NET 2003 (7.1)
Load the solution (.sln file) and build the gdal project.
More details can be found at http://vterrain.org/Distrib/gdal.html.
Moreover, ORFEO Toolbox project provides for you windows binaries for gdal1.6.0 library. These files can
Moreover, ORFEO Toolbox project provides for you windows binaries for gdal1.6.0 library. These files can
be downloaded at http://www.orfeo-toolbox.org/packages
2. Install Fltk
......@@ -117,15 +117,15 @@ Installation on Microsoft Visual Studio .NET 2005 (8.0)
1. Install GDAL
Open a MS-DOS prompt.
Run the VCVARS32.bat script that comes with the compiler (it can be found in
Run the VCVARS32.bat script that comes with the compiler (it can be found in
Microsoft Visual Studio 8/VC/bin).
Then, go to the GDAL root directory, and tape :
Then, go to the GDAL root directory, and tape :
nmake /f makefile.vc
Once the build is successful, tape this line to install GDAL :
nmake /f makefile.vc install
More details about this install can be found at www.gdal.org/gdal_building.html.
2. Install Fltk
Use CMake on Windows to generate MSVC++ 8.0 project files from fltk sources.
......@@ -142,14 +142,14 @@ Installation with MinGW on Windows platform
0. Install MinGW
Download the lastest version of mingw and msys at http://www.mingw.org and install those
Download the lastest version of mingw and msys at http://www.mingw.org and install those
two programs.
Then, launch MinGW : a promp appears (similar to Linux one).
1. Install GDAL
To compile GDAL, at configure step, use these options :
./configure -prefix=INSTALL_DIR --host=mingw32 --without-libtool
./configure -prefix=INSTALL_DIR --host=mingw32 --without-libtool
--without-python --with-png=internal --with-libtiff=internal
--with-jpeg=internal
......
......@@ -98,7 +98,7 @@ 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} )
${GDAL_INCLUDE_DIR} )
#-----------------------------------------------------------------------------
# Include directories from the CURL build tree.
IF(OTB_USE_CURL)
......@@ -221,7 +221,7 @@ SET(OTB_INCLUDE_DIRS_BUILD_TREE_CXX ${OTB_INCLUDE_DIRS_BUILD_TREE_CXX}
#For GDAL header file
SET(OTB_INCLUDE_DIRS_BUILD_TREE_CXX ${OTB_INCLUDE_DIRS_BUILD_TREE_CXX}
${GDAL_INCLUDE_DIRS} )
${GDAL_INCLUDE_DIR} )
#For EXPAT header file
IF(OTB_USE_EXTERNAL_EXPAT)
......@@ -329,7 +329,7 @@ ENDIF(OTB_COMPILE_JPEG2000)
#For GDAL header file
SET(OTB_INCLUDE_ABSOLUE_DIRS ${OTB_INCLUDE_ABSOLUE_DIRS}
${GDAL_INCLUDE_DIRS} )
${GDAL_INCLUDE_DIR} )
#For EXPAT header file
IF(OTB_USE_EXTERNAL_EXPAT)
......
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