Commit 8f4de162 authored by Guillaume Pasero's avatar Guillaume Pasero

ADD: initial set of superbuild projects for OTB (WIN32 not complete)

parents
message(STATUS "Setup GDAL...")
set(proj GDAL)
set(DEFAULT_USE_SYSTEM_GDAL OFF)
option(USE_SYSTEM_GDAL " Use a system build of GDAL." ${DEFAULT_USE_SYSTEM_GDAL})
mark_as_advanced(USE_SYSTEM_GDAL)
if(USE_SYSTEM_GDAL)
message(STATUS " Using GDAL system version")
else()
set(GDAL_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
set(GDAL_SB_SRC ${CMAKE_BINARY_DIR}/${proj}/src/${proj})
if(WIN32)
# TODO : use nmake
else()
ExternalProject_Add(${proj}
DEPENDS OPENJPEG TIFF
PREFIX ${proj}
URL "http://download.osgeo.org/gdal/1.11.0/gdal-1.11.0.tar.gz"
URL_MD5 9fdf0f2371a3e9863d83e69951c71ec4
BINARY_DIR ${GDAL_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${GDAL_SB_BUILD_DIR}/configure
--prefix=${CMAKE_INSTALL_PREFIX}
--with-libtiff=${CMAKE_INSTALL_PREFIX}
--with-geotiff=${CMAKE_INSTALL_PREFIX}
#--with-rename-internal-libtiff-symbols=yes
#--with-rename-internal-libgeotiff-symbols=yes
--with-openjpeg=${CMAKE_INSTALL_PREFIX}
--without-ogdi
--without-jasper
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Add_Step(${proj} copy_source
COMMAND ${CMAKE_COMMAND} -E copy_directory
${GDAL_SB_SRC} ${GDAL_SB_BUILD_DIR}
DEPENDEES patch update
DEPENDERS configure
)
endif()
message(STATUS " Using GDAL SuperBuild version")
endif()
message(STATUS "Setup ITK...")
set(proj ITK)
# Use an external version of ITK by default except on windows (ITK is not packaged in OSGeo4W)
set(DEFAULT_USE_SYSTEM_ITK OFF)
option(USE_SYSTEM_ITK "Use a system build of ITK." ${DEFAULT_USE_SYSTEM_ITK})
mark_as_advanced(USE_SYSTEM_ITK)
if(USE_SYSTEM_ITK)
message(STATUS " Using ITK system version")
else()
set(ITK_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
set(ITK_SB_SRC_DIR ${CMAKE_BINARY_DIR}/${proj}/src/${proj})
set(ITK_ENABLED_MODULES
Common
FiniteDifference
GPUCommon
GPUFiniteDifference
ImageAdaptors
ImageFunction
Mesh
QuadEdgeMesh
SpatialObjects
#TestKernel
Transform
AnisotropicSmoothing
AntiAlias
BiasCorrection
BinaryMathematicalMorphology
Colormap
Convolution
CurvatureFlow
Deconvolution
Denoising
#DiffusionTensorImage
DisplacementField
DistanceMap
FastMarching
FFT
GPUAnisotropicSmoothing
GPUImageFilterBase
GPUSmoothing
GPUThresholding
ImageCompare
ImageCompose
ImageFeature
ImageFilterBase
ImageFusion
ImageGradient
ImageGrid
ImageIntensity
ImageLabel
ImageSources
ImageStatistics
LabelMap
MathematicalMorphology
Path
QuadEdgeMeshFiltering
Smoothing
SpatialFunction
Thresholding
Eigen
#FEM
NarrowBand
NeuralNetworks
Optimizers
Optimizersv4
Polynomials
Statistics
RegistrationCommon
#FEMRegistration
GPURegistrationCommon
GPUPDEDeformableRegistration
Metricsv4
PDEDeformableRegistration
RegistrationMethodsv4
#BioCell
Classifiers
ConnectedComponents
DeformableMesh
KLMRegionGrowing
LabelVoting
LevelSets
LevelSetsv4
#LevelSetsv4Visualization
MarkovRandomFieldsClassifiers
RegionGrowing
SignedDistanceFunction
Voronoi
Watersheds
)
set(ITK_MODULES_CMAKE_CACHE)
foreach(ITK_MODULE ${ITK_ENABLED_MODULES})
list(APPEND ITK_MODULES_CMAKE_CACHE -DModule_ITK${ITK_MODULE}:BOOL=ON)
endforeach()
# By default activate FFTW, but with an external fftw build
# These variables are used in ITK to initialize the value of the ITK_USE_FFTW_XXX options
if (WIN32)
set(FFTW_STATUS OFF)
else()
set(FFTW_STATUS ON)
endif()
# TODO : handle different build type (Release/Debug)
# TODO : handle system zlib
ExternalProject_Add(${proj}
PREFIX ${proj}
URL "http://sourceforge.net/projects/itk/files/itk/4.6/InsightToolkit-4.6.1.tar.gz/download"
URL_MD5 2c84eae50ab2452cdad32aaadced3c37
BINARY_DIR ${ITK_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release
-DITK_BUILD_DEFAULT_MODULES:BOOL=OFF
${ITK_MODULES_CMAKE_CACHE}
-DITKGroup_Core:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DUSE_FFTWF:BOOL=${FFTW_STATUS}
-DUSE_FFTWD:BOOL=${FFTW_STATUS}
#-DUSE_SYSTEM_FFTW:BOOL=${FFTW_STATUS}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/patches_ITK/hashtable.hxx.in
${ITK_SB_SRC_DIR}/Modules/ThirdParty/KWSys/src/KWSys
)
# write patch in binary dir
#file(WRITE ${CMAKE_BINARY_DIR}/itk_patch_1.cmake
# "configure_file(${CMAKE_SOURCE_DIR}/patches_ITK/hashtable.hxx.in
# ${ITK_SB_SRC_DIR}/Modules/ThirdParty/KWSys/src/KWSys/hashtable.hxx.in COPYONLY)")
message(STATUS " Using ITK SuperBuild version")
endif()
message(STATUS "Setup OTB...")
set(proj OTB)
set(OTB_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
ExternalProject_Add(${proj}
DEPENDS ITK OSSIM GDAL
PREFIX ${proj}
HG_REPOSITORY "http://hg.orfeo-toolbox.org/OTB"
HG_TAG tip
BINARY_DIR ${OTB_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_SHARED_LIBS:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_APPLICATIONS:BOOL=ON
-DOTB_WRAP_QT:BOOL=ON
-DITK_DIR:PATH=${CMAKE_INSTALL_PREFIX}/lib/cmake/ITK-4.6
-DCMAKE_PREFIX_PATH:STRING=${CMAKE_INSTALL_PREFIX}
-DOTB_USE_EXTERNAL_OSSIM:BOOL=ON
-DGDAL_INCLUDE_DIR:PATH=${CMAKE_INSTALL_PREFIX}/include
-DGDAL_LIBRARY:PATH=${CMAKE_INSTALL_PREFIX}/lib/libgdal.so
-DGDAL_CONFIG:PATH=${CMAKE_INSTALL_PREFIX}/bin/gdal-config
)
message(STATUS " Using OTB SuperBuild version")
message(STATUS "Setup OpenJpeg...")
set(proj OPENJPEG)
set(DEFAULT_USE_SYSTEM_OPENJPEG OFF)
option(USE_SYSTEM_OPENJPEG " Use a system build of OpenJpeg." ${DEFAULT_USE_SYSTEM_OPENJPEG})
mark_as_advanced(USE_SYSTEM_OPENJPEG)
if(USE_SYSTEM_OPENJPEG)
message(STATUS " Using OpenJpeg system version")
else()
# TODO : handle dependencies : TIFF, ZLIB, ...
set(OPENJPEG_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
set(OPENJPEG_SB_SRC ${CMAKE_BINARY_DIR}/${proj}/src/${proj})
ExternalProject_Add(${proj}
PREFIX ${proj}
URL "http://sourceforge.net/projects/openjpeg.mirror/files/2.0.0/openjpeg-2.0.0.tar.gz/download"
URL_MD5 d9be274bddc0f47f268e484bdcaaa6c5
BINARY_DIR ${OPENJPEG_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_CODEC:BOOL=ON
-DBUILD_DOC:BOOL=OFF
-DBUILD_JPIP:BOOL=OFF
-DBUILD_JPWL:BOOL=OFF
-DBUILD_MJ2:BOOL=OFF
-DBUILD_PKGCONFIG_FILES:BOOL=ON
-DBUILD_SHARED_LIBS:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
-DBUILD_THIRDPARTY:BOOL=OFF
)
message(STATUS " Using OpenJpeg SuperBuild version")
endif()
message(STATUS "Setup GEOS ...")
set(proj GEOS)
set(DEFAULT_USE_SYSTEM_GEOS OFF)
option(USE_SYSTEM_GEOS " Use a system build of GEOS." ${DEFAULT_USE_SYSTEM_GEOS})
mark_as_advanced(USE_SYSTEM_GEOS)
if(USE_SYSTEM_GEOS)
message(STATUS " Using GEOS system version")
else()
set(GEOS_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
set(GEOS_SB_SRC ${CMAKE_BINARY_DIR}/${proj}/src/${proj})
ExternalProject_Add(${proj}
PREFIX ${proj}
URL "http://download.osgeo.org/geos/geos-3.4.2.tar.bz2"
URL_MD5 fc5df2d926eb7e67f988a43a92683bae
BINARY_DIR ${GEOS_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_SHARED_LIBS:BOOL=ON
)
endif()
message(STATUS "Setup libgeotiff...")
set(proj GEOTIFF)
set(DEFAULT_USE_SYSTEM_GEOTIFF OFF)
option(USE_SYSTEM_GEOTIFF " Use a system build of libgeotiff." ${DEFAULT_USE_SYSTEM_GEOTIFF})
mark_as_advanced(USE_SYSTEM_GEOTIFF)
if(USE_SYSTEM_GEOTIFF)
message(STATUS " Using libgeotiff system version")
else()
set(${proj}_DEPENDENCIES)
set(GEOTIFF_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
set(GEOTIFF_SB_SRC ${CMAKE_BINARY_DIR}/${proj}/src/${proj})
# handle dependencies : TIFF Proj4 Zlib
if(USE_SYSTEM_LIBTIFF)
set(GEOTIFF_SB_TIFF_CONFIG)
else()
set(GEOTIFF_SB_TIFF_CONFIG --with-libtiff=${CMAKE_INSTALL_PREFIX})
list(APPEND ${proj}_DEPENDENCIES TIFF)
endif()
if(USE_SYSTEM_PROJ)
set(GEOTIFF_SB_PROJ_CONFIG)
else()
set(GEOTIFF_SB_PROJ_CONFIG --with-proj=${CMAKE_INSTALL_PREFIX})
list(APPEND ${proj}_DEPENDENCIES PROJ)
endif()
if(USE_SYSTEM_ZLIB)
set(GEOTIFF_SB_ZLIB_CONFIG)
else()
set(GEOTIFF_SB_ZLIB_CONFIG --with-zlib=${CMAKE_INSTALL_PREFIX})
list(APPEND ${proj}_DEPENDENCIES ZLIB)
endif()
if(WIN32)
# TODO : use nmake
else()
ExternalProject_Add(${proj}
PREFIX ${proj}
URL "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.0.tar.gz"
URL_MD5 efa7b418bc00228fcda4da63557e40c2
BINARY_DIR ${GEOTIFF_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${GEOTIFF_SB_BUILD_DIR}/configure
--prefix=${CMAKE_INSTALL_PREFIX}
--enable-static=no
${GEOTIFF_SB_TIFF_CONFIG}
${GEOTIFF_SB_PROJ_CONFIG}
${GEOTIFF_SB_ZLIB_CONFIG}
BUILD_COMMAND make
INSTALL_COMMAND make install
DEPENDS ${${proj}_DEPENDENCIES}
)
ExternalProject_Add_Step(${proj} copy_source
COMMAND ${CMAKE_COMMAND} -E copy_directory
${GEOTIFF_SB_SRC} ${GEOTIFF_SB_BUILD_DIR}
DEPENDEES patch update
DEPENDERS configure
)
endif()
message(STATUS " Using libgeotiff SuperBuild version")
endif()
message(STATUS "Setup libtiff...")
set(proj TIFF)
set(DEFAULT_USE_SYSTEM_LIBTIFF OFF)
option(USE_SYSTEM_LIBTIFF " Use a system build of libtiff." ${DEFAULT_USE_SYSTEM_LIBTIFF})
mark_as_advanced(USE_SYSTEM_LIBTIFF)
if(USE_SYSTEM_LIBTIFF)
message(STATUS " Using libtiff system version")
else()
set(${proj}_DEPENDENCIES)
set(LIBTIFF_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
set(LIBTIFF_SB_SRC ${CMAKE_BINARY_DIR}/${proj}/src/${proj})
if(USE_SYSTEM_ZLIB)
set(LIBTIFF_SB_ZLIB_CONFIG)
else()
set(LIBTIFF_SB_ZLIB_CONFIG
--with-zlib-include-dir=${CMAKE_INSTALL_PREFIX}/include
--with-zlib-lib-dir=${CMAKE_INSTALL_PREFIX}/lib)
list(APPEND ${proj}_DEPENDENCIES ZLIB)
endif()
if(WIN32)
# TODO : use nmake
else()
ExternalProject_Add(${proj}
PREFIX ${proj}
URL "ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.7.tar.gz"
URL_MD5 626102f448ba441d42e3212538ad67d2
BINARY_DIR ${LIBTIFF_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${LIBTIFF_SB_BUILD_DIR}/configure
--prefix=${CMAKE_INSTALL_PREFIX}
--enable-static=no
${LIBTIFF_SB_ZLIB_CONFIG}
BUILD_COMMAND make
INSTALL_COMMAND make install
DEPENDS ${${proj}_DEPENDENCIES}
)
ExternalProject_Add_Step(${proj} copy_source
COMMAND ${CMAKE_COMMAND} -E copy_directory
${LIBTIFF_SB_SRC} ${LIBTIFF_SB_BUILD_DIR}
DEPENDEES patch update
DEPENDERS configure
)
endif()
message(STATUS " Using libtiff SuperBuild version")
endif()
message(STATUS "Setup Ossim...")
set(proj OSSIM)
set(DEFAULT_USE_SYSTEM_OSSIM OFF)
# OSGeo4W provides an "ossim" package : use it otherwise if it is installed and not used by OTB
# we get conflicts (because OSGeo4W include dir is included for other dependencies
if(WIN32)
set(DEFAULT_USE_SYSTEM_OSSIM ON)
endif()
option(USE_SYSTEM_OSSIM " Use a system build of Ossim." ${DEFAULT_USE_SYSTEM_OSSIM})
mark_as_advanced(USE_SYSTEM_OSSIM)
if(USE_SYSTEM_OSSIM)
message(STATUS " Using OSSIM system version")
else()
# set project dependencies (GEOS, GDAL, TIFF, JPEG, OPENTHREADS, )
# TODO
# include dependencies if any
# TODO
set(OSSIM_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
set(OSSIM_SB_SRC ${CMAKE_BINARY_DIR}/${proj}/src/${proj})
ExternalProject_Add(${proj}
DEPENDS TIFF
PREFIX ${proj}
URL "http://download.osgeo.org/ossim/source/latest/ossim-1.8.18-1.tar.gz"
URL_MD5 c61e77f3fab08df0e486367eb4365c91
BINARY_DIR ${OSSIM_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CMAKE_CACHE_ARGS
-DOSSIM_DEV_HOME:STRING=${OSSIM_SB_SRC}
-DOSSIM_VERSION:STRING=1.8.18-1
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_CSMAPI:BOOL=OFF
-DBUILD_OSSIMCSM_PLUGIN:STRING=OFF
-DCMAKE_CXX_FLAGS:STRING=-D__STDC_CONSTANT_MACROS
-DWMS_INCLUDE_DIR:STRING=${OSSIM_SB_SRC}/libwms/include
-DGEOS_INCLUDE_DIR:STRING=/usr/include/geos
-DTIFF_INCLUDE_DIR:STRING=${CMAKE_INSTALL_PREFIX}/include
-DTIFF_LIBRARY:STRING=${CMAKE_INSTALL_PREFIX}/lib/libtiff.so
-DBUILD_OSSIMPREDATOR:BOOL=OFF
-DBUILD_OSSIMPLANET:BOOL=OFF
-DBUILD_OSSIMPLANETQT:BOOL=OFF
-DBUILD_OSSIM_MPI_SUPPORT:BOOL=OFF
-DBUILD_OSSIMQT4:BOOL=OFF
-DBUILD_OSSIMGUI:BOOL=OFF
-DBUILD_OMS:BOOL=OFF
-DCMAKE_MODULE_PATH:PATH=${OSSIM_SB_SRC}/ossim_package_support/cmake/CMakeModules
PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/ossim_patch_1.cmake
)
# Write patch file in binary dir
file(WRITE ${CMAKE_BINARY_DIR}/ossim_patch_1.cmake
"file(WRITE ${OSSIM_SB_SRC}/CMakeLists.txt \"add_subdirectory(ossim_package_support/cmake)\")")
message(STATUS " Using OSSIM SuperBuild version")
endif()
message(STATUS "Setup Proj.4 ...")
set(proj PROJ)
set(DEFAULT_USE_SYSTEM_PROJ OFF)
option(USE_SYSTEM_PROJ " Use a system build of Proj.4." ${DEFAULT_USE_SYSTEM_PROJ})
mark_as_advanced(USE_SYSTEM_PROJ)
if(USE_SYSTEM_PROJ)
message(STATUS " Using Proj4 system version")
else()
set(PROJ_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
set(PROJ_SB_SRC ${CMAKE_BINARY_DIR}/${proj}/src/${proj})
if(WIN32)
# TODO : use nmake
else()
ExternalProject_Add(${proj}
PREFIX ${proj}
URL "http://download.osgeo.org/proj/proj-4.8.0.tar.gz"
URL_MD5 d815838c92a29179298c126effbb1537
BINARY_DIR ${PROJ_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${PROJ_SB_BUILD_DIR}/configure
--prefix=${CMAKE_INSTALL_PREFIX}
--enable-static=no
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Add_Step(${proj} copy_source
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJ_SB_SRC} ${PROJ_SB_BUILD_DIR}
DEPENDEES patch update
DEPENDERS configure
)
endif()
endif()
\ No newline at end of file
message(STATUS "Setup Zlib ...")
set(proj ZLIB)
set(DEFAULT_USE_SYSTEM_ZLIB OFF)
option(USE_SYSTEM_ZLIB " Use a system build of Zlib." ${DEFAULT_USE_SYSTEM_ZLIB})
mark_as_advanced(USE_SYSTEM_ZLIB)
if(USE_SYSTEM_ZLIB)
message(STATUS " Using Zlib system version")
else()
set(ZLIB_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${proj}/build)
set(ZLIB_SB_SRC ${CMAKE_BINARY_DIR}/${proj}/src/${proj})
if(NOT DEFINED git_protocol)
set(git_protocol "git")
endif()
ExternalProject_Add(${proj}
PREFIX ${proj}
GIT_REPOSITORY "${git_protocol}://github.com/commontk/zlib.git"
GIT_TAG "66a753054b356da85e1838a081aa94287226823e"
BINARY_DIR ${ZLIB_SB_BUILD_DIR}
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CMAKE_CACHE_ARGS
## CXX should not be needed, but it a cmake default test
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
#-DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
-DZLIB_MANGLE_PREFIX:STRING=otb_zlib_
-DBUILD_SHARED_LIBS:BOOL=ON
)
endif()
cmake_minimum_required(VERSION 2.8.3)
project(OTB-SuperBuild)
# Path to additional CMake modules
set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMake
${CMAKE_MODULE_PATH})
include(ExternalProject)
# Call external projects
include(External_zlib)
include(External_libtiff)
include(External_proj4)
include(External_geotiff)
include(External_geos)
include(External_ITK)
include(External_ossim)
include(External_OpenJpeg)
include(External_GDAL)
# TODO
# Call OTB
include(External_OTB)
This diff is collapsed.
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