Newer
Older
INCLUDE(${OTB_SOURCE_DIR}/otbIncludeDirectories.cmake)
# This should be the only INCLUDE_DIRECTORIES command in the entire
# tree, except for the Utilities and Wrapping directories. We need to
# do this in one place to make sure the order is correct.
INCLUDE_DIRECTORIES(
${OTB_INCLUDE_DIRS_BUILD_TREE}
${OTB_INCLUDE_DIRS_BUILD_TREE_CXX}
${OTB_INCLUDE_DIRS_SYSTEM}
)
#-----------------------------------------------------------------------------
# Uninstall cmake use to uninstall OTB.
Thomas Feuvrier
committed
# CONFIGURE_FILE(
# "${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in"
# "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
# IMMEDIATE @ONLY)
Thomas Feuvrier
committed
# ADD_CUSTOM_TARGET(uninstall
# "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
#-----------------------------------------------------------------------------
# Help other projects use OTB.
# Copy the UseOTB.cmake file to the binary tree for backward compatability.
CONFIGURE_FILE(${OTB_SOURCE_DIR}/UseOTB.cmake.in
${OTB_BINARY_DIR}/UseOTB.cmake COPYONLY IMMEDIATE)
Thomas Feuvrier
committed
# Save the compiler settings so another project can import them.
INCLUDE(${CMAKE_ROOT}/Modules/CMakeExportBuildSettings.cmake)
CMAKE_EXPORT_BUILD_SETTINGS(${OTB_BINARY_DIR}/OTBBuildSettings.cmake)
Thomas Feuvrier
committed
#INSTALL_FILES(/lib/otb .cmake OTBBuildSettings)
IF(NOT OTB_INSTALL_NO_DEVELOPMENT)
INSTALL(FILES
${OTB_BINARY_DIR}/OTBBuildSettings.cmake
${OTB_BINARY_DIR}/OTBLibraryDepends.cmake
${OTB_BINARY_DIR}/UseOTB.cmake
Thomas Feuvrier
committed
${OTB_SOURCE_DIR}/FindOpenThreads.cmake
Thomas Feuvrier
committed
DESTINATION ${OTB_INSTALL_PACKAGE_DIR_CM24}
COMPONENT Development
)
ENDIF(NOT OTB_INSTALL_NO_DEVELOPMENT)
# Save library dependencies.
EXPORT_LIBRARY_DEPENDENCIES(${OTB_BINARY_DIR}/OTBLibraryDepends.cmake)
# Create the OTBConfig.cmake file containing the OTB configuration.
INCLUDE (${OTB_SOURCE_DIR}/otbGenerateOTBConfig.cmake)
Thomas Feuvrier
committed
IF(NOT OTB_INSTALL_NO_DEVELOPMENT)
INSTALL(FILES ${OTB_BINARY_DIR}/otbConfigure.h
DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}
COMPONENT Development)
ENDIF(NOT OTB_INSTALL_NO_DEVELOPMENT)
#INSTALL_FILES(/include/otb .h otbConfigure)
#INSTALL_FILES(/lib/otb .cmake UseOTB OTBLibraryDepends OTBConfig )
#-----------------------------------------------------------------------------
# Add compiler flags OTB needs to work on this platform. This must be
# done AFTER the call to CMAKE_EXPORT_BUILD_SETTINGS.
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OTB_REQUIRED_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OTB_REQUIRED_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}")
#-----------------------------------------------------------------------------
# Set up CPack support, to be able to distribute OTB binary packages. It will
# be particulary useful to distributed prebuilt OTB.
#
Thomas Feuvrier
committed
OPTION(OTB_USE_CPACK "Generate installer using CPack" OFF)
MARK_AS_ADVANCED(OTB_USE_CPACK)
Thomas Feuvrier
committed
IF(OTB_USE_CPACK)
Thomas Feuvrier
committed
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_NAME "OTB" CACHE STRING "Package name")
MARK_AS_ADVANCED(CPACK_PACKAGE_NAME)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Orfeo Toolbox")
MARK_AS_ADVANCED(CPACK_PACKAGE_DESCRIPTION_SUMMARY)
SET(CPACK_PACKAGE_VERSION "${OTB_VERSION_STRING}")
SET(CPACK_PACKAGE_VERSION_MAJOR "${OTB_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${OTB_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${OTB_VERSION_PATCH}")
SET(CPACK_PACKAGE_CONTACT "contact@orfeo-toolbox.org" CACHE STRING "Orfeo toolbox contact email")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Description.txt")
#Debian specific
SET(DEBIAN_PACKAGE_MAINTAINER "debian@orfeo-toolbox.org" CACHE STRING "Debian package maintainer email")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libgdal1-1.5.0 (>= 1.5.1-0), libfltk1.1 (>= 1.1.7-3), libcurl3 (>=7.15.5-1etch1), libfftw3-3 (>=3.1.2-3.1)" CACHE STRING "Debian package dependance" )
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64" CACHE STRING "arch")
MARK_AS_ADVANCED(CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
SET(CPACK_DEBIAN_PACKAGE_NAME "libotb" CACHE STRING "Debian package name")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "OrfeoToolbox-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright/OTBCopyright.txt")
FILE(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION)
FILE(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_DEBIAN_PACKAGE_DESCRIPTION)
Thomas Feuvrier
committed
IF(WIN32 AND NOT UNIX AND NOT CYGWIN)
Thomas Feuvrier
committed
#Find gdal dll files, localized in the GDAL_LIBRARY directory
GET_FILENAME_COMPONENT(GDAL_LIB_DIR "${GDAL_LIBRARY}" PATH )
SET(GDAL_LIB_DIR "${GDAL_LIB_DIR}/" )
INSTALL(DIRECTORY ${GDAL_LIB_DIR}
DESTINATION bin
FILES_MATCHING PATTERN "*.dll" )
INSTALL(DIRECTORY ${GDAL_LIB_DIR}
DESTINATION lib
FILES_MATCHING PATTERN "*.lib" )
Thomas Feuvrier
committed
ENDIF(WIN32 AND NOT UNIX AND NOT CYGWIN)
Thomas Feuvrier
committed
Emmanuel Christophe
committed
INCLUDE(CPack)
Thomas Feuvrier
committed
ENDIF(OTB_USE_CPACK)
Emmanuel Christophe
committed
FILE(GLOB otbconfigfileCreation_SRCS "${OTB_SOURCE_DIR}/CMake/GenerateConfigProperties.cpp")
SET(otbconfigfile_DEFAULT "${OTB_BINARY_DIR}/otb.conf")
Emmanuel Christophe
committed
ADD_EXECUTABLE(GenerateConfigProperties ${otbconfigfileCreation_SRCS})
ADD_CUSTOM_COMMAND(
Emmanuel Christophe
committed
TARGET GenerateConfigProperties
POST_BUILD
Emmanuel Christophe
committed
COMMAND GenerateConfigProperties
ARGS "${otbconfigfile_DEFAULT}" "${OTB_LANG}" "${OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING}" "${OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING}"
Emmanuel Christophe
committed
COMMENT "Generating ${otbconfigfile_DEFAULT}" )