Commit 35c3ecaf authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

Merge remote-tracking branch 'origin/release-5.4' into develop

parents a2fe3f09 85a3f83d
......@@ -542,11 +542,11 @@ GlView
Spacing & spacing ) const
{
// std::cout
// << std::hex << this
// << std::hex << this << std::dec
// << "::ZoomToRegion( "
// << "[ " << origin[ 0 ] << ", " << origin[ 1 ] << "], "
// << "[ " << extent[ 0 ] << ", " << extent[ 1 ] << "], "
// << "[ " << spacing[ 0 ] << ", " << spacing[ 1 ] << "] )"
// << "[ " << native[ 0 ] << ", " << native[ 1 ] << "] )"
// << std::endl;
// Compute center point.
......@@ -588,7 +588,7 @@ GlView
spacing[ 0 ] = ( native[ 0 ]<0.0 ? -1 : +1 ) * scale;
spacing[ 1 ] = ( native[ 1 ]<0.0 ? -1 : +1 ) * scale;
// std::cout << "-> spacing: " << center[ 0 ] << ", " << center[ 1 ] << std::endl;
// std::cout << "-> spacing: " << spacing[ 0 ] << ", " << spacing[ 1 ] << std::endl;
// Ok.
return true;
......@@ -603,6 +603,11 @@ GlView
Spacing & spacing,
double units ) const
{
// std::cout
// << std::hex << this << std::dec
// << "::ZoomToFull();"
// << std::endl;
// Get layer actor.
GlActor::Pointer actor( GetActor( key ) );
......@@ -623,9 +628,12 @@ GlView
center = m_Settings->GetViewportCenter();
spacing = m_Settings->GetSpacing();
// std::cout << "-> spacing: " << spacing[ 0 ] << ", " << spacing[ 1 ] << std::endl;
// Get native spacing.
GeoInterface::Spacing2 n_spacing( geo->GetSpacing() );
// std::cout << "-> n_spacing: " << n_spacing[ 0 ] << ", " << n_spacing[ 1 ] << std::endl;
// Transform center point to image space.
Point o;
......@@ -652,8 +660,11 @@ GlView
//
// MANTIS-1178: Lenght of vector e must be divided by native
// spacing.
//
// MANTIS-1203: absolute value of native spacing should be
// considered (to avoid flipping effects).
spacing[ 0 ] =
n_spacing[ 0 ] * units * spacing[ 0 ] /
vcl_abs( n_spacing[ 0 ] ) * units * spacing[ 0 ] /
vcl_sqrt( e[ 0 ] * e[ 0 ] + e[ 1 ] * e[ 1 ] );
//
......@@ -673,10 +684,30 @@ GlView
//
// MANTIS-1178: Lenght of vector e must be divided by native
// spacing.
//
// MANTIS-1203: absolute value of native spacing should be
// considered (to avoid flipping effects).
spacing[ 1 ] =
n_spacing[ 1 ] * units * spacing[ 1 ] /
vcl_abs( n_spacing[ 1 ] ) * units * spacing[ 1 ] /
vcl_sqrt( e[ 0 ] * e[ 0 ] + e[ 1 ] * e[ 1 ] );
// std::cout << "-> spacing: " << spacing[ 0 ] << ", " << spacing[ 1 ] << std::endl;
//
// Compute aspect-ratio corrected spacing (smallest pixel is chosen
// as 1:1 reference).
//
// MANTIS-1202
// {
if( vcl_abs( spacing[ 0 ] ) < vcl_abs( spacing[ 1 ] ) )
spacing[ 1 ] = spacing[ 0 ];
else
spacing[ 0 ] = spacing[ 1 ];
// }
// MANTIS-1202
// std::cout << "-> spacing: " << spacing[ 0 ] << ", " << spacing[ 1 ] << std::endl;
//
// Ok.
return true;
......
......@@ -22,7 +22,7 @@ else()
CMAKE_COMMAND ${SB_CMAKE_COMMAND}
)
set(_SB_FREETYPE_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include)
set(_SB_FREETYPE_INCLUDE_DIRS ${SB_INSTALL_PREFIX}/include/freetype2)
if(WIN32)
set(_SB_FREETYPE_LIBRARY ${SB_INSTALL_PREFIX}/lib/freetype.lib)
elseif(UNIX)
......
......@@ -146,7 +146,7 @@ else()
ExternalProject_Add(ITK
PREFIX ITK
URL "http://sourceforge.net/projects/itk/files/itk/${ITK_SB_VERSION}/InsightToolkit-${ITK_SB_VERSION_FULL}.tar.gz/download"
URL "http://sourceforge.net/projects/itk/files/itk/4.8/InsightToolkit-4.8.1.tar.gz/download"
URL_MD5 b1ed53604de854501cb61f34f410420e
SOURCE_DIR ${ITK_SB_SRC}
BINARY_DIR ${ITK_SB_BUILD_DIR}
......
......@@ -27,7 +27,7 @@ else()
ADD_SUPERBUILD_CMAKE_VAR(OSSIM JPEG_LIBRARY)
ADD_SUPERBUILD_CMAKE_VAR(OSSIM OPENTHREADS_INCLUDE_DIR)
ADD_SUPERBUILD_CMAKE_VAR(OSSIM OPENTHREADS_LIBRARY)
ADD_SUPERBUILD_CMAKE_VAR(OSSIM FREETYPE_INCLUDE_DIR)
ADD_SUPERBUILD_CMAKE_VAR(OSSIM FREETYPE_INCLUDE_DIRS)
ADD_SUPERBUILD_CMAKE_VAR(OSSIM FREETYPE_LIBRARY)
set(OSSIM_CXX_FLAGS -D__STDC_CONSTANT_MACROS)
......
......@@ -22,6 +22,10 @@ endif()
set(PACKAGE_NAME OTB)
set(PACKAGE_LONG_NAME OrfeoToolBox)
if(ENABLE_MONTEVERDI)
set(PACKAGE_OTB_configure_EXTRA_DEPENDS MVD)
endif()
if(UNIX)
if(APPLE)
set(PACKAGE_PLATFORM_NAME "Darwin")
......@@ -64,7 +68,8 @@ file(WRITE "${CMAKE_BINARY_DIR}/PACKAGE-OTB/src/PACKAGE-OTB/CMakeLists.txt"
COMMAND ${CMAKE_COMMAND}
"${CMAKE_BINARY_DIR}/PACKAGE-OTB/src/PACKAGE-OTB"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/PACKAGE-OTB/build"
DEPENDS PACKAGE_TOOLS)
DEPENDS PACKAGE_TOOLS OTB
${PACKAGE_OTB_configure_EXTRA_DEPENDS})
add_custom_target(PACKAGE-OTB-build
COMMAND ${CMAKE_COMMAND}
......
......@@ -2,37 +2,11 @@ include(ExternalProject)
if(NOT __EXTERNAL_PACKAGE_TOOLS__)
set(__EXTERNAL_PACKAGE_TOOLS__ 1)
set(PKGTOOLS_SB_PREFIX_DIR "${CMAKE_BINARY_DIR}/PACKAGE-OTB/PACKAGE_TOOLS")
set(PKGTOOLS_SB_PREFIX_DIR "${CMAKE_BINARY_DIR}/TOOLS-PACKAGE")
ExternalProject_Add(MAKESELF
PREFIX "${PKGTOOLS_SB_PREFIX_DIR}"
URL "https://www.orfeo-toolbox.org/packages/makeself-2.2.0.tar.gz"
URL_MD5 3c61df934b0c61ddcd7bd63b391e951d
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
SOURCE_DIR "${PKGTOOLS_SB_PREFIX_DIR}/src-makeself"
BINARY_DIR "${PKGTOOLS_SB_PREFIX_DIR}/build-makeself"
TMP_DIR "${PKGTOOLS_SB_PREFIX_DIR}/tmp-makeself"
STAMP_DIR "${PKGTOOLS_SB_PREFIX_DIR}/stamp-makeself"
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND}
-E copy
${PKGTOOLS_SB_PREFIX_DIR}/src-makeself/makeself-header.sh
${CMAKE_BINARY_DIR}/PACKAGE-OTB/build/makeself-header.sh
INSTALL_COMMAND ${CMAKE_COMMAND}
-E copy
${PKGTOOLS_SB_PREFIX_DIR}/src-makeself/makeself.sh
${CMAKE_BINARY_DIR}/PACKAGE-OTB/build/makeself.sh
)
if(UNIX)
if(APPLE)
ExternalProject_Add( PATCHELF
PREFIX "${PKGTOOLS_SB_PREFIX_DIR}"
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
add_custom_target(PATCHELF)
else()
ExternalProject_Add(PATCHELF
PREFIX "${PKGTOOLS_SB_PREFIX_DIR}"
......@@ -52,12 +26,29 @@ if(UNIX)
endif(APPLE)
endif(UNIX)
ExternalProject_Add( PACKAGE_TOOLS
PREFIX "${PKGTOOLS_SB_PREFIX_DIR}"
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
DEPENDS MAKESELF PATCHELF)
ExternalProject_Add(MAKESELF
PREFIX "${PKGTOOLS_SB_PREFIX_DIR}"
URL "https://www.orfeo-toolbox.org/packages/makeself-2.2.0.tar.gz"
URL_MD5 3c61df934b0c61ddcd7bd63b391e951d
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
SOURCE_DIR "${PKGTOOLS_SB_PREFIX_DIR}/src-makeself"
BINARY_DIR "${PKGTOOLS_SB_PREFIX_DIR}/build-makeself"
TMP_DIR "${PKGTOOLS_SB_PREFIX_DIR}/tmp-makeself"
STAMP_DIR "${PKGTOOLS_SB_PREFIX_DIR}/stamp-makeself"
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND}
-E copy
${PKGTOOLS_SB_PREFIX_DIR}/src-makeself/makeself-header.sh
${PKGTOOLS_SB_PREFIX_DIR}/makeself-header.sh
INSTALL_COMMAND ${CMAKE_COMMAND}
-E copy
${PKGTOOLS_SB_PREFIX_DIR}/src-makeself/makeself.sh
${PKGTOOLS_SB_PREFIX_DIR}/makeself.sh
DEPENDS PATCHELF
)
set(MAKESELF_SCRIPT ${PKGTOOLS_SB_PREFIX_DIR}/makeself.sh)
add_custom_target(PACKAGE-TOOLS DEPENDS MAKESELF)
endif()
......@@ -15,6 +15,8 @@ if(NOT __EXTERNAL_QT4__)
set(git_protocol "git")
endif()
#NOTE: make sure your superbuild install directory does not contain any
#Qt files from previous install of superbuild QT.
# declare dependencies
ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QT4 ZLIB TIFF PNG SQLITE FREETYPE)
......@@ -29,8 +31,8 @@ if(NOT __EXTERNAL_QT4__)
set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-openssl")
if(APPLE)
set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-framework")
else()
set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -gtkstyle")
else() #Linux
set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-sm -no-xrender -no-fontconfig -no-gtkstyle -no-glib")
endif()
endif()
STRING(REGEX REPLACE "/$" "" CMAKE_WIN_INSTALL_PREFIX ${SB_INSTALL_PREFIX})
......@@ -84,6 +86,7 @@ if(NOT __EXTERNAL_QT4__)
${CMAKE_BINARY_DIR}/configure_qt4.sh
DEPENDS ${QT4_DEPENDENCIES}
)
endif()
if(APPLE)
......
......@@ -36,15 +36,18 @@ file(WRITE "${CMAKE_BINARY_DIR}/GENERATE-XDK/src/GENERATE-XDK/CMakeLists.txt"
include(CMakeParseArguments)
set(CMAKE_INSTALL_PREFIX \"${SB_INSTALL_PREFIX}\")
set(DOWNLOAD_LOCATION \"${DOWNLOAD_LOCATION}\")
set(SETUP_SCRIPT_SRC ${CMAKE_SOURCE_DIR}/CMake/pkgsetup.in)
set(WITH_OTBGUI OFF)
set(MAKE_XDK ON)
include(${CMAKE_SOURCE_DIR}/CMake/External_pkgtools.cmake)
include(${CMAKE_SOURCE_DIR}/CMake/Package_Macro.cmake)
set(PACKAGE_SUPPORT_FILES_DIR \"${CMAKE_SOURCE_DIR}/Packaging\")
set(Monteverdi_SOURCE_DIR \"${CMAKE_BINARY_DIR}/MVD/src/MVD\")
set(Monteverdi_BINARY_DIR \"${CMAKE_BINARY_DIR}/MVD/build\")
set(OTB_INSTALL_DIR \"${CMAKE_BINARY_DIR}/OTB/build\")
set(QT_PLUGINS_DIR \"${SB_INSTALL_PREFIX}/plugins\")
set(QT_TRANSLATIONS_DIR \"${QT_TRANSLATIONS_DIR}\")
set(ITK_VERSION_STRING \"${ITK_SB_VERSION}\")
set(CREATING_XDK ON)
include(\"${CMAKE_SOURCE_DIR}/CMake/Package_Macro.cmake\")
include(\"${CMAKE_SOURCE_DIR}/CMake/PackageHelper.cmake\")
superbuild_package(
OUTDIR \"${ARCHIVE_NAME}\"
INSTALLDIR \"${SB_INSTALL_PREFIX}\"
PEFILES \"${PEFILES}\"
STAGE_DIR \"${ARCHIVE_NAME}\"
SEARCHDIRS \"\")")
add_custom_target(GENERATE-XDK-configure
......
macro(super_package)
cmake_parse_arguments(PKG "" "STAGE_DIR" "SEARCHDIRS" ${ARGN} )
set(loader_program_PATHS)
if(WIN32 OR CMAKE_CROSSCOMPILING)
set(loader_program_names "${MXE_ARCH}-w64-mingw32.shared-objdump")
set(loader_program_PATHS "${MXE_MXEROOT}/usr/bin")
set(LOADER_PROGRAM_ARGS "-p")
#guess install directory from OTB_MODULES_DIR
set(OTB_INSTALL_DIR ${OTB_MODULES_DIR}/../../../..)
set(DEPENDENCIES_INSTALL_DIR "${MXE_MXEROOT}/usr/${MXE_ARCH}-w64-mingw32.shared")
else()
if(APPLE)
set(loader_program_names otool)
set(LOADER_PROGRAM_ARGS "-l")
set(loader_program_PATHS /opt/local/bin) # a path that is already listed i path on apple
else()
set(loader_program_names objdump)
set(LOADER_PROGRAM_ARGS "-p")
set(loader_program_PATHS /usr/bin) # a path that is already listed in default path on Linux
endif()
#both OTB_INSTALL_DIR DEPENDENCIES_INSTALL_DIR are same for superbuild
set(OTB_INSTALL_DIR ${PKG_INSTALL_PREFIX})
set(DEPENDENCIES_INSTALL_DIR ${PKG_INSTALL_PREFIX})
endif()
find_program(LOADER_PROGRAM "${loader_program_names}" PATHS ${loader_program_PATHS})
if(NOT EXISTS ${LOADER_PROGRAM})
message(FATAL_ERROR "${loader_program_names} not found in ${loader_program_PATHS}. please check LOADER_PROGRAM variable is set correctly")
endif()
include(GetPrerequisites)
set(PKG_SEARCHDIRS)
if(WIN32 OR CMAKE_CROSSCOMPILING)
set(MXE_BIN_DIR "${DEPENDENCIES_INSTALL_DIR}/bin")
list(APPEND PKG_SEARCHDIRS ${MXE_BIN_DIR})
file(GLOB MXE_GCC_LIB_DIR "${MXE_BIN_DIR}/gcc*")
list(APPEND PKG_SEARCHDIRS ${MXE_GCC_LIB_DIR})
list(APPEND PKG_SEARCHDIRS "${MXE_BIN_DIR}/../qt/bin") #Qt
list(APPEND PKG_SEARCHDIRS "${MXE_BIN_DIR}/../qt/lib") #Qwt
list(APPEND PKG_SEARCHDIRS "${CMAKE_INSTALL_PREFIX}/bin") #mvd
list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/bin") #otbApplicationLauncher*.exe
else() #unixes
list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/bin") #exe
list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/lib") #so
list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/lib/otb") #mvd so
endif()
#common for all platforms.
set(OTB_APPLICATIONS_DIR "${OTB_INSTALL_DIR}/lib/otb/applications")
list(APPEND PKG_SEARCHDIRS "${OTB_APPLICATIONS_DIR}") #otb apps
empty_package_staging_directory()
set(PKG_PEFILES)
if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
file(WRITE ${CMAKE_BINARY_DIR}/make_symlinks "#!/bin/sh\n")
#NOTE: VAR_IN_PKGSETUP_CONFIGURE is copied to linux_pkgsetup.in during configure_file
set(VAR_IN_PKGSETUP_CONFIGURE)
set(PKG_SO_FILES)
endif() # if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
configure_package()
if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
############# install client configure script ################
set(PKGSETUP_IN_FILENAME linux_pkgsetup.in)
if(APPLE)
set(PKGSETUP_IN_FILENAME macx_pkgsetup.in)
endif()
configure_file(${PACKAGE_SUPPORT_FILES_DIR}/${PKGSETUP_IN_FILENAME}
${CMAKE_BINARY_DIR}/pkgsetup @ONLY)
install(FILES
${CMAKE_BINARY_DIR}/pkgsetup
${CMAKE_BINARY_DIR}/make_symlinks
DESTINATION ${PKG_STAGE_DIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
if(UNIX)
if(NOT APPLE)
####################### install patchelf #####################
install(FILES ${PKG_INSTALL_PREFIX}/tools/patchelf
DESTINATION ${PKG_STAGE_DIR}/tools
PERMISSIONS
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ)
endif()
endif()
endif() # if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
if(PKG_GENERATE_XDK)
install_xdk_files()
endif()
endmacro(super_package)
function(install_xdk_files)
install(DIRECTORY ${DEPENDENCIES_INSTALL_DIR}/share
DESTINATION ${PKG_STAGE_DIR})
install(DIRECTORY ${DEPENDENCIES_INSTALL_DIR}/include
DESTINATION ${PKG_STAGE_DIR}
PATTERN "include/OTB*" EXCLUDE )
install(DIRECTORY ${DEPENDENCIES_INSTALL_DIR}/lib/cmake
DESTINATION ${PKG_STAGE_DIR}/lib/
PATTERN "lib/cmake/OTB*" EXCLUDE)
endfunction()
set(WINDOWS_SYSTEM_DLLS
msvc.*dll
user32.dll
gdi32.dll
shell32.dll
kernel32.dll
advapi32.dll
crypt32.dll
ws2_32.dll
wldap32.dll
ole32.dll
opengl32.dll
glu32.dll
comdlg32.dll
imm32.dll
oleaut32.dll
comctl32.dll
winmm.dll
shfolder.dll
secur32.dll
wsock32.dll
advapi32.dll
crypt32.dll
imm32.dll
oleaut32.dll
winmm.dll
opengl32.dll
glu32.dll
winspool.drv)
set(LINUX_SYSTEM_DLLS
......@@ -61,17 +174,15 @@ set(APPLE_SYSTEM_DLLS
libgcc_s.*dylib
)
if(UNIX)
if(WIN32 OR CMAKE_CROSSCOMPILING)
set(SYSTEM_DLLS "${WINDOWS_SYSTEM_DLLS}")
else() #case for unixes
if(APPLE)
set(SYSTEM_DLLS "${APPLE_SYSTEM_DLLS}")
else()
set(SYSTEM_DLLS "${LINUX_SYSTEM_DLLS}")
endif()
else(UNIX)
if(WIN32 OR CMAKE_CROSSCOMPILING)
set(SYSTEM_DLLS "${WINDOWS_SYSTEM_DLLS}")
endif()
endif()
endif(WIN32 OR CMAKE_CROSSCOMPILING)
macro(is_system_dll matched value)
set(${matched})
......@@ -136,7 +247,6 @@ function(install_common include_mvd)
OTB_APPLICATIONS_DIR
PKG_STAGE_DIR
PACKAGE_SUPPORT_FILES_DIR
CMAKE_INSTALL_PREFIX
OTB_INSTALL_DIR
)
if(NOT DEFINED ${req})
......@@ -148,23 +258,20 @@ function(install_common include_mvd)
# one for debugging..
# install(CODE "message(\"CMake/PackageHelper.cmake:install_common(${outdir})\n${vars}\n\")")
set(PKG_OTB_SHARE_SOURCE_DIR "${PKG_SHARE_SOURCE_DIR}")
#For Unixes we make them in the *pkgsetup.in
##################### install environment source ##########################
if(WIN32 OR CMAKE_CROSSCOMPILING)
set(ENV_SOURCE_FILES
"${PACKAGE_SUPPORT_FILES_DIR}/otbenv.cmd"
"${PACKAGE_SUPPORT_FILES_DIR}/otbenv.profile"
)
elseif(UNIX)
set(ENV_SOURCE_FILES "${PACKAGE_SUPPORT_FILES_DIR}/otbenv.profile")
foreach(ENV_SOURCE_FILE
"${PACKAGE_SUPPORT_FILES_DIR}/otbenv.cmd"
"${PACKAGE_SUPPORT_FILES_DIR}/otbenv.profile")
if(EXISTS ${ENV_SOURCE_FILE})
install(FILES ${ENV_SOURCE_FILE} DESTINATION ${PKG_STAGE_DIR})
endif()
endforeach()
set(PKG_OTB_SHARE_SOURCE_DIR "${PKG_INSTALL_PREFIX}/share")
endif()
foreach(ENV_SOURCE_FILE ${ENV_SOURCE_FILES})
if(EXISTS ${ENV_SOURCE_FILE})
install(FILES ${ENV_SOURCE_FILE} DESTINATION ${PKG_STAGE_DIR})
endif()
endforeach()
####################### install cli and gui scripts ###########################
file(GLOB PKG_APP_SCRIPTS
${OTB_INSTALL_DIR}/bin/otbcli*
......@@ -180,6 +287,9 @@ function(install_common include_mvd)
if(include_mvd)
install_monteverdi_files()
if(NOT EXISTS "${PKG_OTB_SHARE_SOURCE_DIR}/otb/i18n")
message(FATAL_ERROR "error ${PKG_OTB_SHARE_SOURCE_DIR}/otb not exists")
endif()
endif()
####################### install GDAL data ############################
......@@ -190,26 +300,30 @@ function(install_common include_mvd)
install(DIRECTORY ${GDAL_DATA} DESTINATION ${PKG_SHARE_DEST_DIR})
####################### install GeoTIFF data ###########################
####################### install GeoTIFF data ########################
install(DIRECTORY ${PKG_SHARE_SOURCE_DIR}/epsg_csv DESTINATION ${PKG_SHARE_DEST_DIR})
####################### install OSSIM data ###########################
####################### install OSSIM data ##########################
install(DIRECTORY ${PKG_SHARE_SOURCE_DIR}/ossim DESTINATION ${PKG_SHARE_DEST_DIR})
####################### install otb share ###########################
install(DIRECTORY ${PKG_SHARE_SOURCE_DIR}/otb DESTINATION ${PKG_SHARE_DEST_DIR})
install(DIRECTORY ${PKG_OTB_SHARE_SOURCE_DIR}/otb DESTINATION ${PKG_SHARE_DEST_DIR})
####################### install proj share ###########################
####################### install proj share ##########################
if(EXISTS ${PKG_SHARE_SOURCE_DIR}/proj)
install(DIRECTORY ${PKG_SHARE_SOURCE_DIR}/proj DESTINATION ${PKG_SHARE_DEST_DIR})
endif()
####################### Install otb applications ######################
####################### Install otb applications ####################
install(DIRECTORY "${OTB_APPLICATIONS_DIR}" DESTINATION ${PKG_OTBLIBS_DIR})
####################### Install copyrights ######################
install(DIRECTORY ${PKG_SHARE_SOURCE_DIR}/copyright DESTINATION ${PKG_SHARE_DEST_DIR})
install(FILES ${PKG_SHARE_SOURCE_DIR}/copyright/LICENSE DESTINATION ${PKG_STAGE_DIR})
####################### Install copyrights ##########################
if(WIN32 OR CMAKE_CROSSCOMPILING)
#do install license for windows package
else()
install(DIRECTORY ${PKG_SHARE_SOURCE_DIR}/copyright DESTINATION ${PKG_SHARE_DEST_DIR})
install(FILES ${PKG_SHARE_SOURCE_DIR}/copyright/LICENSE DESTINATION ${PKG_STAGE_DIR})
endif()
endfunction()
......@@ -288,8 +402,8 @@ function(install_monteverdi_files)
endfunction()
macro(empty_package_staging_directory)
message(STATUS "Empty package staging directory: ${CMAKE_INSTALL_PREFIX}/${PKG_STAGE_DIR}")
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_INSTALL_PREFIX}/${PKG_STAGE_DIR}")
message(STATUS "Empty package staging directory: ${PKG_INSTALL_PREFIX}/${PKG_STAGE_DIR}")
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${PKG_INSTALL_PREFIX}/${PKG_STAGE_DIR}")
endmacro()
#NOTE:
......@@ -334,7 +448,7 @@ function(configure_package)
foreach(EXE_FILE monteverdi
mapla)
if(EXISTS "${CMAKE_INSTALL_PREFIX}/bin/${EXE_FILE}${EXE_EXT}")
if(EXISTS "${OTB_INSTALL_DIR}/bin/${EXE_FILE}${EXE_EXT}")
#VAR_IN_PKGSETUP_CONFIGURE might seem a bit redundant variable if you
#consider PKG_PEFILES which also has same content.
#But VAR_IN_PKGSETUP_CONFIGURE goes into pkgsetup.in for Linux standalone binaries
......@@ -342,9 +456,10 @@ function(configure_package)
# process_deps() function
set(VAR_IN_PKGSETUP_CONFIGURE "${VAR_IN_PKGSETUP_CONFIGURE} bin/${EXE_FILE}${EXE_EXT}")
list(APPEND PKG_PEFILES
"${CMAKE_INSTALL_PREFIX}/bin/${EXE_FILE}${EXE_EXT}")
"${OTB_INSTALL_DIR}/bin/${EXE_FILE}${EXE_EXT}")
endif()
if(NOT UNIX)
#For Unixes we write the startup script in the *pkgsetup.in
if(WIN32 OR CMAKE_CROSSCOMPILING)
if(DEFINED Monteverdi_SOURCE_DIR)
if(EXISTS ${Monteverdi_SOURCE_DIR}/Packaging/${EXE_FILE}${SCR_EXT})
install(PROGRAMS
......@@ -353,7 +468,7 @@ function(configure_package)
"${PKG_STAGE_DIR}")
endif()
endif()
endif(NOT UNIX)
endif(WIN32 OR CMAKE_CROSSCOMPILING)
endforeach()
file(GLOB OTB_APPS_LIST ${OTB_APPLICATIONS_DIR}/otbapp_${LIB_EXT}) # /lib/otb
......@@ -386,7 +501,7 @@ function(configure_package)
list(LENGTH notfound_dlls nos)
if(${nos} GREATER 0)
list(REMOVE_DUPLICATES notfound_dlls)
#string(REPLACE ".so;" ".so\\r\\n" notfound_dlls ${notfound_dlls})
#string(REPLACE ";" "\r" notfound_dlls ${notfound_dlls})
message(FATAL_ERROR "Following dlls were not found: ${notfound_dlls}. Please consider adding their paths to PKG_SEARCHDIRS when calling superbuild_package macro.")
endif()
......@@ -494,3 +609,129 @@ function(is_file_a_symbolic_link file result_var1 result_var2)
endif()
endif()
endfunction()
function(process_deps infile)
if(APPLE)
if( "${infile}" MATCHES "@rpath")
string(REGEX REPLACE "@rpath." "" infile "${infile}")
endif()
endif()
if(WIN32 OR CMAKE_CROSSCOMPILING)
string(TOLOWER "${infile}" infile_lower )
endif()
get_filename_component(bn ${infile} NAME)
list_contains(contains "${bn}" "${alldlls}")
if(NOT contains)
set(DLL_FOUND FALSE)
foreach(SEARCHDIR ${PKG_SEARCHDIRS})
if(NOT DLL_FOUND)
if(WIN32 OR CMAKE_CROSSCOMPILING)
if(NOT EXISTS ${SEARCHDIR}/${infile} )
if(EXISTS ${SEARCHDIR}/${infile_lower} )
set(infile ${infile_lower})
endif()
endif()
endif()
if(EXISTS ${SEARCHDIR}/${infile})
set(DLL_FOUND TRUE)
message(STATUS "Processing ${SEARCHDIR}/${infile}")