Newer
Older
# The entire OTB tree should use the same include path
# Create the list of include directories needed for OTB header files.
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}
)
#-----------------------------------------------------------------------------
# Dispatch the build into the proper subdirectories.
#Note: SUBDIRS is deprecated and is replaced by ADD_SUBDIRECTORY
#SUBDIRS(Utilities Code)
ADD_SUBDIRECTORY(Utilities)
ADD_SUBDIRECTORY(Code)
ENDIF (BUILD_EXAMPLES)
IF (BUILD_TESTING)
ENDIF (BUILD_TESTING)
#-----------------------------------------------------------------------------
OTB Bot
committed
# => Comment for OTB 2.6.0: simplification : copy ITK values
# OTB requires special compiler flags on some platforms.
OTB Bot
committed
SET(OTB_REQUIRED_C_FLAGS "${ITK_REQUIRED_C_FLAGS}")
SET(OTB_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS}")
SET(OTB_REQUIRED_LINK_FLAGS "${ITK_REQUIRED_LINK_FLAGS}")
IF(MINGW)
LINK_LIBRARIES(gdi32)
ENDIF(MINGW)
Cyrille Valladeau
committed
#-----------------------------------------------------------------------------
# Test for an Objective-C++ compiler.
SET(OTB_OBJCXX_COMPILER_WORKS 0)
IF(APPLE)
TRY_COMPILE(OTB_OBJCXX_COMPILER_WORKS
${OTB_BINARY_DIR}/CMakeTmp
${OTB_SOURCE_DIR}/CMake/otbTestObjCxxCompiler.mm
OUTPUT_VARIABLE OTB_OBJCXX_TRY_COMPILE_OUTPUT)
IF( OTB_OBJCXX_COMPILER_WORKS )
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the Objective-C compiler works passed with "
"the following output:\n${OTB_OBJCXX_TRY_COMPILE_OUTPUT}\n\n")
ELSE( OTB_OBJCXX_COMPILER_WORKS )
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the Objective-C compiler works failed with "
"the following output:\n${OTB_OBJCXX_TRY_COMPILE_OUTPUT}\n\n")
ENDIF( OTB_OBJCXX_COMPILER_WORKS )
ENDIF(APPLE)
INCLUDE(CheckTypeSize)
CHECK_TYPE_SIZE("long long" OTB_SIZEOF_LONG_LONG)
CHECK_TYPE_SIZE("__int64" OTB_SIZEOF___INT64)
CHECK_TYPE_SIZE("long int" OTB_SIZEOF_LONG_INT)
CHECK_TYPE_SIZE("short int" OTB_SIZEOF_SHORT_INT)
#-----------------------------------------------------------------------------
# Configure the default OTB_DATA_ROOT for the location of OTB Data.
FIND_PATH(OTB_DATA_ROOT README-OTB-Data PATHS $ENV{OTB_DATA_ROOT} ${OTB_SOURCE_DIR}/../OTB-Data)
OPTION(OTB_DATA_USE_LARGEINPUT "Use Large inputs images test." OFF)
MARK_AS_ADVANCED(OTB_DATA_USE_LARGEINPUT)
IF(OTB_DATA_USE_LARGEINPUT)
FIND_PATH(OTB_DATA_LARGEINPUT_ROOT OTBData.readme $ENV{OTB_DATA_LARGEINPUT_ROOT})
MARK_AS_ADVANCED(OTB_DATA_LARGEINPUT_ROOT)
ENDIF(OTB_DATA_USE_LARGEINPUT)
#-----------------------------------------------------------------------------
# Configure files with settings for use by the build.
CONFIGURE_FILE(${OTB_SOURCE_DIR}/otbConfigure.h.in
${OTB_BINARY_DIR}/otbConfigure.h)
#-----------------------------------------------------------------------------
# The entire OTB tree should use the same include path
# Create the list of include directories needed for OTB header files.
#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
${OTB_SOURCE_DIR}/CMake/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)
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
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)
IF(WIN32 AND NOT UNIX AND NOT CYGWIN)
#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" )
ENDIF(WIN32 AND NOT UNIX AND NOT CYGWIN)
INCLUDE(CPack)
Emmanuel Christophe
committed
Thomas Feuvrier
committed
ENDIF(OTB_USE_CPACK)
FILE(GLOB otbconfigfileCreation_SRCS "${OTB_SOURCE_DIR}/CMake/GenerateConfigProperties.cpp")
SET(otbconfigfile_DEFAULT "${OTB_BINARY_DIR}/otb.conf")
ADD_EXECUTABLE(GenerateConfigProperties ${otbconfigfileCreation_SRCS})
ADD_CUSTOM_COMMAND(
TARGET GenerateConfigProperties
POST_BUILD
COMMAND GenerateConfigProperties
ARGS "${otbconfigfile_DEFAULT}" "${OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING}" "${OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING}"
COMMENT "Generating ${otbconfigfile_DEFAULT}" )