Commit 622eaffc authored by Guillaume Pasero's avatar Guillaume Pasero

REFAC: remove specific Monteverdi variables

parent 14d02be3
......@@ -8,15 +8,25 @@ if(NOT PROJECT_NAME)
cmake_minimum_required(VERSION 2.6)
include(CMakeParseArguments)
project(OTBPackaging)
option(GENERATE_PACKAGE "Generate OTB package" OFF)
option(GENERATE_XDK "Generate XDK for OTB development" OFF)
endif()
option(GENERATE_PACKAGE "Generate OTB package" OFF)
option(GENERATE_XDK "Generate XDK for OTB development" OFF)
if(PROJECT_NAME STREQUAL "OTB-SuperBuild")
if(NOT OTB_SOURCE_DIR)
get_filename_component(OTB_SOURCE_DIR ${OTB-SuperBuild_SOURCE_DIR} PATH)
endif()
endif()
set(OUT_OF_SOURCE_BUILD FALSE)
if(PROJECT_NAME STREQUAL "OTBPackaging")
set(OUT_OF_SOURCE_BUILD TRUE)
set(GENERATE_PACKAGE ON)
if(NOT OTB_SOURCE_DIR)
get_filename_component(OTB_SOURCE_DIR ${OTBPackaging_SOURCE_DIR} PATH)
get_filename_component(OTB_SOURCE_DIR ${OTB_SOURCE_DIR} PATH)
endif()
endif()
if(NOT GENERATE_PACKAGE AND NOT GENERATE_XDK)
......@@ -28,11 +38,13 @@ if(WIN32 AND NOT MSVC)
if(NOT MXE_TARGET_DIR)
message(FATAL_ERROR "you must set MXE_TARGET_DIR")
endif()
if(NOT OTB_SOURCE_DIR)
message(FATAL_ERROR "you must set OTB_SOURCE_DIR")
endif()
endif()
if(NOT OTB_SOURCE_DIR)
message(FATAL_ERROR "you must set OTB_SOURCE_DIR")
endif()
set(SUPERBUILD_SOURCE_DIR ${OTB_SOURCE_DIR}/SuperBuild)
include(${CMAKE_CURRENT_SOURCE_DIR}/PMacros.cmake)
if(OUT_OF_SOURCE_BUILD)
......@@ -40,10 +52,8 @@ if(OUT_OF_SOURCE_BUILD)
include(CTest)
endif()
if(WIN32 AND NOT MSVC)
set(Monteverdi_SOURCE_DIR "" CACHE PATH "monteverdi source directory")
set(Monteverdi_BINARY_DIR "" CACHE PATH "monteverdi binary directory")
set(MONTEVERDI_INSTALL_DIR "" CACHE PATH "monteverdi install directory")
set(OTB_INSTALL_DIR "" CACHE PATH "otb install directory")
set(OTB_BINARY_DIR "" CACHE PATH "OTB binary directory")
set(OTB_INSTALL_DIR "" CACHE PATH "OTB install directory")
else()
set(SUPERBUILD_BINARY_DIR "" CACHE PATH "path to superbuild binary directory")
set(SUPERBUILD_INSTALL_DIR "" CACHE PATH "path to superbuild install directory")
......@@ -56,17 +66,15 @@ else(OUT_OF_SOURCE_BUILD)
# if doing packages from source tree.
set( SUPERBUILD_BINARY_DIR ${CMAKE_BINARY_DIR} )
set( SUPERBUILD_INSTALL_DIR ${SB_INSTALL_PREFIX} )
if(WIN32 AND NOT MSVC)
set(MONTEVERDI_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
get_filename_component(OTB_INSTALL_DIR ${OTB_MODULES_DIR} PATH)
get_filename_component(OTB_INSTALL_DIR ${OTB_INSTALL_DIR} PATH)
get_filename_component(OTB_INSTALL_DIR ${OTB_INSTALL_DIR} PATH)
get_filename_component(OTB_INSTALL_DIR ${OTB_INSTALL_DIR} PATH)
endif()
set( OTB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
#if(WIN32 AND NOT MSVC)
#get_filename_component(OTB_INSTALL_DIR ${OTB_MODULES_DIR} PATH)
#get_filename_component(OTB_INSTALL_DIR ${OTB_INSTALL_DIR} PATH)
#get_filename_component(OTB_INSTALL_DIR ${OTB_INSTALL_DIR} PATH)
#get_filename_component(OTB_INSTALL_DIR ${OTB_INSTALL_DIR} PATH)
#endif()
endif(OUT_OF_SOURCE_BUILD)
get_filename_component(SUPERBUILD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PATH)
get_filename_component(OTB_SOURCE_DIR ${SUPERBUILD_SOURCE_DIR} PATH)
if(WIN32)
......@@ -79,9 +87,8 @@ endif()
if(WIN32 AND NOT MSVC)
foreach(req
Monteverdi_SOURCE_DIR
Monteverdi_BINARY_DIR
MONTEVERDI_INSTALL_DIR
OTB_SOURCE_DIR
OTB_BINARY_DIR
OTB_INSTALL_DIR
)
if(NOT DEFINED ${req} OR "${${req}}" STREQUAL "")
......@@ -106,7 +113,7 @@ endif()
set(EXTRA_CACHE_CONFIG)
if(WIN32 AND NOT MSVC)
set(CMAKE_INSTALL_PREFIX "${MONTEVERDI_INSTALL_DIR}")
set(CMAKE_INSTALL_PREFIX "${OTB_INSTALL_DIR}")
else()
set(CMAKE_INSTALL_PREFIX "${SUPERBUILD_INSTALL_DIR}")
endif()
......@@ -156,17 +163,13 @@ else()
endif() #WIN32 AND NOT MSVC
if(WIN32 AND NOT MSVC)
set(Monteverdi_SOURCE_DIR "${Monteverdi_SOURCE_DIR}")
set(Monteverdi_BINARY_DIR "${Monteverdi_BINARY_DIR}")
set(MONTEVERDI_INSTALL_DIR "${MONTEVERDI_INSTALL_DIR}")
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")
set(QT_PLUGINS_DIR "${DEPENDENCIES_INSTALL_DIR}/qt/plugins")
set(QT_TRANSLATIONS_DIR "${DEPENDENCIES_INSTALL_DIR}/qt/translations")
else() #unixes
set(Monteverdi_SOURCE_DIR "${SUPERBUILD_BINARY_DIR}/MVD/src/MVD")
set(Monteverdi_BINARY_DIR "${SUPERBUILD_BINARY_DIR}/MVD/build")
set(MONTEVERDI_INSTALL_DIR "${SUPERBUILD_INSTALL_DIR}")
set(OTB_BINARY_DIR "${SUPERBUILD_BINARY_DIR}/OTB/build")
set(OTB_INSTALL_DIR "${SUPERBUILD_INSTALL_DIR}")
set(DEPENDENCIES_INSTALL_DIR "${SUPERBUILD_INSTALL_DIR}")
set(QT_PLUGINS_DIR "${SUPERBUILD_INSTALL_DIR}/plugins")
......
......@@ -28,14 +28,13 @@ macro(macro_setup_cmake_project pkg)
include(CMakeParseArguments)
include(CMakeDetermineSystem)
set(CMAKE_BUILD_TYPE Release)
set(Monteverdi_SOURCE_DIR \"${Monteverdi_SOURCE_DIR}\")
set(Monteverdi_BINARY_DIR \"${Monteverdi_BINARY_DIR}\")
set(MONTEVERDI_INSTALL_DIR \"${MONTEVERDI_INSTALL_DIR}\")
set(Monteverdi_INSTALL_DATA_DIR \"share/otb\")
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(QT_PLUGINS_DIR \"${QT_PLUGINS_DIR}\")
set(QT_TRANSLATIONS_DIR \"${QT_TRANSLATIONS_DIR}\")
set(DEPENDENCIES_INSTALL_DIR \"${DEPENDENCIES_INSTALL_DIR}\")
set(OTB_INSTALL_DIR \"${OTB_INSTALL_DIR}\")
set(PACKAGE_SUPPORT_FILES_DIR \"${OTB_SOURCE_DIR}/SuperBuild/Packaging/Files\")
set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")
set(ITK_VERSION_STRING \"${ITK_VERSION_STRING}\")
......@@ -55,7 +54,7 @@ macro(macro_create_targets_for_package pkg)
if(WIN32 AND NOT MSVC)
add_custom_target(PACKAGE-${pkg}-check
COMMAND ${CMAKE_COMMAND} --build "." --target install
WORKING_DIRECTORY "${Monteverdi_BINARY_DIR}"
WORKING_DIRECTORY "${OTB_BINARY_DIR}"
)
else() #Using SuperBuild
#For out of source build,
......@@ -64,19 +63,11 @@ macro(macro_create_targets_for_package pkg)
add_custom_target(PACKAGE-${pkg}-check
COMMAND ${CMAKE_COMMAND} -E echo "Building PACKAGE-${pkg}-check")
else(OUT_OF_SOURCE_BUILD)
if(ENABLE_MONTEVERDI)
add_custom_target(PACKAGE-${pkg}-check
COMMAND ${CMAKE_COMMAND} -E echo "Building PACKAGE-${pkg}-check"
DEPENDS MVD
WORKING_DIRECTORY ${SUPERBUILD_BINARY_DIR}
)
else(ENABLE_MONTEVERDI)
add_custom_target(PACKAGE-${pkg}-check
COMMAND ${CMAKE_COMMAND} -E echo "Building PACKAGE-${pkg}-check"
DEPENDS OTB
WORKING_DIRECTORY ${SUPERBUILD_BINARY_DIR}
)
endif(ENABLE_MONTEVERDI)
add_custom_target(PACKAGE-${pkg}-check
COMMAND ${CMAKE_COMMAND} -E echo "Building PACKAGE-${pkg}-check"
DEPENDS OTB
WORKING_DIRECTORY ${SUPERBUILD_BINARY_DIR}
)
endif(OUT_OF_SOURCE_BUILD)
endif()
......@@ -190,4 +181,4 @@ macro(get_version input_file match_string check_cmake_var)
else()
message(FATAL_ERROR "macro(get_version): File '${input_file}' does not exists")
endif()
endmacro()
\ No newline at end of file
endmacro()
......@@ -61,21 +61,25 @@ macro(macro_super_package)
else() #unixes
list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/lib") #so
list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/lib") #superbuild .so /.dylib
list(APPEND PKG_SEARCHDIRS "${MONTEVERDI_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 "${DEPENDENCIES_INSTALL_DIR}/bin") #superbuild, mxe binaries
list(APPEND PKG_SEARCHDIRS "${MONTEVERDI_INSTALL_DIR}/bin") #monteverdi, mapla
list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/bin") #otbApplicationLauncherCommandLine..
list(APPEND PKG_SEARCHDIRS "${OTB_APPLICATIONS_DIR}") #otb apps
list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/lib/otb/python") #otbApplication.py
set(EXE_SEARCHDIRS ${OTB_INSTALL_DIR}/bin)
list(APPEND EXE_SEARCHDIRS ${MONTEVERDI_INSTALL_DIR}/bin)
list(APPEND EXE_SEARCHDIRS ${DEPENDENCIES_INSTALL_DIR}/bin)
# detect OTB version major and minor
file(GLOB _installed_otb_ver ${OTB_INSTALL_DIR}/lib/cmake/OTB-*)
list(SORT _installed_otb_ver)
list(GET _installed_otb_ver -1 _latest_installed_otb_ver)
get_filename_component(OTB_LATEST_MAJOR_MINOR ${_latest_installed_otb_ver} NAME)
message(STATUS "Latest OTB found : ${OTB_LATEST_MAJOR_MINOR}")
macro_empty_package_staging_directory()
set(PKG_PEFILES)
......@@ -327,7 +331,6 @@ function(func_install_support_files)
OTB_APPLICATIONS_DIR
PKG_STAGE_DIR
PACKAGE_SUPPORT_FILES_DIR
MONTEVERDI_INSTALL_DIR
OTB_INSTALL_DIR
)
if(NOT DEFINED ${req})
......@@ -342,7 +345,7 @@ function(func_install_support_files)
func_install_otb_support_files()
#check if monteverdi executable is built?
if(EXISTS "${MONTEVERDI_INSTALL_DIR}/bin/monteverdi${EXE_EXT}")
if(EXISTS "${OTB_INSTALL_DIR}/bin/monteverdi${EXE_EXT}")
func_install_monteverdi_support_files()
endif()
......@@ -375,11 +378,9 @@ function(func_install_support_files)
endif()
####################### Install VERSION ##########################
file(GLOB OTB_VERSION_FILES ${OTB_INSTALL_DIR}/share/doc/OTB-*/VERSION)
if(OTB_VERSION_FILES)
list(SORT OTB_VERSION_FILES)
list(GET OTB_VERSION_FILES -1 OTB_LATEST_VERSION_FILE)
install(FILES ${OTB_LATEST_VERSION_FILE} DESTINATION ${PKG_STAGE_DIR})
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})
endif()
endfunction()
......@@ -388,7 +389,6 @@ function(func_install_otb_support_files)
foreach(req
PKG_STAGE_DIR
OTB_INSTALL_DIR
MONTEVERDI_INSTALL_DIR
DEPENDENCIES_INSTALL_DIR
OTB_APPLICATIONS_DIR
)
......@@ -471,11 +471,11 @@ function(func_install_monteverdi_support_files)
#<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}/${Monteverdi_INSTALL_DATA_DIR}/i18n")
set(PKG_OTB_I18N_DIR "${PKG_STAGE_DIR}/${OTB_INSTALL_DATA_DIR}/i18n")
# Just check if required variables are defined.
foreach(req
Monteverdi_SOURCE_DIR
OTB_SOURCE_DIR
PACKAGE_SUPPORT_FILES_DIR
QT_PLUGINS_DIR
PKG_STAGE_BIN_DIR
......@@ -516,23 +516,20 @@ function(func_install_monteverdi_support_files)
install(FILES ${QT_TRANSLATIONS_FILES} DESTINATION ${PKG_I18N_DIR})
#translation of monteverdi specific strings
file(GLOB APP_TS_FILES ${Monteverdi_SOURCE_DIR}/i18n/*.ts) # qm files
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")
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 ${Monteverdi_BINARY_DIR}/i18n/${APP_TS_FILENAME}.qm
install(FILES ${OTB_INSTALL_DIR}/share/${OTB_LATEST_MAJOR_MINOR}/i18n/${APP_TS_FILENAME}.qm
DESTINATION ${PKG_OTB_I18N_DIR}
)
endforeach()
#set(PKG_OTB_ccSHARE_SOURCE_DIR "${MONTEVERDI_INSTALL_DIR}")
# if(WIN32)
# set(PKG_OTB_ccSHARE_SOURCE_DIR "${MONTEVERDI_INSTALL_DIR}/share")
# endif()
if(NOT EXISTS "${MONTEVERDI_INSTALL_DIR}/share/otb/i18n")
message(FATAL_ERROR "error ${MONTEVERDI_INSTALL_DIR}/share/otb/i18n not exists")
endif()
####################### install otb share ###########################
install(DIRECTORY ${MONTEVERDI_INSTALL_DIR}/share/otb DESTINATION ${PKG_SHARE_DEST_DIR})
#install(DIRECTORY ${OTB_INSTALL_DIR}/share/${OTB_LATEST_MAJOR_MINOR}/i18n DESTINATION ${PKG_SHARE_DEST_DIR}/otb)
endfunction()
......
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