Make configuration on Windows simpler
Mantis Issue 346, reported by jmalik, assigned to jmalik, created: 2011-06-17
Recently, I introduced auto detection of OSGeo4W dependencies during OTB configuration : http://hg.orfeo-toolbox.org/OTB/rev/e651f41c39c7 http://hg.orfeo-toolbox.org/OTB/rev/857b7991ee22
Aim was to relieve the user from the burden of setting the complete path to all headers/library for all the libraries for which we know the complete path.
It is tested by the configuration Win7-Visual2008-Release-Static on raoul : http://hg.orfeo-toolbox.org/OTB-DevUtils/file/tip/Config/raoul-Win7-OTB-Release-VC2008.cmake If OSGEO4W_ROOT is defined (i.e. if cmake is launched from an OSGeo4W shell), then gdal/tiff/geotiff/png/jpeg/curl/expat/... are automatically recognised : cf configure logs in http://dash.orfeo-toolbox.org/viewConfigure.php?buildid=56704
Still, the remaining "things to set by hand" are : [1] mapnik Need to set : OTB_USE_EXTERNAL_BOOST:BOOL=ON OTB_USE_MAPNIK:BOOL=ON MAPNIK_INCLUDE_DIR:PATH=C:/OSGeo4W/include/mapnik MAPNIK_LIBRARY:FILEPATH=C:/OSGeo4W/lib/mapnik.lib FREETYPE2_INCLUDE_DIR:PATH=C:/OSGeo4W/include/freetype ICUUC_INCLUDE_DIR:PATH=C:/Program Files (x86)/icu4c-4_2_1-Win32-msvc9/icu/include ICUUC_LIBRARY:FILEPATH=C:/Program Files (x86)/icu4c-4_2_1-Win32-msvc9/icu/lib/icuuc.lib LTDL_INCLUDE_DIR:PATH=C:/Program Files (x86)/GnuWin32/include LTDL_LIBRARY:FILEPATH=C:/Program Files (x86)/GnuWin32/lib/ltdl.lib
Cannot be addressed at the moment as LTDL/ICUUC/boost are not packaged in OSGeo4W. We should wait and see after the summer, since Mapnik has a GSoC project going on about enhancement of the build system. So we can hope for a usable mapnik library in OSGeo4W
[2] Curl We still need to set OTB_USE_CURL:BOOL=ON After that the curl headers and library path are found without user interaction. This is because the first attempt in ImportCurl.cmake is done with FindPackage(CURL), and so uses Cmake default FindCurl, which does not know about OSGEo4W lib names/header path.
One solution could be to fork FindCURL.cmake from a recent cmake, then add our own OSGeo4W paths when OSGEO4W_ROOT is defined. It seems to me this approach is taken by a lot of project out there. Maybe we should try to replace all the "ImportXXX.cmake" by cmake-ready "FindXXX.cmake" (in this case the find_package will first find the FindXXX.cmake inside the OTB/Cmake dir and won't use the CMake default module path).
[2] Expat Same issue as Curl. We need OTB_USE_EXTERNAL_EXPAT:BOOL=ON, we may need to maintain our own FindExpat.cmake to simplify the process.
Please note that currently ImportExpat.cmake contains 2 times a find_package(expat) followed by a find_path() and a find_library() call... A single call to find_package(expat) should be sufficient.
[3] Liblas
Need to set : OTB_USE_LIBLAS:BOOL=ON OTB_USE_EXTERNAL_LIBLAS:BOOL=ON (relooking at the cmake code, OTB_USE_LIBLAS:BOOL=ON seems not necessary).
Would be nice to have it activated by default also. OTB_USE_EXTERNAL_LIBLAS is initialized to OFF, so even if it is correctly found in FindOSGeo4W.cmake, it cannot be used. Should we initialize some cmake option directly in FindOSGeo4W.cmake ?
I'm opening this bug to gather suggestions and try to resolve the last issues (that is : being able to run cmake without setting anything, and having a maximal number of external libs enabled)
1372858314 - julienmNow OSGeo4W is handled by adding the right path to : CMAKE_INCLUDE_PATH CMAKE_LIBRARY_PATH
so that other FindXXX, even external, can easily find the good lib.
1372858343 - julienmCurl / Expat / Liblas are now correctly handled
1372858399 - julienmNothing better to do for mapnik unless an OSGeo4w package with all dependencies is provided.