Commit 56095f59 authored by Rashad Kanavath's avatar Rashad Kanavath

ENH: run cleanup on running package

parent d1a19bd7
...@@ -136,6 +136,7 @@ include(install_rule) ...@@ -136,6 +136,7 @@ include(install_rule)
include(isfile_symlink) include(isfile_symlink)
include(detect_using_file_command) include(detect_using_file_command)
include(install_otbapp_wrapper_scripts) include(install_otbapp_wrapper_scripts)
include(cleanup_package)
# below functions include many install commands which are installing # below functions include many install commands which are installing
# files under PKG_STAGE_DIR # files under PKG_STAGE_DIR
...@@ -153,13 +154,22 @@ include(create_package) ...@@ -153,13 +154,22 @@ include(create_package)
configure_loader(LOADER_PROGRAM LOADER_ARGS LOADER_REGEX) configure_loader(LOADER_PROGRAM LOADER_ARGS LOADER_REGEX)
# creation of package is different from windows and unix like
# WE KEEP THIS VARIABLE HERE BECAUSE IT IS USED IN
# cleanup_package, create_package, testing.cmake
# and check_cmake_variables
# THIS IS JUST TO AVOID DUPLICATION
if(WIN32)
set(PACKAGE_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PKG_STAGE_DIR}.zip")
else()
set(PACKAGE_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PKG_STAGE_DIR}.run")
endif()
check_cmake_variables() check_cmake_variables()
message(STATUS "Empty package staging directory: ${CMAKE_INSTALL_PREFIX}/${PKG_STAGE_DIR}") cleanup_package()
execute_process(COMMAND
${CMAKE_COMMAND} -E remove_directory
"${CMAKE_INSTALL_PREFIX}/${PKG_STAGE_DIR}"
)
set(HAVE_QT4 FALSE CACHE INTERNAL "HAVE_QT4") set(HAVE_QT4 FALSE CACHE INTERNAL "HAVE_QT4")
if(EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/otbApplicationLauncherQt${EXE_EXT}") if(EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/otbApplicationLauncherQt${EXE_EXT}")
...@@ -176,8 +186,10 @@ if(EXISTS "${SUPERBUILD_INSTALL_DIR}/lib/otb/python/_otbApplication${PYMODULE_EX ...@@ -176,8 +186,10 @@ if(EXISTS "${SUPERBUILD_INSTALL_DIR}/lib/otb/python/_otbApplication${PYMODULE_EX
set(HAVE_PYTHON TRUE) set(HAVE_PYTHON TRUE)
endif() endif()
#only for *nix #only for *nix
file(WRITE ${CMAKE_BINARY_DIR}/make_symlinks "#!/bin/sh\n") if(UNIX)
file(WRITE ${CMAKE_BINARY_DIR}/make_symlinks "#!/bin/sh\n")
endif()
#remove all *_USED|*_RESOLVED variables from CMakeCache.txt #remove all *_USED|*_RESOLVED variables from CMakeCache.txt
clear_cmakecache_variables() clear_cmakecache_variables()
...@@ -210,13 +222,6 @@ install_vstudio_files() ...@@ -210,13 +222,6 @@ install_vstudio_files()
installer_files() installer_files()
# creation of package is different from windows and unix like
if(WIN32)
set(PACKAGE_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PKG_STAGE_DIR}.zip")
else()
set(PACKAGE_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PKG_STAGE_DIR}.run")
endif()
create_package() create_package()
if(BUILD_TESTING) if(BUILD_TESTING)
......
...@@ -47,6 +47,7 @@ macro(check_cmake_variables) ...@@ -47,6 +47,7 @@ macro(check_cmake_variables)
LOADER_REGEX LOADER_REGEX
PKG_ITK_SB_VERSION PKG_ITK_SB_VERSION
PKG_OTB_VERSION_STRING PKG_OTB_VERSION_STRING
PACKAGE_OUTPUT_FILE
) )
if(NOT DEFINED ${req} OR "${${req}}" STREQUAL "") if(NOT DEFINED ${req} OR "${${req}}" STREQUAL "")
message(FATAL_ERROR "you must set ${req}") message(FATAL_ERROR "you must set ${req}")
......
message(STATUS "Empty package staging directory: ${CMAKE_INSTALL_PREFIX}/${PKG_STAGE_DIR}")
execute_process(COMMAND
g ${CMAKE_COMMAND} -E remove_directory
"${CMAKE_INSTALL_PREFIX}/${PKG_STAGE_DIR}"
)
message(STATUS "Remove PACKAGE_OUTPUT_FILE: ${PACKAGE_OUTPUT_FILE}")
execute_process(COMMAND
${CMAKE_COMMAND} -E remove -f "${PACKAGE_OUTPUT_FILE}"
)
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