diff --git a/Modules/ThirdParty/GDAL/QB_multicomp_small.jpx b/Modules/ThirdParty/GDAL/QB_multicomp_small.jpx deleted file mode 100644 index 666be06a696902a459f6f4f9b4906efdb76637a8..0000000000000000000000000000000000000000 Binary files a/Modules/ThirdParty/GDAL/QB_multicomp_small.jpx and /dev/null differ diff --git a/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx b/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8fde10d519d9c4a729c9dbcd2084c18d4dc4f862 --- /dev/null +++ b/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx @@ -0,0 +1,42 @@ +#include <iostream> +#include <stdexcept> +#include <gdal.h> +#include <gdal_priv.h> + + +int main(int argc, char * argv[]) +{ + const char *pszFormat = argv[1]; + GDALDriver *poDriver,*poDriver2; + char **papszMetadata; + + GDALAllRegister(); + + GDALDriverH drv = NULL; + unsigned int count = GDALGetDriverCount(); + std::cout << "Nb of drivers : " << count << std::endl; + for (unsigned int i = 0; i < count; i++) + { + drv = GDALGetDriver(i); + std::cout << "i = " << i << " " << GDALGetDriverShortName(drv) << std::endl; + } + + std::cout << GDALGetDriverShortName(GDALGetDriverByName("GTiff")) << std::endl; + std::cout << GDALVersionInfo("RELEASE_NAME") << std::endl; + + // ------------------- step 1 ------------------- + GDALDataset *poSrcDS = + (GDALDataset *) GDALOpen( argv[1], GA_ReadOnly ); + GDALDataset *poDstDS; + + //poDriver2 = (GDALDriver *) GDALGetDriver(19); + poDriver2 = (GDALDriver *) GDALGetDriverByName(argv[3]); + poDstDS = poDriver2->CreateCopy( argv[2], poSrcDS, FALSE, NULL, NULL, NULL ); + + // ------------------- step 2 ------------------- + if( poDstDS != NULL ) + GDALClose( (GDALDatasetH) poDstDS ); + + return 1; // SUCCESS + +} diff --git a/Modules/ThirdParty/GDAL/gdalCreateTest.cxx b/Modules/ThirdParty/GDAL/gdalCreateTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..894579de438ddba9076d9b71eacef2e0b595d439 --- /dev/null +++ b/Modules/ThirdParty/GDAL/gdalCreateTest.cxx @@ -0,0 +1,62 @@ +#include <iostream> +#include <stdexcept> +#include <gdal.h> +#include <gdal_priv.h> +#include <ogr_spatialref.h> + + +int main(int argc, char * argv[]) +{ + const char *pszFormat = argv[1]; + GDALDriver *poDriver; + char **papszMetadata; + + GDALAllRegister(); + + // ------------------- step 1 ------------------- + poDriver = GetGDALDriverManager()->GetDriverByName(pszFormat); + + if( poDriver == NULL ) + { + std::cout << "poDriver NULL" << std::endl; + + return 0; //FAIL + } + + papszMetadata = poDriver->GetMetadata(); + if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, FALSE ) ) + printf( "Driver %s supports Create() method.\n", pszFormat ); + if( CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATECOPY, FALSE ) ) + printf( "Driver %s supports CreateCopy() method.\n", pszFormat ); + + // ------------------- step 2 ------------------- + GDALDataset *poDstDS; + char **papszOptions = NULL; + + poDstDS = poDriver->Create( argv[2], 512, 512, 1, GDT_Byte, + papszOptions ); + + // ------------------- step 3 ------------------- + double adfGeoTransform[6] = { 444720, 30, 0, 3751320, 0, -30 }; + OGRSpatialReference oSRS; + char *pszSRS_WKT = NULL; + GDALRasterBand *poBand; + GByte abyRaster[512*512]; + + poDstDS->SetGeoTransform( adfGeoTransform ); + + oSRS.SetUTM( 11, TRUE ); + oSRS.SetWellKnownGeogCS( "NAD27" ); + oSRS.exportToWkt( &pszSRS_WKT ); + poDstDS->SetProjection( pszSRS_WKT ); + CPLFree( pszSRS_WKT ); + + poBand = poDstDS->GetRasterBand(1); + poBand->RasterIO( GF_Write, 0, 0, 512, 512, + abyRaster, 512, 512, GDT_Byte, 0, 0 ); + + // ------------------- step 4 ------------------- + GDALClose( (GDALDatasetH) poDstDS ); + + return 1; // SUCCESS +} diff --git a/Modules/ThirdParty/GDAL/gdalOpenTest.cxx b/Modules/ThirdParty/GDAL/gdalOpenTest.cxx deleted file mode 100644 index 6f90ff00440c43e7238146bbb3ac1c61296e1bd4..0000000000000000000000000000000000000000 --- a/Modules/ThirdParty/GDAL/gdalOpenTest.cxx +++ /dev/null @@ -1,17 +0,0 @@ -#include <iostream> -#include <stdexcept> -#include <gdal.h> - -int main(int argc, char * argv[]) -{ - if (argc != 2) - { - std::cerr << "Usage : " << argv[0] << "filename" << std::endl; - return 0;//FAIL - } - - GDALAllRegister(); - GDALOpen(argv[1], GA_ReadOnly ); - - return 1;//SUCCESS -} diff --git a/Modules/ThirdParty/GDAL/gdalTest.sh.in b/Modules/ThirdParty/GDAL/gdalTest.sh.in index 162c6b3cc21f256e2b5769ed794bda7f4a24eeb3..42731f514148a163ba5d33d170cb7e463085169b 100644 --- a/Modules/ThirdParty/GDAL/gdalTest.sh.in +++ b/Modules/ThirdParty/GDAL/gdalTest.sh.in @@ -9,8 +9,6 @@ gdalTranslate=`dirname ${gdalConfig}`/gdal_translate mkdir -p ${tempFolder} -#TEST 1 : GDAL version -${gdalConfig} --version > ${tempFolder}/testgdal1.txt #TEST 2 : dyn. symbols if [ -z "${apple}" ] @@ -21,7 +19,7 @@ nm -U ${gdalLibLocation} | grep TIFFClose > ${tempFolder}/testgdal2.txt # -U : d fi #TEST 3 : Big tiff -${gdalTranslate} -co "BIGTIFF=YES" ${sourceDir}/Modules/ThirdParty/GDAL/logoVectoriel.png ${tempFolder}/logoVectoriel.tif > ${tempFolder}/testgdal3.txt +${gdalTranslate} -co "BIGTIFF=YES" ${tempFolder}/testImage.gtif ${tempFolder}/testImageBIG.tif > ${tempFolder}/testgdal3.txt #TEST 4 : GDAL formats ${gdalConfig} --formats > ${tempFolder}/testgdal4.txt diff --git a/Modules/ThirdParty/GDAL/gdalTest1.cxx b/Modules/ThirdParty/GDAL/gdalTest1.cxx deleted file mode 100644 index 275a0372a97defb299fec26bcd04618e11edd6a6..0000000000000000000000000000000000000000 --- a/Modules/ThirdParty/GDAL/gdalTest1.cxx +++ /dev/null @@ -1,63 +0,0 @@ -#include <fstream> -#include <iostream> -#include <sstream> -#include <cstdlib> -#include <vector> - -using namespace std; - - -//----------------- gdal >= 1.10 ------------------------- -int main(int argc, char * argv[]) -{ - - const char * inputFilename = argv[1]; - - ifstream file(inputFilename, ios::in); - if(file) - { - - string line; - vector<unsigned int> UIntVect; - - getline(file, line); - - //Parsing - istringstream iss(line); - unsigned int pos=0; - string sub; - unsigned int someUIntVal; - while ( std::getline( iss, sub, '.' ) ) - { - istringstream convert(sub); - convert >> someUIntVal; - //cout << someUIntVal << '\n'; - - if (pos==0) //Major - UIntVect.push_back(someUIntVal); - if (pos==1) //Minor - UIntVect.push_back(someUIntVal); - - pos++; - } - - file.close(); - - if ( (UIntVect[0]<1) || (UIntVect[1]<10) ) - { - cout << "WARNING : Version of GDAL must be >= 1.10 (" << UIntVect[0] << "." << UIntVect[1] << " detected)." << endl; - return 1; - } - - } - /*else - { - cout << "WARNING : Can't open file " << inputFilename << endl; - return 2; - }*/ - - - - return EXIT_SUCCESS; - -} diff --git a/Modules/ThirdParty/GDAL/gdalTest2.cxx b/Modules/ThirdParty/GDAL/gdalTest2.cxx index 5b97ec80d5afd4ca5d005fb7d1415149b9a24782..d3406e7c468ab8fa94b8ce8f11fc7e4837a04408 100644 --- a/Modules/ThirdParty/GDAL/gdalTest2.cxx +++ b/Modules/ThirdParty/GDAL/gdalTest2.cxx @@ -28,7 +28,7 @@ int main(int argc, char * argv[]) } } - + file.close(); } /*else { diff --git a/Modules/ThirdParty/GDAL/gdalTest3.cxx b/Modules/ThirdParty/GDAL/gdalTest3.cxx index 23cf870c67a10c57bbf25d11bda4ca6721803685..487202ab32fb2ad06d9316fe62647f64cc4d3f34 100644 --- a/Modules/ThirdParty/GDAL/gdalTest3.cxx +++ b/Modules/ThirdParty/GDAL/gdalTest3.cxx @@ -27,6 +27,8 @@ int main(int argc, char * argv[]) cout << "WARNING : No BIGTIFF capatilities" << endl; return 1; } + + file.close(); } /*else diff --git a/Modules/ThirdParty/GDAL/gdalTest4.cxx b/Modules/ThirdParty/GDAL/gdalTest4.cxx index 53c95d12475a0ac39991f56683a2c69df393d1d8..81956edca10354fbf751a859efe9fba30de9c41c 100644 --- a/Modules/ThirdParty/GDAL/gdalTest4.cxx +++ b/Modules/ThirdParty/GDAL/gdalTest4.cxx @@ -20,6 +20,8 @@ int main(int argc, char * argv[]) while(getline(file, line)) if (line.find(format) != string::npos) return 1; //SUCCESS + + file.close(); } /*else diff --git a/Modules/ThirdParty/GDAL/gdalVersionTest.cxx b/Modules/ThirdParty/GDAL/gdalVersionTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..22f1f6a2f0b60fa9a1befa4b1001d2a764bcaca2 --- /dev/null +++ b/Modules/ThirdParty/GDAL/gdalVersionTest.cxx @@ -0,0 +1,64 @@ +#include <fstream> +#include <iostream> +#include <sstream> +#include <cstdlib> +#include <string> +#include <vector> +#include <gdal.h> + +using namespace std; + +//----------------- FORMAT ------------------------- +int main(int argc, char * argv[]) +{ + + string version(GDALVersionInfo("RELEASE_NAME")); + + // Remember gdal version + const char * inputFilename = argv[1]; + ofstream file(inputFilename, ios::out | ios::trunc); + if(file) + { + + file << version; + file.close(); + + } + /*else + { + cout << "WARNING : Can't open file " << inputFilename << endl; + return 2; + }*/ + + + //Version check + istringstream iss(version); + unsigned int pos=0; + string sub; + unsigned int someUIntVal; + vector<unsigned int> UIntVect; + while ( std::getline( iss, sub, '.' ) ) + { + istringstream convert(sub); + convert >> someUIntVal; + //cout << someUIntVal << '\n'; + + if (pos==0) //Major + UIntVect.push_back(someUIntVal); + if (pos==1) //Minor + UIntVect.push_back(someUIntVal); + + pos++; + } + + + if ( (UIntVect[0]<1) || (UIntVect[1]<10) ) + { + cout << "WARNING : Version of GDAL must be >= 1.10 (" << UIntVect[0] << "." << UIntVect[1] << " detected)." << endl; + return 1; + } + + + return EXIT_SUCCESS; + +} diff --git a/Modules/ThirdParty/GDAL/logoVectoriel.png b/Modules/ThirdParty/GDAL/logoVectoriel.png deleted file mode 100644 index e2e9725816015d0dd9b5176774f1fbd778cdab4a..0000000000000000000000000000000000000000 Binary files a/Modules/ThirdParty/GDAL/logoVectoriel.png and /dev/null differ diff --git a/Modules/ThirdParty/GDAL/otb-module-init.cmake b/Modules/ThirdParty/GDAL/otb-module-init.cmake index bb97a22a27a0a2bd2d24f118505ede04b9ddfd49..5a244c39b301f40534f2c06c9ae7c513ad195622 100644 --- a/Modules/ThirdParty/GDAL/otb-module-init.cmake +++ b/Modules/ThirdParty/GDAL/otb-module-init.cmake @@ -9,103 +9,118 @@ if(NOT GDAL_FOUND) message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY") endif() -if(UNIX) +message(STATUS "Check if Gdal qualifies for Orfeo ToolBox") + +#------------------- TESTS --------------------- +# Version of GDAL +try_run(RUN_RESULT_VERSION COMPILE_RESULT_VERSION ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalVersionTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/gdalVersion.txt) + +# Has OGR +try_compile(GDAL_HAS_OGR ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOGRTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}") + +# Can create geotiff file +try_run(GDAL_CAN_CREATE_GEOTIFF COMPILE_RESULT_CREATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS GTiff ${TEMP}/testImage.gtif ) +if(GDAL_CAN_CREATE_GEOTIFF) + + # Can create jpeg file + try_run(GDAL_CAN_CREATE_JPEG COMPILE_RESULT_CREATECOPY ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/testImage.gtif ${TEMP}/testImage.jpeg JPEG) + # Can create jpeg2000 file + try_run(GDAL_CAN_CREATE_JPEG2000 COMPILE_RESULT_CREATECOPY ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/testImage.gtif ${TEMP}/testImage.j2k JPEG2000) + +endif() +#------------------- TESTS (END)--------------------- + + +# Warning messages +if (NOT COMPILE_RESULT_VERSION) + message(WARNING "Modules/ThirdParty/GDAL/gdalVersionTest.cxx did not compile.") +endif() + +if (${RUN_RESULT_VERSION} EQUAL 1) + message(WARNING "Version of GDAL must be >= 1.10") +endif() + +if (NOT GDAL_HAS_OGR) + message(WARNING "GDAL doesn't expose OGR library symbols.") +endif() - message(STATUS "Check if Gdal qualifies for Orfeo ToolBox") +if (NOT COMPILE_RESULT_CREATE) + message(WARNING "Modules/ThirdParty/GDAL/gdalCreateTest.cxx did not compile.") +endif() +if (NOT COMPILE_RESULT_CREATECOPY) + message(WARNING "Modules/ThirdParty/GDAL/gdalCreateCopyTest.cxx did not compile.") +endif() +if (NOT GDAL_CAN_CREATE_GEOTIFF) + message(WARNING "GDAL can't create tiff files.") +endif() +if (NOT GDAL_CAN_CREATE_JPEG) + message(WARNING "GDAL can't create jpeg files.") +endif() +if (NOT GDAL_CAN_CREATE_JPEG2000) + message(WARNING "GDAL can't create jpeg2000 files.") +endif() + + + + +#FOR UNIX SYSTEMS ONLY +if(UNIX) - if("x${GDAL_CONFIG}" STREQUAL "x") - message(FATAL_ERROR "Cannot find gdal-config executable. Set GDAL_CONFIG") - endif() - - # Prepare bash script - configure_file(${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest.sh.in ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh @ONLY) - execute_process(COMMAND chmod u+x ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh) - execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh) - - - #------------------- TESTS --------------------- - # Version of GDAL - try_run(RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest1.cxx ARGS ${TEMP}/testgdal1.txt) - - # test libtiff/libgeotiff and test if symbols are renamed (only for internal libtiff/libgeotiff) - try_run(RUN_RESULT_VAR2 COMPILE_RESULT_VAR2 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest2.cxx ARGS ${TEMP}/testgdal2.txt) - - # bigtiff - try_run(RUN_RESULT_VAR3 COMPILE_RESULT_VAR3 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest3.cxx ARGS ${TEMP}/testgdal3.txt) - - # formats - try_run(GDAL_HAS_HDF COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt hdf) - try_run(GDAL_HAS_J2K_JG2000 COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt jpeg2000) - try_run(GDAL_HAS_J2K_OPJG COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt openjpeg) - try_run(GDAL_HAS_J2K_KAK COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt jp2kak) - try_run(GDAL_HAS_J2K_ECW COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt ecw) - - # Has OGR - try_compile(GDAL_HAS_OGR ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOGRTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}") - - # Can open tiff file - try_run(GDAL_CAN_OPEN_TIFF COMPILE_RESULT_OPEN ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOpenTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/otb_logo.tif) - - # Can open jpeg file - try_run(GDAL_CAN_OPEN_JPEG COMPILE_RESULT_OPEN ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOpenTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/otb_logo.jpeg) - - # Can open jpeg2000 file - try_run(GDAL_CAN_OPEN_JPEG2000 COMPILE_RESULT_OPEN ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOpenTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/QB_multicomp_small.jpx) - - # Can open geotiff file - #try_run(GDAL_CAN_OPEN_GEOTIFF COMPILE_RESULT_OPEN ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOpenTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/GEOTIFF) - - #------------------- TESTS (END)--------------------- - - - # Compilations checking - if (NOT COMPILE_RESULT_VAR1) - message(WARNING "Modules/ThirdParty/GDAL/gdalTest1.cxx did not compile.") - endif() - if (NOT COMPILE_RESULT_VAR2) - message(WARNING "Modules/ThirdParty/GDAL/gdalTest2.cxx did not compile.") - endif() - if (NOT COMPILE_RESULT_VAR3) - message(WARNING "Modules/ThirdParty/GDAL/gdalTest3.cxx did not compile.") - endif() - if (NOT COMPILE_RESULT_VAR4) - message(WARNING "Modules/ThirdParty/GDAL/gdalTest4.cxx did not compile.") - endif() - if (NOT COMPILE_RESULT_OPEN) - message(WARNING "Modules/ThirdParty/GDAL/gdalOpenTest.cxx did not compile.") - endif() - - # Warning messages - if (${RUN_RESULT_VAR1} EQUAL 1) - message(WARNING "Version of GDAL must be >= 1.10") - endif() - if (${RUN_RESULT_VAR2} EQUAL 1) - message(WARNING "Internal versions of libtiff/libgeotiff detected without symbol renaming (when configuring GDAL, if options --with-libtiff or --with-geotiff are set to 'internal', then options --with-rename-internal-libtiff-symbols and --with-rename-internal-libgeotiff-symbols should be set to 'yes').") - endif() - if (${RUN_RESULT_VAR3} EQUAL 1) - message(WARNING "No BIGTIFF capatilities.") - endif() - if (NOT GDAL_HAS_HDF) - message(WARNING "No HDF capatilities.") - endif() - if (NOT GDAL_HAS_J2K_JG2000 AND NOT GDAL_HAS_J2K_OPJG AND NOT GDAL_HAS_J2K_KAK AND NOT GDAL_HAS_J2K_ECW) - message(WARNING "No Jpeg2000 driver found (compatible drivers are : OpenJpeg, Kakadu, ECW).") - endif() - if (NOT GDAL_HAS_OGR) - message(WARNING "GDAL doesn't expose OGR library symbols.") - endif() - if (NOT GDAL_CAN_OPEN_TIFF) - message(WARNING "GDAL can't open tiff files.") - endif() - if (NOT GDAL_CAN_OPEN_JPEG) - message(WARNING "GDAL can't open jpeg files.") - endif() - if (NOT GDAL_CAN_OPEN_JPEG2000) - message(WARNING "GDAL can't open jpeg files.") - endif() - #if (NOT GDAL_CAN_OPEN_GEOTIFF) - # message(WARNING "GDAL can't open geotiff files.") - #endif() + if(GDAL_CAN_CREATE_GEOTIFF) + + if("x${GDAL_CONFIG}" STREQUAL "x") + message(FATAL_ERROR "Cannot find gdal-config executable. Set GDAL_CONFIG") + endif() + + # Prepare bash script + configure_file(${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest.sh.in ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh @ONLY) + execute_process(COMMAND chmod u+x ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh) + execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/gdalTest.sh) + + + #------------------- TESTS --------------------- + # test libtiff/libgeotiff and test if symbols are renamed (only for internal libtiff/libgeotiff) + try_run(RUN_RESULT_VAR2 COMPILE_RESULT_VAR2 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest2.cxx ARGS ${TEMP}/testgdal2.txt) + + # bigtiff + try_run(RUN_RESULT_VAR3 COMPILE_RESULT_VAR3 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest3.cxx ARGS ${TEMP}/testgdal3.txt) + + # formats + try_run(GDAL_HAS_HDF COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt hdf) + try_run(GDAL_HAS_J2K_JG2000 COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt jpeg2000) + try_run(GDAL_HAS_J2K_OPJG COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt openjpeg) + try_run(GDAL_HAS_J2K_KAK COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt jp2kak) + try_run(GDAL_HAS_J2K_ECW COMPILE_RESULT_VAR4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalTest4.cxx ARGS ${TEMP}/testgdal4.txt ecw) + + #------------------- TESTS (END)--------------------- + + + # Warning messages + if (NOT COMPILE_RESULT_VAR2) + message(WARNING "Modules/ThirdParty/GDAL/gdalTest2.cxx did not compile.") + endif() + if (NOT COMPILE_RESULT_VAR3) + message(WARNING "Modules/ThirdParty/GDAL/gdalTest3.cxx did not compile.") + endif() + if (NOT COMPILE_RESULT_VAR4) + message(WARNING "Modules/ThirdParty/GDAL/gdalTest4.cxx did not compile.") + endif() + + + if (${RUN_RESULT_VAR2} EQUAL 1) + message(WARNING "Internal versions of libtiff/libgeotiff detected without symbol renaming (when configuring GDAL, if options --with-libtiff or --with-geotiff are set to 'internal', then options --with-rename-internal-libtiff-symbols and --with-rename-internal-libgeotiff-symbols should be set to 'yes').") + endif() + if (${RUN_RESULT_VAR3} EQUAL 1) + message(WARNING "No BIGTIFF capatilities.") + endif() + if (NOT GDAL_HAS_HDF) + message(WARNING "No HDF capatilities.") + endif() + if (NOT GDAL_HAS_J2K_JG2000 AND NOT GDAL_HAS_J2K_OPJG AND NOT GDAL_HAS_J2K_KAK AND NOT GDAL_HAS_J2K_ECW) + message(WARNING "No Jpeg2000 driver found (compatible drivers are : OpenJpeg, Kakadu, ECW).") + endif() + + endif() #GDAL_CAN_CREATE_GEOTIFF -endif() #UNIX +endif() #UNIX diff --git a/Modules/ThirdParty/GDAL/otb_logo.jpeg b/Modules/ThirdParty/GDAL/otb_logo.jpeg deleted file mode 100644 index 1e4860f55f92573dbfdbcabc6ec55ed0bcf4a3d8..0000000000000000000000000000000000000000 Binary files a/Modules/ThirdParty/GDAL/otb_logo.jpeg and /dev/null differ diff --git a/Modules/ThirdParty/GDAL/otb_logo.tif b/Modules/ThirdParty/GDAL/otb_logo.tif deleted file mode 100644 index 7e468f3b2ab04a846396c6c58930578fa4e65385..0000000000000000000000000000000000000000 Binary files a/Modules/ThirdParty/GDAL/otb_logo.tif and /dev/null differ