diff --git a/SuperBuild/CMake/External_package.cmake b/SuperBuild/CMake/External_package.cmake deleted file mode 100644 index 7194c131a898355b0cefe6271dec843dc61383af..0000000000000000000000000000000000000000 --- a/SuperBuild/CMake/External_package.cmake +++ /dev/null @@ -1,82 +0,0 @@ - -message(STATUS "Setup OTB Packaging...") - -set(PACKAGE_VERSION) - -if(EXISTS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt") - file(STRINGS "${CMAKE_SOURCE_DIR}/../CMakeLists.txt" _otb_version_vars REGEX "set\\\(OTB_VERSION_") - file(WRITE ${CMAKE_BINARY_DIR}/CMakeFiles/version_vars.cmake "#OTB version\n") - foreach(_otb_version_var ${_otb_version_vars}) - file(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/version_vars.cmake "${_otb_version_var}\n") - endforeach() - include(${CMAKE_BINARY_DIR}/CMakeFiles/version_vars.cmake) - if(OTB_VERSION_STRING) - set(PACKAGE_VERSION ${OTB_VERSION_STRING}) - else() - message(FATAL_ERROR "Packaging: Cannot find OTB_VERSION_STRING!") - endif() -else() - message(FATAL_ERROR "Packaging: File '${CMAKE_SOURCE_DIR}/../CMakeLists.txt' does not exists") -endif() - -set(PACKAGE_NAME OTB) -set(PACKAGE_LONG_NAME OrfeoToolBox) - -if(UNIX) - if(APPLE) - set(PACKAGE_PLATFORM_NAME "Darwin") - else() - set(PACKAGE_PLATFORM_NAME "Linux") - endif() -endif() -set(PACKAGE_ARCH 32) -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(PACKAGE_ARCH 64) -endif() - -set(ARCHIVE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) - -set(MAKESELF_SCRIPT ${CMAKE_BINARY_DIR}/PACKAGE-OTB/build/makeself.sh) - -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/PACKAGE-OTB/build") - -include(${CMAKE_SOURCE_DIR}/CMake/External_pkgtools.cmake) - -file(WRITE "${CMAKE_BINARY_DIR}/PACKAGE-OTB/src/PACKAGE-OTB/CMakeLists.txt" - "cmake_minimum_required(VERSION 2.6) - include(CMakeParseArguments) - set(CMAKE_INSTALL_PREFIX \"${SB_INSTALL_PREFIX}\") - set(DOWNLOAD_LOCATION \"${DOWNLOAD_LOCATION}\") - 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}\") - include(\"${CMAKE_SOURCE_DIR}/CMake/Package_Macro.cmake\") - include(\"${CMAKE_SOURCE_DIR}/CMake/PackageHelper.cmake\") - superbuild_package( - STAGE_DIR \"${ARCHIVE_NAME}\" - SEARCHDIRS \"\")") - - add_custom_target(PACKAGE-OTB-configure - COMMAND ${CMAKE_COMMAND} - "${CMAKE_BINARY_DIR}/PACKAGE-OTB/src/PACKAGE-OTB" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/PACKAGE-OTB/build" - DEPENDS PACKAGE_TOOLS OTB) - - add_custom_target(PACKAGE-OTB-build - COMMAND ${CMAKE_COMMAND} - "--build" "${CMAKE_BINARY_DIR}/PACKAGE-OTB/build" "--target" "install" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/PACKAGE-OTB/build" - DEPENDS PACKAGE-OTB-configure) - - add_custom_target(PACKAGE-OTB - COMMAND ${MAKESELF_SCRIPT} "--target" "${ARCHIVE_NAME}" "${SB_INSTALL_PREFIX}/${ARCHIVE_NAME}" "${ARCHIVE_NAME}.run" "${PACKAGE_LONG_NAME} ${PACKAGE_VERSION}" "./pkgsetup" - DEPENDS PACKAGE-OTB-build) - - add_custom_target(PACKAGE-OTB-clean - COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_BINARY_DIR}/PACKAGE-OTB" - COMMAND ${CMAKE_COMMAND} -E remove "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.run" - COMMAND ${CMAKE_COMMAND} "${CMAKE_BINARY_DIR}" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" ) diff --git a/SuperBuild/Packaging/CMakeLists.txt b/SuperBuild/Packaging/CMakeLists.txt index e807c023a5e3ec2432a2a2c431d53c02b11d90c2..13aa2208731a23f5c01df5e8ce0203fb1d553817 100644 --- a/SuperBuild/Packaging/CMakeLists.txt +++ b/SuperBuild/Packaging/CMakeLists.txt @@ -154,17 +154,26 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(PACKAGE_PLATFORM_NAME "Linux") endif() -if(WIN32 AND NOT MSVC) - set(ITK_VERSION_STRING) - set(PACKAGE_VERSION_STRING ${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}) -else() - get_version("${SUPERBUILD_SOURCE_DIR}/CMake/External_itk.cmake" "ITK_SB_VERSION" ITK_SB_VERSION) - set(ITK_VERSION_STRING "${get_version_ITK_SB_VERSION}") - get_version("${OTB_SOURCE_DIR}/CMakeLists.txt" "OTB_VERSION_" OTB_VERSION_STRING) - set(PACKAGE_VERSION_STRING ${get_version_OTB_VERSION_STRING}) -endif() #WIN32 AND NOT MSVC +#get itk version from External_itk.cmake if not on mingw +if(NOT MINGW) + get_version( + INPUT_FILE "${SUPERBUILD_SOURCE_DIR}/CMake/External_itk.cmake" + MATCH_STRINGS "ITK_SB_VERSION" + PREFIX PKG + ) +endif() -if(WIN32 AND NOT MSVC) +#get version of OTB from source_dir/CMakeLists.txt +get_version( + INPUT_FILE "${OTB_SOURCE_DIR}/CMakeLists.txt" + MATCH_STRINGS "OTB_VERSION_MAJOR" "OTB_VERSION_MINOR" "OTB_VERSION_PATCH" + PREFIX PKG + ) + +set(PKG_OTB_VERSION_STRING + ${PKG_OTB_VERSION_MAJOR}.${PKG_OTB_VERSION_MINOR}.${PKG_OTB_VERSION_PATCH}) + +if(MINGW) set(OTB_BINARY_DIR "${OTB_BINARY_DIR}") set(OTB_INSTALL_DIR "${OTB_INSTALL_DIR}") set(DEPENDENCIES_INSTALL_DIR "${MXE_MXEROOT}/usr/${MXE_ARCH}-w64-mingw32.shared") diff --git a/SuperBuild/Packaging/Files/linux_pkgsetup.in b/SuperBuild/Packaging/Files/linux_pkgsetup.in index 4a23ffbce14aa070f0ec4a99b83b95efa065d7df..1ae5013d5d61c841566601c74e57b560c0d07e7b 100644 --- a/SuperBuild/Packaging/Files/linux_pkgsetup.in +++ b/SuperBuild/Packaging/Files/linux_pkgsetup.in @@ -29,9 +29,9 @@ done I_AM_XDK=@IS_XDK@ if [ "$I_AM_XDK" = true ] ; then - $SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/Modules/ITKZLIB.cmake - $SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKConfig.cmake - $SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKTargets-release.cmake + $SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/Modules/ITKZLIB.cmake + $SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKConfig.cmake + $SED -i "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKTargets-release.cmake else $CAT > $OUT_DIR/monteverdi.sh << EOF @@ -147,8 +147,8 @@ else printf %s\\n "eg: ln -s /usr/lib/x86_64-linux-gnu/$python_INSTSONAME $OUT_DIR/lib/$python_INSTALLED_SONAME" fi -# PACKAGE_VERSION_STRING=@PACKAGE_VERSION_STRING@ -$SED -i "s,|release|,@PACKAGE_VERSION_STRING@,g" $OUT_DIR/README +# PKG_OTB_VERSION_STRING=@PKG_OTB_VERSION_STRING@ +$SED -i "s,|release|,@PKG_OTB_VERSION_STRING@,g" $OUT_DIR/README $RM -fr $OUT_DIR/tools diff --git a/SuperBuild/Packaging/Files/macx_pkgsetup.in b/SuperBuild/Packaging/Files/macx_pkgsetup.in index 1dfbb94a6f18f98b667595d97e35169e28048be6..231a821f8c7df1d21cae0bf053b27a09cb0d4ac9 100755 --- a/SuperBuild/Packaging/Files/macx_pkgsetup.in +++ b/SuperBuild/Packaging/Files/macx_pkgsetup.in @@ -42,9 +42,9 @@ I_AM_XDK=@IS_XDK@ if [ "$I_AM_XDK" = true ] ; then - $SED -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/Modules/ITKZLIB.cmake - $SED -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKConfig.cmake - $SED -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@ITK_VERSION_STRING@/ITKTargets-release.cmake + $SED -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/Modules/ITKZLIB.cmake + $SED -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKConfig.cmake + $SED -i "" "s,@DEPENDENCIES_INSTALL_DIR@,$OUT_DIR,g" lib/cmake/ITK-@PKG_ITK_SB_VERSION@/ITKTargets-release.cmake else $RM -fr Mapla.app diff --git a/SuperBuild/Packaging/PMacros.cmake b/SuperBuild/Packaging/PMacros.cmake index a0f0af4f3a871b01460f5dbc98bd4ba8e3c657b5..e4cba7ffb1ce6c065aa9fce0490b56950e282af5 100644 --- a/SuperBuild/Packaging/PMacros.cmake +++ b/SuperBuild/Packaging/PMacros.cmake @@ -10,9 +10,9 @@ macro(macro_setup_cmake_project pkg) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${PACKAGE_PROJECT_DIR}/build") if("${pkg}" STREQUAL "XDK") - set(archive_name ${PACKAGE_NAME}-${PACKAGE_VERSION_STRING}-xdk-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) + set(archive_name ${PACKAGE_NAME}-${PKG_OTB_VERSION_STRING}-xdk-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) else() - set(archive_name ${PACKAGE_NAME}-${PACKAGE_VERSION_STRING}-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) + set(archive_name ${PACKAGE_NAME}-${PKG_OTB_VERSION_STRING}-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) endif() if("${pkg}" STREQUAL "XDK") @@ -21,6 +21,29 @@ macro(macro_setup_cmake_project pkg) set(PKG_GENERATE_XDK OFF) endif() + set(ConfigureMonteverdi_H ${OTB_BINARY_DIR}/Modules/Visualization/MonteverdiCore/ConfigureMonteverdi.h) + if(NOT EXISTS ${ConfigureMonteverdi_H}) + message(FATAL_ERROR "${ConfigureMonteverdi_H} does not exists. Cannot continue") + endif() + + file(STRINGS "${ConfigureMonteverdi_H}" ConfigureMonteverdi_H_CONTENTS REGEX "^#define.Monteverdi_INSTALL_DATA_DIR") + string(REGEX REPLACE + "^#define.Monteverdi_INSTALL_DATA_DIR" "" + ConfigureMonteverdi_H_CONTENTS + ${ConfigureMonteverdi_H_CONTENTS} ) + + if(NOT ConfigureMonteverdi_H_CONTENTS) + message(FATAL_ERROR "parse error in ${ConfigureMonteverdi_H}. Cannot continue") + endif() + + string(REGEX REPLACE "\"" "" PKG_OTB_INSTALL_DATA_DIR "${ConfigureMonteverdi_H_CONTENTS}") + + if(NOT PKG_OTB_INSTALL_DATA_DIR) + message(FATAL_ERROR "parse error in ${ConfigureMonteverdi_H_CONTENTS}. Cannot continue") + endif() + + string(STRIP "${PKG_OTB_INSTALL_DATA_DIR}" PKG_OTB_INSTALL_DATA_DIR) + #set archive name inside loop file(WRITE "${PACKAGE_PROJECT_DIR}/src/CMakeLists.txt" "cmake_minimum_required(VERSION 3.2) @@ -30,19 +53,23 @@ macro(macro_setup_cmake_project pkg) set(OTB_SOURCE_DIR \"${OTB_SOURCE_DIR}\") set(OTB_BINARY_DIR \"${OTB_BINARY_DIR}\") set(OTB_INSTALL_DIR \"${OTB_INSTALL_DIR}\") - set(OTB_INSTALL_DATA_DIR \"share/otb\") + set(OTB_INSTALL_DATA_DIR \"${PKG_OTB_INSTALL_DATA_DIR}\") set(QT_PLUGINS_DIR \"${QT_PLUGINS_DIR}\") set(QT_TRANSLATIONS_DIR \"${QT_TRANSLATIONS_DIR}\") set(DEPENDENCIES_INSTALL_DIR \"${DEPENDENCIES_INSTALL_DIR}\") set(PACKAGE_SUPPORT_FILES_DIR \"${OTB_SOURCE_DIR}/SuperBuild/Packaging/Files\") - set(PACKAGE_VERSION_STRING \"${PACKAGE_VERSION_STRING}\") + set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\") - set(ITK_VERSION_STRING \"${ITK_VERSION_STRING}\") + set(PKG_ITK_SB_VERSION \"${PKG_ITK_SB_VERSION}\") + set(PKG_OTB_VERSION_MAJOR \"${PKG_OTB_VERSION_MAJOR}\") + set(PKG_OTB_VERSION_MINOR \"${PKG_OTB_VERSION_MINOR}\") + set(PKG_OTB_VERSION_PATCH \"${PKG_OTB_VERSION_PATCH}\") + set(PKG_OTB_VERSION_STRING \"${PKG_OTB_VERSION_STRING}\") set(PKG_GENERATE_XDK ${PKG_GENERATE_XDK}) set(PATCHELF_PROGRAM ${PATCHELF_PROGRAM}) set(PYTHON_EXECUTABLE \"${PYTHON_EXECUTABLE}\") ${EXTRA_CACHE_CONFIG} - include(\"${SUPERBUILD_SOURCE_DIR}/Packaging/PackageHelper.cmake\") + include(${SUPERBUILD_SOURCE_DIR}/Packaging/PackageHelper.cmake) macro_super_package(STAGE_DIR \"${archive_name}\")" ) @@ -99,9 +126,9 @@ macro(macro_create_targets_for_package pkg) set(PACKAGE_PROJECT_DIR ${CMAKE_BINARY_DIR}/PACKAGE-${pkg}) if("${pkg}" STREQUAL "XDK") - set(archive_name ${PACKAGE_NAME}-${PACKAGE_VERSION_STRING}-xdk-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) + set(archive_name ${PACKAGE_NAME}-${PKG_OTB_VERSION_STRING}-xdk-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) else() - set(archive_name ${PACKAGE_NAME}-${PACKAGE_VERSION_STRING}-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) + set(archive_name ${PACKAGE_NAME}-${PKG_OTB_VERSION_STRING}-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) endif() #configure @@ -140,7 +167,7 @@ macro(macro_create_targets_for_package pkg) "${archive_name}" "${CMAKE_INSTALL_PREFIX}/${archive_name}" "${archive_name}.run" - "${PACKAGE_LONG_NAME} ${PACKAGE_VERSION_STRING}" + "${PACKAGE_LONG_NAME} ${PKG_OTB_VERSION_STRING}" "./pkgsetup" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS PACKAGE-${pkg}-build @@ -165,36 +192,53 @@ macro(macro_create_targets_for_package pkg) endmacro(macro_create_targets_for_package) -#macro: get_version -#args : - # input_file - Input cmake file where the version variable is set via cmake set() command. - # Example: ${SUPERBUILD_SOURCE_DIR}/CMake/External_itk.cmake - #match_string - A match string to filter out required set() commands. - # Example: "ITK_SB_VERSION" will get all set(ITK_SB_VERSION_MAJOR) - # set(ITK_SB_VERSION_MINOR) set(ITK_SB_VERSION_PATCH) - # cmake_var_to_check - Name of variable that has the version string stored using set(..) - # command inside the input_file. - # Example: ITK_SB_VERSION. This is same as match_string but not always - # Sample usage: - # get_version( - # "${SUPERBUILD_SOURCE_DIR}/CMake/External_itk.cmake" - # "ITK_SB_VERSION" - # ITK_SB_VERSION) -macro(get_version input_file match_string check_cmake_var) - if(EXISTS "${input_file}") - file(STRINGS "${input_file}" _version_vars REGEX "set\\\(${match_string}") - set(temp_file_name "${CMAKE_BINARY_DIR}/CMakeFiles/version_vars_${match_string}.cmake") - file(WRITE "${temp_file_name}" "#version\n") - foreach(_version_var ${_version_vars}) - file(APPEND "${temp_file_name}" "${_version_var}\n") - endforeach() - include("${temp_file_name}") - if(${check_cmake_var}) - set(get_version_${check_cmake_var} "${${check_cmake_var}}") - else() - message(FATAL_ERROR "macro(get_version): Cannot find ${check_cmake_var}!") - endif() - else() - message(FATAL_ERROR "macro(get_version): File '${input_file}' does not exists") +# macro: get_version +# args : +# INPUT_FILE - Input cmake file where the version variable is set via cmake set() command. +# +# MATCH_STRINGS - list of cmake variables that are set in INPUT_FILE. +# - eg: set(OTB_VERSION_MAJOR "5") or set(OTB_VERSION_PATCH 85) +# - It works on both qouted and non-quoted values. +# +# PREFIX - optional prefix string where you need to have the output stored +# +# Sample usage: +# +# get_version( +# "INPUT_FILE ${SUPERBUILD_SOURCE_DIR}/../CMakeLists.txt" +# "MATCH_STRING OTB_VERSION_MAJOR, OTB_VERSION_MINOR" +# PREFIX PKG) +# The above call will search set(OTB_VERSION_MAJOR [0-9]) and set(OTB_VERSION_MINOR [0-9]) +# in the file CMakeLists.txt and if a match is found, it store the value of set command +# into a variable PKG_OTB_VERSION_MAJOR. Note that PKG is the prefix we given. If no +# prefix is set, it uses get_version. so the result variables will be +# get_version_OTB_VERSION_MAJOR and get_version_OTB_VERSION_MINOR + +macro(get_version) + cmake_parse_arguments(gv "" "INPUT_FILE;PREFIX" "MATCH_STRINGS" ${ARGN} ) + + if(NOT EXISTS "${gv_INPUT_FILE}") + message(FATAL_ERROR "macro(get_version): File '${gv_INPUT_FILE}' does not exists") endif() + + if(NOT gv_PREFIX) + set(gv_PREFIX "get_version") + endif() + + file(STRINGS "${gv_INPUT_FILE}" gv_INPUT_FILE_CONTENTS) + foreach(gv_match_string ${gv_MATCH_STRINGS}) + foreach(gv_line ${gv_INPUT_FILE_CONTENTS}) + string(REGEX MATCH "^set.${gv_match_string}\\ .*[0-9].*\\\)$" matched "${gv_line}") + if(matched) + string(REGEX REPLACE "^set.${gv_match_string}." "" gv_output_string "${matched}") + string(REPLACE "${gv_match_string}" "${gv_match_string}" gv_output_string ${gv_output_string}) + if(gv_output_string) + string(REGEX REPLACE "\\\)$" "" gv_output_string "${gv_output_string}") + string(REGEX REPLACE "\"" "" gv_output_string "${gv_output_string}") + string(STRIP "${gv_output_string}" gv_output_string) + endif() + set(${gv_PREFIX}_${gv_match_string} "${gv_output_string}") + endif() + endforeach() + endforeach() endmacro() diff --git a/SuperBuild/Packaging/PackageHelper.cmake b/SuperBuild/Packaging/PackageHelper.cmake index 6fdd2acccea8eb36ef878ca39d8fc6202b12ed14..790c011aa36e9b43800b79bfa26a9bd62a91ec68 100644 --- a/SuperBuild/Packaging/PackageHelper.cmake +++ b/SuperBuild/Packaging/PackageHelper.cmake @@ -143,8 +143,8 @@ macro(macro_super_package) set(IS_XDK "false") if(PKG_GENERATE_XDK) set(IS_XDK "true") - if("${ITK_VERSION_STRING}" STREQUAL "") - message(FATAL_ERROR "ITK_VERSION_STRING not set. This is required for XDK") + if("${PKG_ITK_SB_VERSION}" STREQUAL "") + message(FATAL_ERROR "PKG_ITK_SB_VERSION not set. This is required for XDK") endif() #avoid OTB stuff inside pkgsetup for XDK @@ -386,18 +386,18 @@ function(func_install_support_files) install(DIRECTORY ${PKG_SHARE_SOURCE_DIR}/proj DESTINATION ${PKG_SHARE_DEST_DIR}) endif() + set(PKG_VERSION_FILE "${OTB_INSTALL_DIR}/share/doc/${PKG_OTB_VERSION_MAJOR}.${PKG_OTB_VERSION_MINOR}/VERSION") + ####################### Install copyrights ########################## - if(WIN32) - #do install license for windows package - else() + if(NOT MINGW) + #install license for windows package 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() ####################### Install VERSION ########################## - if(EXISTS ${OTB_INSTALL_DIR}/share/doc/${OTB_LATEST_MAJOR_MINOR}/VERSION) - install(FILES ${OTB_INSTALL_DIR}/share/doc/${OTB_LATEST_MAJOR_MINOR}/VERSION - DESTINATION ${PKG_STAGE_DIR}) + if(EXISTS ${PKG_VERSION_FILE} ) + install(FILES ${PKG_VERSION_FILE} DESTINATION ${PKG_STAGE_DIR}) endif() endfunction() @@ -484,11 +484,14 @@ function(func_install_monteverdi_support_files) #qt4's distributes some translation of common message string used in Qt. #This are provided with any qt installation. We reuse them in otb package #so as not to reinvent the wheels. - set(PKG_I18N_DIR "${PKG_STAGE_DIR}/lib/qt4/translations") + set(PKG_QT_TRANSLATIONS_DIR "${PKG_STAGE_DIR}/lib/qt4/translations") #<prefix>/share for otb i18n directory. This is different from qt's i18N directory #which is <prefix>/share/qt4/translations. - set(PKG_OTB_I18N_DIR "${PKG_STAGE_DIR}/${OTB_INSTALL_DATA_DIR}/i18n") + #set(PKG_xxOTB_Ixxx18N_DIR "${PKG_STAGE_DIR}/${OTB_INSTALL_DATA_DIR}/i18n") + + set(PKG_OTB_TRANSLATIONS_DIRNAME "${OTB_INSTALL_DATA_DIR}/i18n") + # Just check if required variables are defined. foreach(req @@ -498,8 +501,8 @@ function(func_install_monteverdi_support_files) PKG_STAGE_BIN_DIR PKG_QTSQLITE_FILENAME PKG_QTPLUGINS_DIR - PKG_I18N_DIR - PKG_OTB_I18N_DIR + PKG_QT_TRANSLATIONS_DIR + PKG_OTB_TRANSLATIONS_DIRNAME ) if(NOT DEFINED ${req} OR "${${req}}" STREQUAL "") message(FATAL_ERROR "you must set ${req} before calling this method") @@ -525,29 +528,27 @@ function(func_install_monteverdi_support_files) install(FILES ${QT_PLUGINS_DIR}/sqldrivers/${PKG_QTSQLITE_FILENAME} DESTINATION ${PKG_QTPLUGINS_DIR}/sqldrivers) - ####################### install translations ########################### + ####################### install qt4 translations ########################### #get all translations already distributed with qt4 get_qt_translation_files(QT_TRANSLATIONS_FILES) #install all files in ${QT_TRANSLATIONS_FILES} - install(FILES ${QT_TRANSLATIONS_FILES} DESTINATION ${PKG_I18N_DIR}) + install(FILES ${QT_TRANSLATIONS_FILES} DESTINATION ${PKG_QT_TRANSLATIONS_DIR}) + ####################### install monteverdi translations ##################### #translation of monteverdi specific strings - if(NOT EXISTS "${OTB_INSTALL_DIR}/share/${OTB_LATEST_MAJOR_MINOR}/i18n") - message(FATAL_ERROR "error ${OTB_INSTALL_DIR}/share/${OTB_LATEST_MAJOR_MINOR}/i18n not exists") + if(NOT EXISTS "${OTB_INSTALL_DIR}/${PKG_OTB_TRANSLATIONS_DIRNAME}") + message(FATAL_ERROR "Error ${OTB_INSTALL_DIR}/${PKG_OTB_TRANSLATIONS_DIRNAME} not exists") endif() + file(GLOB APP_TS_FILES ${OTB_SOURCE_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 ${OTB_INSTALL_DIR}/share/${OTB_LATEST_MAJOR_MINOR}/i18n/${APP_TS_FILENAME}.qm - DESTINATION ${PKG_OTB_I18N_DIR} + install(FILES ${OTB_INSTALL_DIR}/${PKG_OTB_TRANSLATIONS_DIRNAME}/${APP_TS_FILENAME}.qm + DESTINATION ${PKG_STAGE_DIR}/${PKG_OTB_TRANSLATIONS_DIRNAME} ) endforeach() - - ####################### install otb share ########################### - #install(DIRECTORY ${OTB_INSTALL_DIR}/share/${OTB_LATEST_MAJOR_MINOR}/i18n DESTINATION ${PKG_SHARE_DEST_DIR}/otb) - endfunction() macro(macro_empty_package_staging_directory)