Commit 00c77aec authored by Rashad Kanavath's avatar Rashad Kanavath

PKG: jira 1268 part 3

parent 67dba4ca
......@@ -85,15 +85,4 @@ ExternalProject_Add(MAKESELF
INSTALL_COMMAND ""
DEPENDS PATCHELF
)
############# otb_loader executable ################
add_executable(otb_loader ${PACKAGE_SUPPORT_FILES_DIR}/otb_loader.cxx)
target_link_libraries(otb_loader ${CMAKE_DL_LIBS})
install(TARGETS otb_loader DESTINATION ${PKG_STAGE_DIR}/bin)
add_custom_target(PACKAGE-TOOLS DEPENDS MAKESELF otb_loader)
add_custom_target(PACKAGE-TOOLS DEPENDS MAKESELF)
......@@ -68,6 +68,13 @@ function(CreateCMakeProjects)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/PackageHelper.cmake)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/InstallSupportFiles.cmake)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/PackageGlobals.cmake)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/prepare_file_list.cmake)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/process_file_recurse.cmake)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/install_share_dirs.cmake)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/install_include_dirs.cmake)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/install_script_files.cmake)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/install_translation_files.cmake)
include(${SUPERBUILD_SOURCE_DIR}/Packaging/install_rule.cmake)
macro_super_package(STAGE_DIR \"${archive_name}\")"
)
......@@ -131,7 +138,7 @@ if(WIN32)
COMMENT "Creating ${PACKAGE_OUTPUT_FILE}"
)
else()
add_custom_target(PACKAGE
add_custom_target(PACKAGE-OTB
COMMAND ${MAKESELF_SCRIPT}
"--quiet"
"--target"
......
This diff is collapsed.
......@@ -380,12 +380,9 @@ endfunction()
function(func_patch_cmake_files_for)
cmake_parse_arguments(PATCH "" "NAME;VERSION;MATCH_STRING;REPLACE_VAR" "" ${ARGN} )
if(NOT DEPENDENCIES_INSTALL_DIR)
message(FATAL_ERROR "DEPENDENCIES_INSTALL_DIR not set")
endif()
set(PATCH_DIR_NAME ${PATCH_NAME}-${PATCH_VERSION})
set(PATCH_DIR "${DEPENDENCIES_INSTALL_DIR}/lib/cmake/${PATCH_DIR_NAME}")
set(PATCH_DIR "${SUPERBUILD_INSTALL_DIR}/lib/cmake/${PATCH_DIR_NAME}")
set(PATCH_DIR_TEMP ${CMAKE_CURRENT_BINARY_DIR}/_TEMP/${PATCH_DIR_NAME})
##message("COPY ${PATCH_DIR} to ${PATCH_DIR_TEMP} for patching")
......
function(install_include_dirs)
# #install ${SUPERBUILD_INSTALL_DIR}/include directory.
file(GLOB ALL_IN_INCLUDE_DIR "${SUPERBUILD_INSTALL_DIR}/include/*")
foreach(INCLUDE_DIR_ITEM ${ALL_IN_INCLUDE_DIR})
get_filename_component(INCLUDE_DIR_ITEM_name ${INCLUDE_DIR_ITEM} NAME)
if( IS_DIRECTORY ${INCLUDE_DIR_ITEM})
install(CODE
"message(STATUS \"Installing: ${CMAKE_INSTALL_PREFIX}/${PKG_STAGE_DIR}/include/${INCLUDE_DIR_ITEM_name}/\")" )
install(DIRECTORY "${INCLUDE_DIR_ITEM}"
DESTINATION "${PKG_STAGE_DIR}/include/"
MESSAGE_NEVER)
else()
install(FILES "${INCLUDE_DIR_ITEM}"
DESTINATION "${PKG_STAGE_DIR}/include/" )
endif() #if( IS_DIRECTORY
endforeach()
endfunction()
function(install_rule src_file)
get_filename_component(src_file_EXT ${src_file} EXT)
get_filename_component(src_file_NAME ${src_file} NAME)
set(file_type PROGRAMS)
if(NOT src_file_EXT)
set(output_dir "bin")
elseif("${src_file_EXT}" MATCHES "(.[Dd][Ll][Ll]|.exe)")
set(output_dir "bin")
elseif("${src_file_EXT}" MATCHES "(.lib|.so|.dylib)")
set(output_dir "lib")
set(file_type FILES)
else()
message(FATAL_ERROR "unreachable code")
endif()
set(SKIP_INSTALL FALSE)
setif_value_in_list(is_gtk_lib "${src_file_NAME}" GTK_LIB_LIST_1)
if(is_gtk_lib)
if(PKG_GENERATE_XDK)
set(SKIP_INSTALL TRUE)
else()
set(output_dir "lib/gtk")
endif() #if(PKG_GENERATE_XDK)
endif() #if(is_gtk_lib)
set(SKIP_INSTALL FALSE)
string(TOLOWER "${src_file_NAME}" src_file_NAME_LOWER)
#avoid test executables
#TODO:! a special case
if ("${src_file_NAME_LOWER}" MATCHES "(otb|mvd)*.*test*.*${EXE_EXT}")
if (NOT "${src_file_NAME_LOWER}" MATCHES "\\${LIB_EXT}" AND
NOT "${src_file_NAME_LOWER}" MATCHES "otbtestdriver" )
set(SKIP_INSTALL TRUE)
message("SKIP_INSTALL for ${src_file_NAME}")
endif()
endif()
#special case
if("${src_file_NAME}" MATCHES "^otbapp_")
set(output_dir "lib/otb/applications")
set(file_type PROGRAMS)
set(SKIP_INSTALL FALSE)
get_filename_component(src_file_NAME_WE ${src_file} NAME_WE)
########### install cli and gui script for each application ###########
set(WRAPPER_SCRIPT_EXT "")
if(WIN32)
set(WRAPPER_SCRIPT_EXT ".bat")
endif()
set(${src_file_NAME_WE}_CLI "${SUPERBUILD_INSTALL_DIR}/bin/otbcli_${src_file_NAME_WE}${WRAPPER_SCRIPT_EXT}")
set(${src_file_NAME_WE}_GUI "${SUPERBUILD_INSTALL_DIR}/bin/otbgui_${src_file_NAME_WE}${WRAPPER_SCRIPT_EXT}")
string(REPLACE "otbapp_" "" ${src_file_NAME_WE}_GUI ${${src_file_NAME_WE}_GUI})
string(REPLACE "otbapp_" "" ${src_file_NAME_WE}_CLI ${${src_file_NAME_WE}_CLI})
if(EXISTS "${${src_file_NAME_WE}_CLI}")
install(PROGRAMS ${${src_file_NAME_WE}_CLI} DESTINATION ${PKG_STAGE_DIR}/bin)
else()
message(FATAL_ERROR "Cannot find ${${src_file_NAME_WE}_CLI} for ${src_file_NAME_WE}")
endif()
if(EXISTS "${${src_file_NAME_WE}_GUI}")
install(PROGRAMS ${${src_file_NAME_WE}_GUI} DESTINATION ${PKG_STAGE_DIR}/bin)
else()
message(FATAL_ERROR "Cannot find ${${src_file_NAME_WE}_GUI} for ${src_file_NAME_WE}")
endif()
endif()
if(NOT SKIP_INSTALL)
install(${file_type} "${src_file}"
DESTINATION
"${PKG_STAGE_DIR}/${output_dir}"
)
endif()
endfunction()
function(install_script_files)
#For Unixes we make them in the *pkgsetup.in
##################### install environment setup file ##########################
if(WIN32)
install(
FILES
${PACKAGE_SUPPORT_FILES_DIR}/otbenv.bat
${PACKAGE_SUPPORT_FILES_DIR}/otbenv.bash
DESTINATION ${PKG_STAGE_DIR}
)
#we need startup files for mapla monteverdi in the root directory
#For Unixes, we make them inside pkgsetup script!
if(HAVE_MVD)
install(
PROGRAMS ${PACKAGE_SUPPORT_FILES_DIR}/mapla.bat
PROGRAMS ${PACKAGE_SUPPORT_FILES_DIR}/monteverdi.bat
DESTINATION "${PKG_STAGE_DIR}"
)
endif()
endif()
########################## selftest script ##############################
install(
FILES ${PACKAGE_SUPPORT_FILES_DIR}/selftester${SCRIPT_EXT}
DESTINATION ${PKG_STAGE_DIR}/bin
)
endfunction()
function(install_share_dirs)
#a convenient cmake var for storing <prefix>/bin
set(PKG_STAGE_BIN_DIR "${PKG_STAGE_DIR}/bin")
#<prefix>/share for gdal data files
set(PKG_SHARE_DEST_DIR ${PKG_STAGE_DIR}/share)
set(PKG_SHARE_SOURCE_DIR ${SUPERBUILD_INSTALL_DIR}/share)
set(GDAL_DATA_DIR ${PKG_SHARE_SOURCE_DIR}/gdal)
#MSVC install gdal-data in in a different directory. So we don't spoil it
if(MSVC)
set(GDAL_DATA_DIR ${SUPERBUILD_INSTALL_DIR}/data)
endif()
####################### install GDAL data ############################
if(NOT EXISTS "${GDAL_DATA_DIR}/epsg.wkt")
message(FATAL_ERROR
"Cannot generate package without GDAL_DATA : ${GDAL_DATA_DIR}")
endif()
func_install_without_message("${GDAL_DATA_DIR}" "share" )
####################### install GeoTIFF data ########################
func_install_without_message("${PKG_SHARE_SOURCE_DIR}/epsg_csv" "share" )
####################### install OSSIM data ##########################
func_install_without_message("${PKG_SHARE_SOURCE_DIR}/ossim" "share" )
####################### install proj share ##########################
if(EXISTS ${PKG_SHARE_SOURCE_DIR}/proj)
func_install_without_message("${PKG_SHARE_SOURCE_DIR}/proj" "share" )
endif()
####################### Install copyrights ##########################
#install license for packages
func_install_without_message("${PKG_SHARE_SOURCE_DIR}/copyright" "share" )
install(FILES ${PKG_SHARE_SOURCE_DIR}/copyright/LICENSE DESTINATION ${PKG_STAGE_DIR})
####################### Install VERSION ##########################
set(PKG_VERSION_FILE
"${SUPERBUILD_INSTALL_DIR}/share/doc/${PKG_OTB_VERSION_MAJOR}.${PKG_OTB_VERSION_MINOR}/VERSION")
if(EXISTS ${PKG_VERSION_FILE} )
install(FILES ${PKG_VERSION_FILE} DESTINATION ${PKG_STAGE_DIR})
endif()
endfunction()
function(install_translation_files)
# get all translations already distributed with qt4/
#
# These files are the "qt_<localename>.qm" files
# Qt distributes translation of common message strings used in Qt.
#We just copy these files into package.
file(GLOB QT_TRANSLATIONS_FILES ${QT_TRANSLATIONS_DIR}/qt_*)
foreach(translation_item ${QT_TRANSLATIONS_FILES})
# We need to remove the "qt_help_<localename>.qm" files from this list
if(NOT ${translation_item} MATCHES "qt_help")
install(FILES ${translation_item}
DESTINATION "${PKG_STAGE_DIR}/lib/qt4/translations")
endif()
endforeach()
# otb i18n directory is different from qt's i18N directory
#which is <prefix>/share/qt4/translations by default on linux.
# To install otb i18n directory correctly, we need to find
#Monteverdi_INSTALL_DATA_DIR. Value of this is a defined in ConfigureMonteverdi.h
# and default value is "share/OTB-6.1"
#...
# #define Monteverdi_INSTALL_DATA_DIR
#...
#Instead of parsing ConfigureMonteverdi.h,
#we simply use default and add a check for this directory!
#define Monteverdi_INSTALL_DATA_DIR "share/OTB-6.1"
set(Monteverdi_I18N_SOURCE_DIR ${SUPERBUILD_INSTALL_DIR}/share/OTB-${PKG_OTB_VERSION_MAJOR}.${PKG_OTB_VERSION_MINOR}/i18n)
set(Monteverdi_I18N_INSTALL_DIR ${PKG_STAGE_DIR}/share/OTB-${PKG_OTB_VERSION_MAJOR}.${PKG_OTB_VERSION_MINOR}/i18n)
#translation of monteverdi specific strings
if(NOT EXISTS "${Monteverdi_I18N_SOURCE_DIR}")
message(FATAL_ERROR "Error ${Monteverdi_I18N_SOURCE_DIR} not exists")
endif()
file(GLOB APP_TS_FILES ${PACKAGE_OTB_SRC_DIR}/i18n/*.ts) # qm files
foreach(APP_TS_FILE ${APP_TS_FILES})
get_filename_component(APP_TS_FILENAME ${APP_TS_FILE} NAME_WE)
install(FILES ${Monteverdi_I18N_SOURCE_DIR}/${APP_TS_FILENAME}.qm
DESTINATION ${Monteverdi_I18N_INSTALL_DIR}
)
endforeach()
endfunction()
......@@ -2,11 +2,10 @@ function(prepare_file_list PKG_PEFILES)
set(PKG_PEFILES)
#This must exist in any OTB Installation. minimal or full
#set(PKG_PEFILES "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT}")
if(NOT EXISTS "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT}")
if(NOT EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT}")
message(
FATAL_ERROR
"${OTB_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT} not found."
"${SUPERBUILD_INSTALL_DIR}/bin/otbApplicationLauncherCommandLine${EXE_EXT} not found."
)
return()
......@@ -15,29 +14,29 @@ function(prepare_file_list PKG_PEFILES)
set(PKG_PEFILES "otbApplicationLauncherCommandLine${EXE_EXT}")
set(HAVE_QT4 FALSE)
if(EXISTS "${OTB_INSTALL_DIR}/bin/otbApplicationLauncherQt${EXE_EXT}")
if(EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/otbApplicationLauncherQt${EXE_EXT}")
set(HAVE_QT4 TRUE)
list(APPEND PKG_PEFILES "otbApplicationLauncherQt${EXE_EXT}")
endif()
set(HAVE_MVD FALSE)
if(EXISTS "${OTB_INSTALL_DIR}/bin/monteverdi${EXE_EXT}")
if(EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/monteverdi${EXE_EXT}")
set(HAVE_MVD TRUE)
list(APPEND PKG_PEFILES "monteverdi${EXE_EXT}")
list(APPEND PKG_PEFILES "mapla${EXE_EXT}")
endif()
set(HAVE_PYTHON FALSE)
if(EXISTS "${OTB_INSTALL_DIR}/lib/otb/python/_otbApplication${PYMODULE_EXT}")
if(EXISTS "${SUPERBUILD_INSTALL_DIR}/lib/otb/python/_otbApplication${PYMODULE_EXT}")
list(APPEND PKG_PEFILES "_otbApplication${PYMODULE_EXT}")
set(HAVE_PYTHON TRUE)
endif()
foreach(exe_file "iceViewer" "otbTestDriver" "SharkVersion")
if(EXISTS "${OTB_INSTALL_DIR}/bin/${exe_file}${EXE_EXT}")
if(EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/${exe_file}${EXE_EXT}")
list(APPEND PKG_PEFILES "${exe_file}${EXE_EXT}")
else()
message(STATUS "${exe_file}${EXE_EXT} not found in ${OTB_INSTALL_DIR}/bin. (skipping)")
message(STATUS "${exe_file}${EXE_EXT} not found in ${SUPERBUILD_INSTALL_DIR}/bin. (skipping)")
endif()
endforeach()
......@@ -54,10 +53,10 @@ function(prepare_file_list PKG_PEFILES)
#RK: to hell with cmake targets files.
file(GLOB ALL_EXTRA_FILES
${DEPENDENCIES_INSTALL_DIR}/lib/*boost*${LIB_EXT}*
${DEPENDENCIES_INSTALL_DIR}/lib/*glut*${LIB_EXT}*
${DEPENDENCIES_INSTALL_DIR}/lib/*QtXml*${LIB_EXT}*
${DEPENDENCIES_INSTALL_DIR}/lib/*kml*${LIB_EXT}*
${SUPERBUILD_INSTALL_DIR}/lib/*boost*${LIB_EXT}*
${SUPERBUILD_INSTALL_DIR}/lib/*glut*${LIB_EXT}*
${SUPERBUILD_INSTALL_DIR}/lib/*QtXml*${LIB_EXT}*
${SUPERBUILD_INSTALL_DIR}/lib/*kml*${LIB_EXT}*
)
foreach(EXTRA_FILE ${ALL_EXTRA_FILES})
get_filename_component(EXTRA_FILE_name ${EXTRA_FILE} NAME)
......@@ -68,8 +67,8 @@ function(prepare_file_list PKG_PEFILES)
#we workaround with below code
#start hack
file(GLOB itk_all_lib_files
"${DEPENDENCIES_INSTALL_DIR}/${DEST_LIB_DIR}/${LIB_PREFIX}itk*${LIB_EXT}*"
"${DEPENDENCIES_INSTALL_DIR}/${DEST_LIB_DIR}/${LIB_PREFIX}ITK*${LIB_EXT}*"
"${SUPERBUILD_INSTALL_DIR}/${DEST_LIB_DIR}/${LIB_PREFIX}itk*${LIB_EXT}*"
"${SUPERBUILD_INSTALL_DIR}/${DEST_LIB_DIR}/${LIB_PREFIX}ITK*${LIB_EXT}*"
)
foreach(itk_lib_file ${itk_all_lib_files})
......@@ -81,7 +80,7 @@ function(prepare_file_list PKG_PEFILES)
#end hack
file(GLOB otb_test_exe_list
"${DEPENDENCIES_INSTALL_DIR}/bin/gdal*${EXE_EXT}"
"${SUPERBUILD_INSTALL_DIR}/bin/gdal*${EXE_EXT}"
"${OTB_BINARY_DIR}/bin/*Test*${EXE_EXT}"
)
foreach(otb_test_exe ${otb_test_exe_list})
......@@ -99,4 +98,4 @@ function(prepare_file_list PKG_PEFILES)
set(PKG_PEFILES ${PKG_PEFILES} PARENT_SCOPE)
endmacro()
endfunction()
......@@ -28,7 +28,7 @@ function(process_file_recurse input_file)
if(NOT is_executable)
#copy back to input_file_full_path
pkg_install_rule(${input_file_full_path})
install_rule(${input_file_full_path})
message("not is_executable ${input_file_full_path}")
return()
endif() #NOT is_executable
......@@ -48,7 +48,6 @@ function(process_file_recurse input_file)
set(not_valid FALSE)
if( "${sofile_ext}" MATCHES ".la"
OR "${sofile_ext}" MATCHES ".prl"
OR "${sofile_ext}" MATCHES ".a"
OR IS_DIRECTORY "${sofile}" )
set(not_valid TRUE)
endif()
......@@ -148,7 +147,7 @@ function(process_file_recurse input_file)
if(PKG_DEBUG)
message("${bn_name} depends on '${item}'. So we now process '${item}'") # [ ${item}_USED=${${item}_USED} ${item}_RESOLVED=${${item}_RESOLVED}]")
endif()
func_process_deps(${item})
process_file_recurse(${item})
endforeach()
endif()
......@@ -157,7 +156,8 @@ function(process_file_recurse input_file)
message("All dependencies of ${bn_name} are processed. Install file and set ${bn_name}_RESOLVED=${${bn_name}_RESOLVED}")
endif()
#Install the file with pkg_install_rule. This function has specific rules to decide wheather install file or not
pkg_install_rule(${input_file_full_path})
#Install the file with install_rule().
#This function has specific "rules" to decide wheather and where to install file
install_rule(${input_file_full_path})
endfunction() #function(func_process_deps infile)
endfunction() #function(process_file_recurse infile)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment