Commit 58ba58b6 authored by Rashad Kanavath's avatar Rashad Kanavath

PKG: move uninstall_script to own file

parent 426a761d
function(add_uninstall_script)
file(READ "${OTB_BINARY_DIR}/install_manifest.txt" mfile_lines)
string(
REPLACE
"${CMAKE_INSTALL_PREFIX}"
"$\{MY_INSTALL_DIR}"
mfile_lines_NEW ${mfile_lines} )
file(WRITE "${CMAKE_BINARY_DIR}/install_manifest_otb.txt"
${mfile_lines_NEW})
#read cmake_uninstall.cmake.in
file(READ "${PACKAGE_OTB_SRC_DIR}/CMake/cmake_uninstall.cmake.in" cmake_uninstall_lines)
# Replace @CMAKE_INSTALL_PREFIX@ with ${MY_INSTALL_DIR}.
# The result is stored in cmake_uninstall_lines_1
string(
REPLACE
"@CMAKE_INSTALL_PREFIX@"
"$\{MY_INSTALL_DIR}"
cmake_uninstall_lines_1 ${cmake_uninstall_lines} )
# Replace @CMAKE_BINARY_DIR@ with ${MY_INSTALL_DIR}.
# The result is stored in cmake_uninstall_lines_2
# Input is 'cmake_uninstall_lines_1' created from string(REPLACE...
string(
REPLACE
"@CMAKE_BINARY_DIR@"
"$\{MY_INSTALL_DIR}"
cmake_uninstall_lines_2 ${cmake_uninstall_lines_1} )
# Replace @CMAKE_COMMAND@ with ${CMAKE_COMMAND}.
# The result is stored in cmake_uninstall_lines_NEW
# Input is 'cmake_uninstall_lines_2' created from string(REPLACE...
string(
REPLACE
"@CMAKE_COMMAND@"
"$\{CMAKE_COMMAND}"
cmake_uninstall_lines_NEW ${cmake_uninstall_lines_2} )
#write cmake_uninstall_otb.cmake
file(WRITE "${CMAKE_BINARY_DIR}/cmake_uninstall_otb.cmake"
${cmake_uninstall_lines_NEW})
#install all required files to perform uninstall
install(FILES
Files/uninstall_otb${SCRIPT_EXT}
${CMAKE_BINARY_DIR}/install_manifest_otb.txt
${CMAKE_BINARY_DIR}/cmake_uninstall_otb.cmake
DESTINATION ${PKG_STAGE_DIR})
endfunction()
......@@ -57,6 +57,11 @@ macro(installer_files)
DESTINATION "${PKG_STAGE_DIR}"
)
endif()
if(APPLE)
install(DIRECTORY Files/template.app
DESTINATION "${PKG_STAGE_DIR}")
endif()
install(PROGRAMS
Files/selftester${SCRIPT_EXT}
......@@ -65,61 +70,13 @@ macro(installer_files)
DESTINATION ${PKG_STAGE_DIR}/bin)
if(LINUX)
install( PROGRAMS "${PATCHELF_PROGRAM}"
install(PROGRAMS
"${PATCHELF_PROGRAM}"
DESTINATION ${PKG_STAGE_DIR})
endif()
file(READ "${OTB_BINARY_DIR}/install_manifest.txt" mfile_lines)
string(
REPLACE
"${CMAKE_INSTALL_PREFIX}"
"$\{MY_INSTALL_DIR}"
mfile_lines_NEW ${mfile_lines} )
file(WRITE "${CMAKE_BINARY_DIR}/install_manifest_otb.txt"
${mfile_lines_NEW})
#read cmake_uninstall.cmake.in
file(READ "${PACKAGE_OTB_SRC_DIR}/CMake/cmake_uninstall.cmake.in" cmake_uninstall_lines)
# Replace @CMAKE_INSTALL_PREFIX@ with ${MY_INSTALL_DIR}.
# The result is stored in cmake_uninstall_lines_1
string(
REPLACE
"@CMAKE_INSTALL_PREFIX@"
"$\{MY_INSTALL_DIR}"
cmake_uninstall_lines_1 ${cmake_uninstall_lines} )
# Replace @CMAKE_BINARY_DIR@ with ${MY_INSTALL_DIR}.
# The result is stored in cmake_uninstall_lines_2
# Input is 'cmake_uninstall_lines_1' created from string(REPLACE...
string(
REPLACE
"@CMAKE_BINARY_DIR@"
"$\{MY_INSTALL_DIR}"
cmake_uninstall_lines_2 ${cmake_uninstall_lines_1} )
# Replace @CMAKE_COMMAND@ with ${CMAKE_COMMAND}.
# The result is stored in cmake_uninstall_lines_NEW
# Input is 'cmake_uninstall_lines_2' created from string(REPLACE...
string(
REPLACE
"@CMAKE_COMMAND@"
"$\{CMAKE_COMMAND}"
cmake_uninstall_lines_NEW ${cmake_uninstall_lines_2} )
add_uninstall_script()
#write cmake_uninstall_otb.cmake
file(WRITE "${CMAKE_BINARY_DIR}/cmake_uninstall_otb.cmake"
${cmake_uninstall_lines_NEW})
#install all required files to perform uninstall
install(FILES
Files/uninstall_otb${SCRIPT_EXT}
${CMAKE_BINARY_DIR}/install_manifest_otb.txt
${CMAKE_BINARY_DIR}/cmake_uninstall_otb.cmake
DESTINATION ${PKG_STAGE_DIR})
#add otb_loader
add_executable(otb_loader ${CMAKE_CURRENT_SOURCE_DIR}/Files/otb_loader.cxx)
target_link_libraries(otb_loader ${CMAKE_DL_LIBS})
......
# add_test(NAME <name> COMMAND <command> [<arg>...]
# [CONFIGURATIONS <config>...]
# [WORKING_DIRECTORY <dir>])
set(testing_dir ${CMAKE_BINARY_DIR}/tests)
execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${testing_dir})
set(pkg_extracted_dir "${testing_dir}/${PKG_STAGE_DIR}")
if(WIN32)
set(extract_opts "x;${PACKAGE_OUTPUT_FILE}")
set(extract_cmd "${ZIP_EXECUTABLE}")
else()
set(extract_opts "--target;${pkg_extracted_dir}")
set(extract_cmd "${PACKAGE_OUTPUT_FILE}")
endif()
add_test(TuExtractPackage
COMMAND ${extract_cmd}
${extract_opts}
WORKING_DIRECTORY ${testing_dir}
)
add_test(TuOtbLoader
COMMAND ${pkg_extracted_dir}/bin/otb_loader
WORKING_DIRECTORY ${testing_dir}
DEPENDS
)
set_tests_properties ( TuOtbLoader PROPERTIES DEPENDS TuExtractPackage)
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