Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
fe436502
Commit
fe436502
authored
Apr 07, 2016
by
Rashad Kanavath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PKG: JIRA: 974 fixing standalone linux binary packaging
parent
2669134d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
339 additions
and
153 deletions
+339
-153
SuperBuild/CMake/External_itk.cmake
SuperBuild/CMake/External_itk.cmake
+17
-13
SuperBuild/CMake/External_package.cmake
SuperBuild/CMake/External_package.cmake
+8
-7
SuperBuild/CMake/External_pkgtools.cmake
SuperBuild/CMake/External_pkgtools.cmake
+40
-22
SuperBuild/CMake/PackageHelper.cmake
SuperBuild/CMake/PackageHelper.cmake
+152
-26
SuperBuild/CMake/Package_Macro.cmake
SuperBuild/CMake/Package_Macro.cmake
+63
-39
SuperBuild/CMake/pkgsetup.in
SuperBuild/CMake/pkgsetup.in
+0
-46
SuperBuild/Packaging/otbenv.cmd
SuperBuild/Packaging/otbenv.cmd
+7
-0
SuperBuild/Packaging/otbenv.profile
SuperBuild/Packaging/otbenv.profile
+13
-0
SuperBuild/Packaging/pkgsetup.in
SuperBuild/Packaging/pkgsetup.in
+39
-0
No files found.
SuperBuild/CMake/External_itk.cmake
View file @
fe436502
...
...
@@ -11,12 +11,12 @@ if(USE_SYSTEM_ITK)
else
()
SETUP_SUPERBUILD
(
PROJECT
${
proj
}
)
message
(
STATUS
" Using ITK SuperBuild version"
)
# if(MSVC)
# set(ITK_SB_SRC "C:/Temp/ITK")
# set(ITK_SB_BUILD_DIR ${ITK_SB_SRC}/build)
# endif()
set
(
ITK_ENABLED_MODULES
Common
FiniteDifference
...
...
@@ -99,19 +99,19 @@ else()
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
()
# declare dependencies
ADDTO_DEPENDENCIES_IF_NOT_SYSTEM
(
${
proj
}
TIFF EXPAT PNG ZLIB FFTW
)
INCLUDE_SUPERBUILD_DEPENDENCIES
(
${${
proj
}
_DEPENDENCIES
}
)
# set proj back to its original value
set
(
proj ITK
)
ADD_SUPERBUILD_CMAKE_VAR
(
TIFF_INCLUDE_DIR
)
ADD_SUPERBUILD_CMAKE_VAR
(
TIFF_LIBRARY
)
ADD_SUPERBUILD_CMAKE_VAR
(
EXPAT_INCLUDE_DIR
)
...
...
@@ -120,7 +120,7 @@ else()
ADD_SUPERBUILD_CMAKE_VAR
(
PNG_LIBRARY
)
ADD_SUPERBUILD_CMAKE_VAR
(
ZLIB_INCLUDE_DIR
)
ADD_SUPERBUILD_CMAKE_VAR
(
ZLIB_LIBRARY
)
# 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
)
...
...
@@ -129,14 +129,14 @@ else()
-DUSE_FFTWD:BOOL=OFF
)
else
()
list
(
APPEND ITK_SB_CONFIG
list
(
APPEND ITK_SB_CONFIG
-DUSE_FFTWF:BOOL=ON
-DUSE_FFTWD:BOOL=ON
-DUSE_SYSTEM_FFTW:BOOL=ON
)
ADD_SUPERBUILD_CMAKE_VAR
(
FFTW_INCLUDE_PATH
)
endif
()
# forward compilation flags
set
(
ITK_SB_COMPILATION_FLAGS
-DCMAKE_BUILD_TYPE:STRING=
${
CMAKE_BUILD_TYPE
}
...
...
@@ -147,10 +147,14 @@ else()
-DCMAKE_SHARED_LINKER_FLAGS:STRING=
${
CMAKE_SHARED_LINKER_FLAGS
}
-DCMAKE_STATIC_LINKER_FLAGS:STRING=
${
CMAKE_STATIC_LINKER_FLAGS
}
)
#later used below for _SB_ITK_DIR and then in packaging
set
(
ITK_SB_VERSION 4.8
)
set
(
ITK_SB_VERSION_FULL
${
ITK_SB_VERSION
}
.1
)
ExternalProject_Add
(
${
proj
}
PREFIX
${
proj
}
URL
"http://sourceforge.net/projects/itk/files/itk/
4.8/InsightToolkit-4.8.1
.tar.gz/download"
URL
"http://sourceforge.net/projects/itk/files/itk/
${
ITK_SB_VERSION
}
/InsightToolkit-
${
ITK_SB_VERSION_FULL
}
.tar.gz/download"
URL_MD5 b1ed53604de854501cb61f34f410420e
SOURCE_DIR
${
ITK_SB_SRC
}
BINARY_DIR
${
ITK_SB_BUILD_DIR
}
...
...
@@ -174,8 +178,8 @@ else()
DEPENDS
${${
proj
}
_DEPENDENCIES
}
CMAKE_COMMAND
${
SB_CMAKE_COMMAND
}
)
set
(
_SB_ITK_DIR
${
SB_INSTALL_PREFIX
}
/lib/cmake/ITK-
4.8
)
set
(
_SB_ITK_DIR
${
SB_INSTALL_PREFIX
}
/lib/cmake/ITK-
${
ITK_SB_VERSION
}
)
endif
()
endif
()
SuperBuild/CMake/External_package.cmake
View file @
fe436502
...
...
@@ -40,14 +40,15 @@ file(WRITE "${CMAKE_BINARY_DIR}/PACKAGE-OTB/src/PACKAGE-OTB/CMakeLists.txt"
include(CMakeParseArguments)
set(CMAKE_INSTALL_PREFIX
\"
${
SB_INSTALL_PREFIX
}
\"
)
set(DOWNLOAD_LOCATION
\"
${
DOWNLOAD_LOCATION
}
\"
)
set(PACKAGE_
CMAKE_SOURCE
_DIR
${
CMAKE_SOURCE_DIR
}
/CMake)
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(PACKAGE_
SUPPORT_FILES
_DIR
\"
${
CMAKE_SOURCE_DIR
}
/CMake
/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
}
\"
)
include(
${
CMAKE_SOURCE_DIR
}
/CMake/Package_Macro.cmake)
include(
${
CMAKE_SOURCE_DIR
}
/CMake/PackageHelper.cmake)
set(ITK_VERSION_STRING
\"
${
ITK_SB_VERSION
}
\"
)
include(
\"
${
CMAKE_SOURCE_DIR
}
/CMake/Package_Macro.cmake
\"
)
include(
\"
${
CMAKE_SOURCE_DIR
}
/CMake/PackageHelper.cmake
\"
)
superbuild_package(
STAGE_DIR
\"
${
ARCHIVE_NAME
}
\"
SEARCHDIRS
\"\"
)"
)
...
...
SuperBuild/CMake/External_pkgtools.cmake
View file @
fe436502
...
...
@@ -4,33 +4,51 @@ set(proj PACKAGE-TOOLS)
if
(
NOT __EXTERNAL_
${
proj
}
__
)
set
(
__EXTERNAL_
${
proj
}
__ 1
)
#message(FATAL_ERROR "aaa= ${CMAKE_BINARY_DIR}")
set
(
PKGTOOLS_SB_SRC
"
${
CMAKE_BINARY_DIR
}
/PACKAGE-OTB/
${
proj
}
/src/
${
proj
}
"
)
set
(
PKGTOOLS_SB_BUILD_DIR
"
${
CMAKE_BINARY_DIR
}
/PACKAGE-OTB/
${
proj
}
/build/"
)
set
(
PKGTOOLS_SB_PREFIX_DIR
"
${
CMAKE_BINARY_DIR
}
/PACKAGE-OTB/
${
proj
}
"
)
ExternalProject_Add
(
makeself
PREFIX
makeself
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_BUILD_DIR
}
/makeself/src
BINARY_DIR
${
PKGTOOLS_SB_BUILD_DIR
}
/makeself/build
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_BUILD_DIR
}
/makeself/src/makeself-header.sh
${
CMAKE_BINARY_DIR
}
/PACKAGE-OTB/build/makeself-header.sh
INSTALL_COMMAND
${
CMAKE_COMMAND
}
-E copy
${
PKGTOOLS_SB_BUILD_DIR
}
/makeself/src/makeself.sh
${
CMAKE_BINARY_DIR
}
/PACKAGE-OTB/build/makeself.sh
)
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
ExternalProject_Add
(
${
proj
}
PREFIX
${
proj
}
URL
"http://nixos.org/releases/patchelf/patchelf-0.8/patchelf-0.8.tar.gz"
URL_MD5 407b229e6a681ffb0e2cdd5915cb2d01
DOWNLOAD_DIR
${
DOWNLOAD_LOCATION
}
SOURCE_DIR
${
PKGTOOLS_SB_SRC
}
BINARY_DIR
${
PKGTOOLS_SB_BUILD_DIR
}
PATCH_COMMAND
${
CMAKE_COMMAND
}
-E make_directory
${
CMAKE_INSTALL_PREFIX
}
/tools
UPDATE_COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
${
PKGTOOLS_SB_SRC
}
${
PKGTOOLS_SB_BUILD_DIR
}
CONFIGURE_COMMAND
${
PKGTOOLS_SB_BUILD_DIR
}
/configure --prefix
${
CMAKE_INSTALL_PREFIX
}
/tools
BUILD_COMMAND $
(
MAKE
)
INSTALL_COMMAND
${
CMAKE_COMMAND
}
-E copy
${
PKGTOOLS_SB_BUILD_DIR
}
/src/patchelf
${
CMAKE_INSTALL_PREFIX
}
/tools
DEPENDS makeself
)
)
ExternalProject_Add
(
PATCHELF
PREFIX
"
${
PATCHELF_SB_PREFIX_DIR
}
"
URL
"http://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2"
URL_MD5 d02687629c7e1698a486a93a0d607947
DOWNLOAD_DIR
${
DOWNLOAD_LOCATION
}
SOURCE_DIR
"
${
PKGTOOLS_SB_PREFIX_DIR
}
/src-patchelf"
BINARY_DIR
"
${
PKGTOOLS_SB_PREFIX_DIR
}
/build-patchelf"
TMP_DIR
"
${
PKGTOOLS_SB_PREFIX_DIR
}
/tmp-patchelf"
STAMP_DIR
"
${
PKGTOOLS_SB_PREFIX_DIR
}
/stamp-patchelf"
PATCH_COMMAND
${
CMAKE_COMMAND
}
-E make_directory
${
CMAKE_INSTALL_PREFIX
}
/tools
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E chdir
${
PKGTOOLS_SB_PREFIX_DIR
}
/src-patchelf
./configure --prefix
${
CMAKE_INSTALL_PREFIX
}
/tools
BUILD_COMMAND
${
CMAKE_COMMAND
}
-E chdir
${
PKGTOOLS_SB_PREFIX_DIR
}
/src-patchelf
${
CMAKE_MAKE_PROGRAM
}
INSTALL_COMMAND
${
CMAKE_COMMAND
}
-E copy
${
PKGTOOLS_SB_PREFIX_DIR
}
/src-patchelf/src/patchelf
${
CMAKE_INSTALL_PREFIX
}
/tools
)
ExternalProject_Add
(
${
proj
}
PREFIX
"
${
PKGTOOLS_SB_PREFIX_DIR
}
"
DOWNLOAD_COMMAND
""
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
DEPENDS MAKESELF PATCHELF
)
endif
()
SuperBuild/CMake/PackageHelper.cmake
View file @
fe436502
...
...
@@ -109,6 +109,7 @@ function(install_common include_mvd)
DEPENDENCIES_INSTALL_DIR
OTB_APPLICATIONS_DIR
PKG_STAGE_DIR
PACKAGE_SUPPORT_FILES_DIR
CMAKE_INSTALL_PREFIX
OTB_INSTALL_DIR
)
...
...
@@ -121,6 +122,23 @@ function(install_common include_mvd)
# one for debugging..
# install(CODE "message(\"CMake/PackageHelper.cmake:install_common(${outdir})\n${vars}\n\")")
##################### install environment source ##########################
if
(
WIN32 OR CROSS_COMPILING
)
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"
)
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*
...
...
@@ -198,14 +216,6 @@ function(install_monteverdi_files)
set
(
vars
"
${
vars
}
${
req
}
=[
${${
req
}}
]
\n
"
)
endforeach
(
req
)
#message("CMake/PackageHelper.cmake:install_common(${stage_dir})\n${vars}\n")
##################### install mingw otbenv.cmd ##########################
if
(
EXISTS
${
Monteverdi_SOURCE_DIR
}
/Packaging/Windows/mingw/otbenv.cmd
)
install
(
FILES
${
Monteverdi_SOURCE_DIR
}
/Packaging/Windows/mingw/otbenv.cmd
DESTINATION
${
PKG_STAGE_DIR
}
)
endif
()
####################### install mingw qt.conf ##########################
if
(
EXISTS
${
Monteverdi_SOURCE_DIR
}
/Packaging/Windows/mingw/qt.conf
)
install
(
FILES
${
Monteverdi_SOURCE_DIR
}
/Packaging/Windows/mingw/qt.conf
...
...
@@ -233,8 +243,8 @@ function(install_monteverdi_files)
endfunction
()
macro
(
clear
_package_staging_directory
)
message
(
STATUS
"
Clearing
package staging directory:
${
CMAKE_INSTALL_PREFIX
}
/
${
PKG_STAGE_DIR
}
"
)
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
}
"
)
endmacro
()
...
...
@@ -248,10 +258,33 @@ function(configure_package)
set
(
SCR_EXT
".bat"
)
endif
()
foreach
(
EXE_FILE
monteverdi
#This must exist in any OTB Installation minimal or full
set
(
PKG_BINARY_FILES
"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."
)
endif
()
foreach
(
EXE_FILE otbApplicationLauncherQt
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
}
"
)
list
(
APPEND PKG_PEFILES
"
${
OTB_INSTALL_DIR
}
/bin/
${
EXE_FILE
}${
EXE_EXT
}
"
)
endif
()
endforeach
()
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
#consider PKG_PEFILES which also has same content.
#But PKG_BINARY_FILES 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
}
"
)
list
(
APPEND PKG_PEFILES
"
${
CMAKE_INSTALL_PREFIX
}
/bin/
${
EXE_FILE
}${
EXE_EXT
}
"
)
endif
()
...
...
@@ -261,31 +294,29 @@ function(configure_package)
${
Monteverdi_SOURCE_DIR
}
/Packaging/Windows/
${
EXE_FILE
}${
SCR_EXT
}
DESTINATION
"
${
PKG_STAGE_DIR
}
/bin"
)
endif
()
endif
()
endforeach
()
foreach
(
EXE_FILE otbApplicationLauncherQt
iceViewer
otbTestDriver
otbApplicationLauncherCommandLine
)
if
(
EXISTS
"
${
OTB_INSTALL_DIR
}
/bin/
${
EXE_FILE
}${
EXE_EXT
}
"
)
list
(
APPEND PKG_PEFILES
"
${
OTB_INSTALL_DIR
}
/bin/
${
EXE_FILE
}${
EXE_EXT
}
"
)
endif
()
endif
()
endforeach
()
file
(
GLOB OTB_APPS_LIST
${
OTB_APPLICATIONS_DIR
}
/otbapp_
${
LIB_EXT
}
)
# /lib/otb
#see the first comment about PKG_BINARY_FILES
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
}
"
)
endforeach
()
set
(
include_mvd 0
)
if
(
DEFINED Monteverdi_SOURCE_DIR
)
set
(
include_mvd 1
)
endif
()
list
(
APPEND PKG_PEFILES
${
OTB_APPS_LIST
}
)
install_common
(
${
include_mvd
}
)
list
(
APPEND PKG_PEFILES
${
OTB_APPS_LIST
}
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E remove_directory
"
${
CMAKE_BINARY_DIR
}
/temp_so_names_dir"
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
"
${
CMAKE_BINARY_DIR
}
/temp_so_names_dir"
)
set
(
alldlls
)
set
(
notfound_dlls
)
...
...
@@ -300,5 +331,100 @@ function(configure_package)
message
(
FATAL_ERROR
"Following dlls were not found:
${
notfound_dlls
}
. Please consider adding their paths to 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
}
"
)
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
)
endfunction
()
endfunction
()
\ No newline at end of file
# The below function is modified from GetPrerequisities.cmake
# which is distributed with CMake.
function
(
is_file_a_symbolic_link file result_var1 result_var2
)
#
# A file is not executable until proven otherwise:
#
set
(
${
result_var1
}
0 PARENT_SCOPE
)
set
(
${
result_var2
}
""
PARENT_SCOPE
)
get_filename_component
(
file_full
"
${
file
}
"
ABSOLUTE
)
string
(
TOLOWER
"
${
file_full
}
"
file_full_lower
)
# If file name ends in .exe on Windows, *assume* executable:
#
if
(
WIN32 AND NOT UNIX
)
if
(
"
${
file_full_lower
}
"
MATCHES
"
\\
.lnk$"
)
set
(
${
result_var1
}
1 PARENT_SCOPE
)
#Assuming the file is linked to a file with same name without .lnk extension
get_filename_component
(
name_we_lnk
"
${
file_full_lower
}
"
NAME_WE
)
set
(
${
result_var2
}
"
${
name_we_lnk
}
"
PARENT_SCOPE
)
return
()
endif
()
# A clause could be added here that uses output or return value of dumpbin
# to determine ${result_var}. In 99%+? practical cases, the exe name
# match will be sufficient...
#
endif
()
# Use the information returned from the Unix shell command "file" to
# determine if ${file_full} should be considered an executable file...
#
# If the file command's output contains "executable" and does *not* contain
# "text" then it is likely an executable suitable for prerequisite analysis
# via the get_prerequisites macro.
#
if
(
UNIX
)
if
(
NOT file_cmd
)
find_program
(
file_cmd
"file"
)
mark_as_advanced
(
file_cmd
)
endif
()
if
(
file_cmd
)
execute_process
(
COMMAND
"
${
file_cmd
}
"
"
${
file_full
}
"
RESULT_VARIABLE file_rv
OUTPUT_VARIABLE file_ov
ERROR_VARIABLE file_ev
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
NOT file_rv STREQUAL
"0"
)
message
(
FATAL_ERROR
"
${
file_cmd
}
failed:
${
file_rv
}
\n
${
file_ev
}
"
)
endif
()
# Replace the name of the file in the output with a placeholder token
# (the string " _file_full_ ") so that just in case the path name of
# the file contains the word "text" or "executable" we are not fooled
# into thinking "the wrong thing" because the file name matches the
# other 'file' command output we are looking for...
#
string
(
REPLACE
"
${
file_full
}
"
" _file_full_ "
file_ov
"
${
file_ov
}
"
)
string
(
TOLOWER
"
${
file_ov
}
"
file_ov_lower
)
#message(FATAL_ERROR "file_ov='${file_ov}'")
if
(
"
${
file_ov_lower
}
"
MATCHES
"symbolic link"
)
#message(STATUS "symbolic link!")
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
}
)
#Take out last character which is a single quote
string
(
REPLACE
"'"
""
symlinked_to
"
${
symlinked_to
}
"
)
#strip for our own sanity
string
(
STRIP
${
symlinked_to
}
symlinked_to
)
set
(
${
result_var2
}
"
${
symlinked_to
}
"
PARENT_SCOPE
)
#message(FATAL_ERROR "${file_full} is symlinked_to ${symlinked_to}")
return
()
endif
()
else
()
message
(
STATUS
"warning: No 'file' command, skipping execute_process..."
)
endif
()
endif
()
endfunction
()
SuperBuild/CMake/Package_Macro.cmake
View file @
fe436502
...
...
@@ -3,6 +3,10 @@ macro(superbuild_package)
find_program
(
OBJDUMP_PROGRAM
"objdump"
)
if
(
NOT EXISTS
${
OBJDUMP_PROGRAM
}
)
message
(
FATAL_ERROR
"objdump executable not found. please check OBJDUMP_PROGRAM is set to correct cross compiled executable"
)
endif
()
include
(
GetPrerequisites
)
#CMAKE_INSTALL_PREFIX -> SB_INSTALL_PREFIX
...
...
@@ -17,22 +21,30 @@ macro(superbuild_package)
list
(
APPEND PKG_SEARCHDIRS
"
${
CMAKE_INSTALL_PREFIX
}
/lib/otb"
)
#mvd so
list
(
APPEND PKG_SEARCHDIRS
"
${
CMAKE_INSTALL_PREFIX
}
/lib/otb/applications"
)
#otb apps
clear
_package_staging_directory
()
empty
_package_staging_directory
()
set
(
PKG_PEFILES
)
file
(
WRITE
${
CMAKE_BINARY_DIR
}
/make_symlinks
"#!/bin/sh
\n
"
)
set
(
PKG_PEFILES
)
set
(
PKG_BINARY_FILES
)
set
(
PKG_SO_FILES
)
configure_package
()
############# install client configure script ################
configure_file
(
${
PACKAGE_
CMAKE_SOURCE
_DIR
}
/pkgsetup.in
configure_file
(
${
PACKAGE_
SUPPORT_FILES
_DIR
}
/pkgsetup.in
${
CMAKE_BINARY_DIR
}
/pkgsetup @ONLY
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/pkgsetup
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
)
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
####################### install patchelf #####################
install
(
FILES
${
CMAKE_INSTALL_PREFIX
}
/tools/patchelf
...
...
@@ -41,7 +53,6 @@ macro(superbuild_package)
OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
)
if
(
PKG_XDK
)
install_xdk_files
()
endif
()
...
...
@@ -63,44 +74,59 @@ function(process_deps infile)
message
(
STATUS
"Processing
${
SEARCHDIR
}
/
${
infile
}
"
)
is_file_executable
(
"
${
SEARCHDIR
}
/
${
infile
}
"
is_executable
)
if
(
is_executable
)
install
(
FILES
"
${
SEARCHDIR
}
/
${
infile
}
"
DESTINATION
${
PKG_STAGE_DIR
}
/bin
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ
)
install
(
PROGRAMS
"
${
SEARCHDIR
}
/
${
infile
}
"
DESTINATION
${
PKG_STAGE_DIR
}
/bin
)
else
(
is_executable
)
if
(
NOT MAKE_XDK
)
if
(
${
infile
}
MATCHES
"otbapp_"
)
install
(
FILES
"
${
CMAKE_INSTALL_PREFIX
}
/lib/otb/applications/
${
infile
}
"
DESTINATION
${
PKG_STAGE_DIR
}
/lib/otb/applications
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ
)
endif
()
endif
()
# MAKE_XDK
get_filename_component
(
bn_we
${
infile
}
NAME_WE
)
file
(
GLOB sofiles
"
${
SEARCHDIR
}
/
${
bn_we
}
*"
)
foreach
(
sofile
${
sofiles
}
)
if
(
MAKE_XDK
)
get_filename_component
(
bn_we_sofile
${
sofile
}
NAME
)
string
(
TOLOWER
"
${
bn_we_sofile
}
"
sofile_lower
)
if
(
NOT
"
${
sofile_lower
}
"
MATCHES
"otb"
)
install
(
FILES
"
${
sofile
}
"
DESTINATION
${
PKG_STAGE_DIR
}
/lib
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ
)
endif
()
else
()
#MAKE_XDK
install
(
FILES
"
${
sofile
}
"
DESTINATION
${
PKG_STAGE_DIR
}
/lib
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ
)
endif
()
#MAKE_XDK
get_filename_component
(
sofile_ext
${
sofile
}
EXT
)
set
(
is_valid TRUE
)
if
(
"
${
sofile_ext
}
"
MATCHES
".la"
OR
"
${
sofile_ext
}
"
MATCHES
".prl"
OR
"
${
sofile_ext
}
"
MATCHES
".a"
)
set
(
is_valid FALSE
)
endif
()
if
(
is_valid
)
get_filename_component
(
basename_of_sofile
${
sofile
}
NAME
)
is_file_a_symbolic_link
(
"
${
sofile
}
"
is_symlink linked_to_file
)
if
(
is_symlink
)
##NOTE: $OUT_DIR is set actually in pkgsetup.in. So don't try
#any pre-mature optimization on that variable names
file
(
APPEND
${
CMAKE_BINARY_DIR
}
/make_symlinks
"ln -sf $OUT_DIR/lib/
${
linked_to_file
}
$OUT_DIR/lib/
${
basename_of_sofile
}
\n
"
)
#message("${sofile} is a symlink to ${linked_to_file}")
else
()
# is_symlink
if
(
"
${
basename_of_sofile
}
"
MATCHES
"otbapp_"
)
if
(
NOT MAKE_XDK
)
install
(
FILES
"
${
sofile
}
"
DESTINATION
${
PKG_STAGE_DIR
}
/lib/otb/applications
)
endif
()
else
()
#if(.. MATCHES "otbapp_")
#if we are making xdk. skill all those starting with libotb case insensitively
if
(
MAKE_XDK
)
string
(
TOLOWER
"
${
basename_of_sofile
}
"
sofile_lower
)
if
(
NOT
"
${
sofile_lower
}
"
MATCHES
"libotb"
)
install
(
FILES
"
${
sofile
}
"
DESTINATION
${
PKG_STAGE_DIR
}
/lib
)
endif
()
else
()
#MAKE_XDK
#just install the so file to <staging-dir>/lib
install
(
FILES
"
${
sofile
}
"
DESTINATION
${
PKG_STAGE_DIR
}
/lib
)
endif
()
#MAKE_XDK
# Finally touch a file in temp directory for globbing later
# message("touching ${basename_of_sofile}")
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E touch
"
${
CMAKE_BINARY_DIR
}
/temp_so_names_dir/
${
basename_of_sofile
}
"
)
endif
()
#if(.. MATCHES "otbapp_")
endif
()
#is_symlink
endif
()
#is_valid
endforeach
()
endif
(
is_executable
)
if
(
NOT EXISTS
${
OBJDUMP_PROGRAM
}
)
message
(
FATAL_ERROR
"objdump executable not found. please check OBJDUMP_PROGRAM is set to correct cross compiled executable"
)
endif
()
execute_process
(
COMMAND
${
OBJDUMP_PROGRAM
}
"-p"
"
${
SEARCHDIR
}
/
${
infile
}
"
OUTPUT_VARIABLE dump_out
)
string
(
REGEX MATCHALL
"NEEDED
\\
*[A-Za-z(0-9
\\
.0-9)+_
\\
-]*"
needed_dlls
"
${
dump_out
}
"
)
string
(
REGEX REPLACE
"NEEDED"
""
needed_dlls
"
${
needed_dlls
}
"
)
foreach
(
needed_dll
${
needed_dlls
}
)
string
(
STRIP
${
needed_dll
}
needed_dll
)
process_deps
(
${
needed_dll
}
)
...
...
@@ -117,14 +143,12 @@ function(process_deps infile)
else
(
NOT DLL_FOUND
)
set
(
alldlls
"
${
alldlls
}
;
${
bn
}
"
PARENT_SCOPE
)
endif
(
NOT DLL_FOUND
)
set
(
notfound_dlls
"
${
notfound_dlls
}
"
PARENT_SCOPE
)
endif
()
endfunction
()
function
(
install_xdk_files
)
install
(
DIRECTORY
${
DEPENDENCIES_INSTALL_DIR
}
/share
DESTINATION
${
PKG_STAGE_DIR
}
)
...
...
SuperBuild/CMake/pkgsetup.in
deleted
100644 → 0
View file @
2669134d
#!/bin/bash
cd
`
dirname
$0
`
OUT
=
`
pwd
`
PATCH_ELF_EXE
=
$OUT
/tools/patchelf
# no interference with LD_LIBRARY_PATH
LD_LIBRARY_PATH
=
#setup bin and lib dirs
INSTALL_LIBDIRS
=
$OUT
/lib
INSTALL_BINDIRS
=
$OUT
/bin
echo
"Configuring..."
#run patchelf to set rpath
for
lib
in
$INSTALL_LIBDIRS
/
*
.so
*
;
do
# echo "adding rpath to $lib"
$PATCH_ELF_EXE
--set-rpath
"
$OUT
/lib"
$lib
;
done
#run patchelf on otbapp_
for
lib
in
$INSTALL_LIBDIRS
/otb/applications/
*
.so
*
;
do
# echo "adding rpath to $lib"
if
[
-f
$lib
]
;
then
$PATCH_ELF_EXE
--set-rpath
"
$OUT
/lib"
$lib
;
fi
done
#run patchelf on otb executables
for
bin
in
$INSTALL_BINDIRS
/otbTestDriver
$(
ls
$INSTALL_BINDIRS
/otbApplicationLauncher
*
)
$INSTALL_BINDIRS
/monteverdi
$INSTALL_BINDIRS
/mapla
;
do