Commit 9b674b42 authored by Julien Michel's avatar Julien Michel
Browse files

Merge branch 'release-5.4' of https://git.orfeo-toolbox.org/git/otb into release-5.4

parents 124f72c8 a97a0b74
Copyright (c) 2002-2006 Marcus Geelnard
Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
......@@ -85,7 +85,7 @@ std::string StandardShader::GetSource() const
"uniform int shader_vertical_slider_flag;\n" \
"void main (void) {\n" \
"vec4 p = texture2D(src, gl_TexCoord[0].xy);\n" \
"gl_FragColor = clamp(pow((p+shader_b)*shader_a,shader_gamma), 0.0, 1.0);\n" \
"gl_FragColor = pow( clamp( ( p+shader_b ) * shader_a, 0.0, 1.0 ), shader_gamma );\n" \
"gl_FragColor[3] = clamp(shader_alpha,0.0,1.0);\n" \
"if(shader_use_no_data > 0 && vec3(p) == vec3(shader_no_data)){\n" \
"gl_FragColor[3] = 0.;\n" \
......
if(NOT __EXTERNAL_FFTW__)
set(__EXTERNAL_FFTW__ 1)
set(__EXTERNAL_FFTW__ 1)
if(USE_SYSTEM_FFTW)
# TODO : use ITK's FindFFTW
#find_package ( FFTW )
message(STATUS " Using FFTW system version")
else()
SETUP_SUPERBUILD(PROJECT FFTW)
set(projFloat FFTWF)
set(projDouble FFTWD)
if(USE_SYSTEM_FFTW)
# TODO : use ITK's FindFFTW
#find_package ( FFTW )
message(STATUS " Using FFTW system version")
else()
SETUP_SUPERBUILD(PROJECT FFTW)
set(FFTW_SB_BUILD_FLOAT_DIR ${CMAKE_BINARY_DIR}/FFTW/src/${projFloat})
set(FFTW_SB_BUILD_DOUBLE_DIR ${CMAKE_BINARY_DIR}/FFTW/src/${projDouble})
set(FFTWF_SB_SRC ${CMAKE_BINARY_DIR}/FFTW/src/FFTWF)
set(FFTWD_SB_SRC ${CMAKE_BINARY_DIR}/FFTW/src/FFTWD)
if(MSVC)
# TODO : get precompiled binaries as not all MSVC versions can compile FFTW
if(MSVC)
# TODO : get precompiled binaries as not all MSVC versions can compile FFTW
message(STATUS " FFTW SuperBuild is not available yet...")
add_custom_target(FFTW)
else()
message(STATUS " Using FFTW SuperBuild version")
# Compile the float version of FFTW
ExternalProject_Add(${projFloat}
PREFIX FFTW
URL "http://www.fftw.org/fftw-3.3.4.tar.gz"
URL_MD5 2edab8c06b24feeb3b82bbb3ebf3e7b3
SOURCE_DIR ${FFTW_SB_BUILD_FLOAT_DIR}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
CONFIGURE_COMMAND
${SB_ENV_CONFIGURE_CMD}
${FFTW_SB_BUILD_FLOAT_DIR}/configure
--prefix=${SB_INSTALL_PREFIX}
--enable-shared
--disable-static
--enable-float
--enable-threads
--disable-fortran
DEPENDS ${FFTW_DEPENDENCIES}
)
else()
message(STATUS " Using FFTW SuperBuild version")
#ExternalProject_Add_Step(${projFloat} copy_source
# COMMAND ${CMAKE_COMMAND} -E copy_directory
# ${FFTW_SB_SRC} ${FFTW_SB_BUILD_FLOAT_DIR}
# DEPENDEES patch update
# DEPENDERS configure
# )
# Compile the float version of FFTW
ExternalProject_Add(FFTWF
PREFIX FFTW/FFTWF
URL "http://www.fftw.org/fftw-3.3.4.tar.gz"
URL_MD5 2edab8c06b24feeb3b82bbb3ebf3e7b3
SOURCE_DIR ${FFTWF_SB_SRC}
BINARY_DIR ${FFTWF_SB_SRC}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
CONFIGURE_COMMAND
${SB_ENV_CONFIGURE_CMD}
${FFTWF_SB_SRC}/configure
--prefix=${SB_INSTALL_PREFIX}
--enable-shared
--disable-static
--enable-float
--enable-threads
--disable-fortran
--disable-dependency-tracking
DEPENDS ${FFTW_DEPENDENCIES}
)
# Compile the double version of FFTW
ExternalProject_Add(FFTW
PREFIX FFTW
URL "http://www.fftw.org/fftw-3.3.4.tar.gz"
URL_MD5 2edab8c06b24feeb3b82bbb3ebf3e7b3
SOURCE_DIR ${FFTW_SB_BUILD_DOUBLE_DIR}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
CONFIGURE_COMMAND
${SB_ENV_CONFIGURE_CMD}
${FFTW_SB_BUILD_DOUBLE_DIR}/configure
--prefix=${SB_INSTALL_PREFIX}
--enable-shared
--disable-static
--disable-float
--enable-threads
--disable-fortran
DEPENDS ${FFTW_DEPENDENCIES}
)
if(APPLE)
SUPERBUILD_PATCH_SOURCE(FFTWF "patch-for-at-rpath" ${CMAKE_SOURCE_DIR}/patches/FFTW)
endif()
#ExternalProject_Add_Step(${projDouble} copy_source
# COMMAND ${CMAKE_COMMAND} -E copy_directory
# ${FFTW_SB_SRC} ${FFTW_SB_BUILD_DOUBLE_DIR}
# DEPENDEES patch update
# DEPENDERS configure
# )
# Compile the double version of FFTW
ExternalProject_Add(FFTWD
PREFIX FFTW/FFTWD
URL "http://www.fftw.org/fftw-3.3.4.tar.gz"
URL_MD5 2edab8c06b24feeb3b82bbb3ebf3e7b3
SOURCE_DIR ${FFTWD_SB_SRC}
BINARY_DIR ${FFTWD_SB_SRC}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
CONFIGURE_COMMAND
${SB_ENV_CONFIGURE_CMD}
${FFTWD_SB_SRC}/configure
--prefix=${SB_INSTALL_PREFIX}
--enable-shared
--disable-static
--disable-float
--enable-threads
--disable-fortran
--disable-dependency-tracking
)
add_dependencies(FFTW ${projFloat})
if(APPLE)
SUPERBUILD_PATCH_SOURCE(FFTWD "patch-for-at-rpath" ${CMAKE_SOURCE_DIR}/patches/FFTW)
endif()
FIX_RPATH_FOR_AUTOCONF_BUILD(FFTW "libfftw3*dylib")
ExternalProject_Add(FFTW
PREFIX FFTW
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
DEPENDS FFTWF FFTWD
)
set(_SB_FFTW_INCLUDE_PATH ${SB_INSTALL_PREFIX}/include)
endif()
set(_SB_FFTW_INCLUDE_PATH ${SB_INSTALL_PREFIX}/include)
endif()
endif()
endif()
endif()
......@@ -25,26 +25,30 @@ else()
if(UNIX)
set(GDAL_SB_EXTRA_OPTIONS "" CACHE STRING "Extra options to be passed to GDAL configure script")
mark_as_advanced(GDAL_SB_EXTRA_OPTIONS)
#Convert GDAL_SB_EXTRA_OPTIONS to a list to allow to add multiple instructions to the CONFIGURE_COMMAND
separate_arguments(GDAL_SB_EXTRA_OPTIONS)
#we dont do any framework build on osx. So let's be sure on case of gdal
if(APPLE)
list(APPEND GDAL_SB_CONFIG "--with-macosx-framework=no")
endif()
ExternalProject_Add(GDAL
PREFIX GDAL
URL "http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz"
URL_MD5 866a46f72b1feadd60310206439c1a76
BINARY_DIR ${GDAL_SB_BUILD_DIR}
SOURCE_DIR ${GDAL_SB_SRC}
BINARY_DIR ${GDAL_SB_SRC}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
DEPENDS ${GDAL_DEPENDENCIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E touch ${GDAL_SB_SRC}/config.rpath
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/GDAL/GNUmakefile ${GDAL_SB_SRC}/swig/python/GNUmakefile
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/patches/GDAL/S2_patch ${GDAL_SB_SRC}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${GDAL_SB_SRC} ${GDAL_SB_BUILD_DIR}
CONFIGURE_COMMAND
# use 'env' because CTest launcher doesn't perform shell interpretation
${SB_ENV_CONFIGURE_CMD}
${GDAL_SB_BUILD_DIR}/configure
${GDAL_SB_SRC}/configure
--prefix=${SB_INSTALL_PREFIX}
--enable-static=no
--without-ogdi
......@@ -60,7 +64,9 @@ else()
INSTALL_COMMAND $(MAKE) install
)
FIX_RPATH_FOR_AUTOCONF_BUILD(GDAL "libgdal*.dylib")
if(APPLE)
SUPERBUILD_PATCH_SOURCE(GDAL "patch-for-at-rpath")
endif()
else(MSVC)
##add libkml
......@@ -77,17 +83,16 @@ else()
URL "http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz"
URL_MD5 866a46f72b1feadd60310206439c1a76
SOURCE_DIR ${GDAL_SB_SRC}
BINARY_DIR ${GDAL_SB_BUILD_DIR}
BINARY_DIR ${GDAL_SB_SRC}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
DEPENDS ${GDAL_DEPENDENCIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/GDAL/GNUmakefile ${GDAL_SB_SRC}/swig/python/GNUmakefile
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/patches/GDAL/S2_patch ${GDAL_SB_SRC}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${GDAL_SB_SRC} ${GDAL_SB_BUILD_DIR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/GDAL/ogrsqlitevirtualogr.cpp
${GDAL_SB_BUILD_DIR}/ogr/ogrsf_frmts/sqlite/ogrsqlitevirtualogr.cpp
BUILD_COMMAND nmake /f ${GDAL_SB_BUILD_DIR}/makefile.vc MSVC_VER=${MSVC_VERSION} EXT_NMAKE_OPT=${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt
INSTALL_COMMAND nmake /f ${GDAL_SB_BUILD_DIR}/makefile.vc devinstall MSVC_VER=${MSVC_VERSION} EXT_NMAKE_OPT=${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt
${GDAL_SB_SRC}/ogr/ogrsf_frmts/sqlite/ogrsqlitevirtualogr.cpp
BUILD_COMMAND nmake /f ${GDAL_SB_SRC}/makefile.vc MSVC_VER=${MSVC_VERSION} EXT_NMAKE_OPT=${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt
INSTALL_COMMAND nmake /f ${GDAL_SB_SRC}/makefile.vc devinstall MSVC_VER=${MSVC_VERSION} EXT_NMAKE_OPT=${CMAKE_BINARY_DIR}/nmake_gdal_extra.opt
)
endif()
......
......@@ -48,9 +48,7 @@ else()
BUILD_COMMAND $(MAKE)
INSTALL_COMMAND $(MAKE) install)
SUPERBUILD_PATCH_SOURCE(GEOTIFF "patch-configure-script")
FIX_RPATH_FOR_AUTOCONF_BUILD(GEOTIFF "libgeotiff*.dylib")
SUPERBUILD_PATCH_SOURCE(GEOTIFF "patch-configure-rpath")
else()
......
......@@ -72,10 +72,13 @@ else()
-DWITH_CUDA:BOOL=OFF
-DWITH_OPENCL:BOOL=OFF
${OPENCV_SB_CONFIG}
DEPENDS ${OPENCV_DEPENDENCIES}
DEPENDS ${OPENCV_DEPENDENCIES}
CMAKE_COMMAND ${SB_CMAKE_COMMAND}
)
FIX_RPATH_FOR_AUTOCONF_BUILD(OPENCV "libopencv_*.dylib")
if(APPLE)
SUPERBUILD_PATCH_SOURCE(OPENCV "patch-for-at-rpath")
endif()
set(_SB_OpenCV_DIR ${SB_INSTALL_PREFIX}/share/OpenCV)
endif()
......
......@@ -72,7 +72,10 @@ else()
DEPENDERS configure )
FIX_RPATH_FOR_AUTOCONF_BUILD(OSSIM "libossim*.dylib")
if(APPLE)
SUPERBUILD_PATCH_SOURCE(OSSIM "patch-for-at-rpath")
endif()
set(_SB_OSSIM_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include)
if(WIN32)
......
......@@ -191,6 +191,11 @@ ExternalProject_Add(OTB
CMAKE_COMMAND ${OTB_SB_CMAKE_COMMAND}
)
ExternalProject_Add_Step(OTB install_copyright
COMMAND ${CMAKE_COMMAND} -E copy_directory ${OTB_SB_SRC}/Copyright ${CMAKE_INSTALL_PREFIX}/share/copyright
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Copyright ${CMAKE_INSTALL_PREFIX}/share/copyright
DEPENDEES install)
# detect OTB version number
if (SUPERBUILD_OTB_VERSION)
set(_SB_OTB_DIR ${SB_INSTALL_PREFIX}/lib/cmake/OTB-${SUPERBUILD_OTB_VERSION_MAJOR}.${SUPERBUILD_OTB_VERSION_MINOR})
......
......@@ -14,7 +14,7 @@ else()
URL "http://download.osgeo.org/proj/proj-4.8.0.tar.gz"
URL_MD5 d815838c92a29179298c126effbb1537
SOURCE_DIR ${PROJ_SB_SRC}
BINARY_DIR ${PROJ_SB_BUILD_DIR}
BINARY_DIR ${PROJ_SB_SRC}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
CONFIGURE_COMMAND ""
......@@ -27,49 +27,39 @@ else()
PREFIX PROJ/_install
DOWNLOAD_COMMAND ""
SOURCE_DIR PROJ/_install
BINARY_DIR ${PROJ_SB_BUILD_DIR}
BINARY_DIR ${PROJ_SB_SRC}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${SB_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release
-DPROJ4_BUILD_DIR:STRING=${PROJ_SB_BUILD_DIR}/src
-DPROJ4_BUILD_DIR:STRING=${PROJ_SB_SRC}/src
DEPENDS PROJ_build
CMAKE_COMMAND
)
ExternalProject_Add_Step(PROJ_build copy_source
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJ_SB_SRC} ${PROJ_SB_BUILD_DIR}
DEPENDEES patch update
DEPENDERS configure
)
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}
BINARY_DIR ${PROJ_SB_SRC}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
CONFIGURE_COMMAND
# use 'env' because CTest launcher doesn't perform shell interpretation
${SB_ENV_CONFIGURE_CMD}
${PROJ_SB_BUILD_DIR}/configure
${PROJ_SB_SRC}/configure
--prefix=${SB_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
)
FIX_RPATH_FOR_AUTOCONF_BUILD(PROJ "libproj*.dylib")
if(APPLE)
SUPERBUILD_PATCH_SOURCE(PROJ "patch-for-at-rpath")
endif()
endif()
set(_SB_PROJ_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include)
......
......@@ -26,7 +26,7 @@ if(NOT __EXTERNAL_QT4__)
endif()
if(APPLE)
set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-framework -rpath")
set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-framework")
endif()
STRING(REGEX REPLACE "/$" "" CMAKE_WIN_INSTALL_PREFIX ${SB_INSTALL_PREFIX})
......@@ -82,8 +82,9 @@ if(NOT __EXTERNAL_QT4__)
)
endif()
FIX_RPATH_FOR_AUTOCONF_BUILD(QT4 "libQt*.dylib")
if(APPLE)
SUPERBUILD_PATCH_SOURCE(QT4 "patch-for-at-rpath")
endif()
set(_SB_QT_QMAKE_EXECUTABLE ${SB_INSTALL_PREFIX}/bin/qmake)
......
......@@ -42,9 +42,23 @@ set(LINUX_SYSTEM_DLLS
libGLU.so*
)
# libgcc_s.*dylib and other *.framework are dragged by QT
set(APPLE_SYSTEM_DLLS
libSystem.*
libiconv*
libSystem.*dylib
libiconv.*dylib
libc\\+\\+.*dylib
libstdc.*dylib
libobjc.*dylib
ApplicationServices.framework
CoreFoundation.framework
CoreServices.framework
Security.framework
Carbon.framework
AppKit.framework
Foundation.framework
AGL.framework
OpenGL.framework
libgcc_s.*dylib
)
if(UNIX)
......@@ -162,7 +176,7 @@ function(install_common include_mvd)
endif()
##################### install cli and gui scripts #######################
install(FILES ${PKG_APP_SCRIPTS} DESTINATION ${PKG_STAGE_BIN_DIR})
install(PROGRAMS ${PKG_APP_SCRIPTS} DESTINATION ${PKG_STAGE_BIN_DIR})
if(include_mvd)
install_monteverdi_files()
......@@ -182,9 +196,36 @@ function(install_common include_mvd)
####################### 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 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(DIRECTORY "${OTB_APPLICATIONS_DIR}" DESTINATION ${PKG_OTBLIBS_DIR})
####################### Install copyrights ######################
install(DIRECTORY ${PKG_SHARE_SOURCE_DIR}/copyright DESTINATION ${PKG_SHARE_DEST_DIR})
file(WRITE "${PKG_STAGE_DIR}/Copyright.txt"
"The OTB is released under the CeCILL-2.0 license. This license is available
online :
http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
http://www.cecill.info/licences/Licence_CeCILL_V2-fr.html
More details on copyright information can be found in :
share/copyright
However this binary package may be compiled with dependencies that have
incompatible licensing. As a consequence, this OTB binary package will be
released under GPL-v2 license in the following cases :
- if ITK (used by OTB) was built with FFTW support enabled (FFTW is released
under GPL-v2 license)
- if this package was built using FreeType. FreeType allows to choose between
the advertising FreeType license and the GPL-v2 license.
")
endfunction()
function(install_monteverdi_files)
......@@ -193,7 +234,7 @@ function(install_monteverdi_files)
if(WIN32 OR CMAKE_CROSSCOMPILING)
set(PKG_QTSQLITE_FILENAME "qsqlite4.dll")
elseif(APPLE)
set(PKG_QTSQLITE_FILENAME "qsqlite.dylib")
set(PKG_QTSQLITE_FILENAME "libqsqlite.dylib")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND NOT CMAKE_CROSSCOMPILING)
set(PKG_QTSQLITE_FILENAME "libqsqlite.so")
else()
......@@ -260,6 +301,11 @@ macro(empty_package_staging_directory)
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_INSTALL_PREFIX}/${PKG_STAGE_DIR}")
endmacro()
#NOTE:
# VAR_IN_PKGSETUP_CONFIGURE cmake variable is set below.
# This is important and useful running configure_file()
# over *pkgsetup.in
function(configure_package)
if(UNIX)
set(EXE_EXT "")
......@@ -278,7 +324,7 @@ function(configure_package)
endif()
#This must exist in any OTB Installation minimal or full
set(PKG_BINARY_FILES "bin/otbApplicationLauncherCommandLine")
set(VAR_IN_PKGSETUP_CONFIGURE "bin/otbApplicationLauncherCommandLine")
set(PKG_PEFILES "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT}")
if(NOT EXISTS "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT}")
message(FATAL_ERROR "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT} not found.")
......@@ -288,8 +334,8 @@ function(configure_package)
iceViewer
otbTestDriver)
if(EXISTS "${OTB_INSTALL_DIR}/bin/${EXE_FILE}${EXE_EXT}")
#see the first comment about PKG_BINARY_FILES
set(PKG_BINARY_FILES "${PKG_BINARY_FILES} bin/${EXE_FILE}${EXE_EXT}")
#see the first comment about VAR_IN_PKGSETUP_CONFIGURE
set(VAR_IN_PKGSETUP_CONFIGURE "${VAR_IN_PKGSETUP_CONFIGURE} bin/${EXE_FILE}${EXE_EXT}")
list(APPEND PKG_PEFILES
"${OTB_INSTALL_DIR}/bin/${EXE_FILE}${EXE_EXT}")
endif()
......@@ -298,12 +344,12 @@ function(configure_package)
foreach(EXE_FILE monteverdi
mapla)
if(EXISTS "${CMAKE_INSTALL_PREFIX}/bin/${EXE_FILE}${EXE_EXT}")
#PKG_BINARY_FILES might seem a bit redundant variable if you
#VAR_IN_PKGSETUP_CONFIGURE might seem a bit redundant variable if you
#consider PKG_PEFILES which also has same content.
#But PKG_BINARY_FILES goes into pkgsetup.in for Linux standalone binaries
#But VAR_IN_PKGSETUP_CONFIGURE goes into pkgsetup.in for Linux standalone binaries
# and other one (PKG_PEFILES) is for dependency resolution in
# process_deps() function
set(PKG_BINARY_FILES "${PKG_BINARY_FILES} bin/${EXE_FILE}${EXE_EXT}")
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}")
endif()
......@@ -319,10 +365,10 @@ function(configure_package)
file(GLOB OTB_APPS_LIST ${OTB_APPLICATIONS_DIR}/otbapp_${LIB_EXT}) # /lib/otb
#see the first comment about PKG_BINARY_FILES
#see the first comment about VAR_IN_PKGSETUP_CONFIGURE
foreach(OTB_APP_SO ${OTB_APPS_LIST})
get_filename_component(OTB_APP_SO_NAME ${OTB_APP_SO} NAME)
set(PKG_BINARY_FILES "${PKG_BINARY_FILES} lib/otb/applications/${OTB_APP_SO_NAME}")
set(VAR_IN_PKGSETUP_CONFIGURE "${VAR_IN_PKGSETUP_CONFIGURE} lib/otb/applications/${OTB_APP_SO_NAME}")
endforeach()
set(include_mvd 0)
......@@ -346,20 +392,21 @@ function(configure_package)
list(LENGTH notfound_dlls nos)
if(${nos} GREATER 0)
STRING(REPLACE ".so;" ".so," notfound ${notfound_dlls})
message(FATAL_ERROR "Following dlls were not found: ${notfound_dlls}. Please consider adding their paths to SEARCHDIRS when calling superbuild_package macro.")
list(REMOVE_DUPLICATES notfound_dlls)
#string(REPLACE ".so;" ".so\\r\\n" 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()
file(GLOB temp_files "${CMAKE_BINARY_DIR}/temp_so_names_dir/*") # /lib/otb
foreach(temp_file ${temp_files})
get_filename_component(basename_of_temp_file ${temp_file} NAME)
set(PKG_BINARY_FILES "${PKG_BINARY_FILES} lib/${basename_of_temp_file}")
set(VAR_IN_PKGSETUP_CONFIGURE "${VAR_IN_PKGSETUP_CONFIGURE} lib/${basename_of_temp_file}")
endforeach()
#remove this temporary directory
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_BINARY_DIR}/temp_so_names_dir")
set(PKG_BINARY_FILES "${PKG_BINARY_FILES}" PARENT_SCOPE)
set(VAR_IN_PKGSETUP_CONFIGURE "${VAR_IN_PKGSETUP_CONFIGURE}" PARENT_SCOPE)
endfunction()
......@@ -431,8 +478,15 @@ function(is_file_a_symbolic_link file result_var1 result_var2)
set(${result_var1} 1 PARENT_SCOPE)
#Now find where the symlink is linked to.
#Do a regex replace
string(REGEX REPLACE "_file_full_*.*symbolic.link.to.."
"" symlinked_to ${file_ov})
if(UNIX)
if(APPLE)
string(REGEX REPLACE "_file_full_*.*symbolic.link.to."
"" symlinked_to ${file_ov})
else(APPLE)
string(REGEX REPLACE "_file_full_*.*symbolic.link.to.."
"" symlinked_to ${file_ov})
endif(APPLE)
endif(UNIX)
#Take out last character which is a single quote
string(REPLACE "'" "" symlinked_to "${symlinked_to}")
#strip for our own sanity
......
......@@ -34,12 +34,18 @@ macro(superbuild_package)
"#!/bin/sh\n")
set(PKG_PEFILES)
set(PKG_BINARY_FILES)
#NOTE: VAR_IN_PKGSETUP_CONFIGURE is copied to linux_pkgsetup.in during configure_file
set(VAR_IN_PKGSETUP_CONFIGURE)
set(PKG_SO_FILES)
configure_package()
############# install client configure script ################
configure_file(${PACKAGE_SUPPORT_FILES_DIR}/pkgsetup.in
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
......@@ -51,12 +57,16 @@ macro(superbuild_package)
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
####################### install patchelf #####################
install(FILES ${CMAKE_INSTALL_PREFIX}/tools/patchelf
DESTINATION ${PKG_STAGE_DIR}/tools
PERMISSIONS
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ)
if(UNIX)
if(NOT APPLE)
####################### install patchelf #####################
install(FILES ${CMAKE_INSTALL_PREFIX}/tools/patchelf