installer_files.cmake 1.77 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
macro(installer_files)
  set(RSTDOC_DIR "${PACKAGE_OTB_SRC_DIR}/Documentation/Cookbook/rst")
  if(APPLE)
    set(README_FILE ${RSTDOC_DIR}/Installation_Macx.txt)
  elseif(LINUX) #not osx
    set(README_FILE ${RSTDOC_DIR}/Installation_Linux.txt)
  elseif(WIN32) #windows
    set(README_FILE ${RSTDOC_DIR}/Installation_Windows.txt)
  endif()
  configure_file("${README_FILE}" ${CMAKE_BINARY_DIR}/README )
  install(FILES ${CMAKE_BINARY_DIR}/README DESTINATION ${PKG_STAGE_DIR} )

  if(LINUX)
    configure_file(
      ${CMAKE_CURRENT_SOURCE_DIR}/Files/linux_pkgsetup.in
      ${CMAKE_CURRENT_BINARY_DIR}/pkgsetup @ONLY
      )
  endif()

  if(APPLE)
    set(ORIGINAL_RPATH_TO_REPLACE ${SUPERBUILD_INSTALL_DIR}/lib)
    configure_file(
      ${CMAKE_CURRENT_SOURCE_DIR}/Files/macx_pkgsetup.in
      ${CMAKE_CURRENT_BINARY_DIR}/pkgsetup @ONLY
      )
  endif()

  if(UNIX)
    install( PROGRAMS "${CMAKE_BINARY_DIR}/pkgsetup" DESTINATION ${PKG_STAGE_DIR})
    install( PROGRAMS "${CMAKE_BINARY_DIR}/make_symlinks" DESTINATION ${PKG_STAGE_DIR})
  endif()

33

34 35 36 37
  if(LINUX)
    install( PROGRAMS "${PATCHELF_PROGRAM}" DESTINATION ${PKG_STAGE_DIR})
  endif()

38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
  file(READ "${OTB_BINARY_DIR}/install_manifest.txt"  mfile_lines)
  string(
    REPLACE
    "${CMAKE_INSTALL_PREFIX}"
    "OUT_DIR"
    mfile_lines_NEW ${mfile_lines} )

  file(WRITE "${CMAKE_BINARY_DIR}/install_manifest.txt"
    ${mfile_lines_NEW})

  install(FILES "${CMAKE_BINARY_DIR}/install_manifest.txt"
    DESTINATION ${PKG_STAGE_DIR})

  install(FILES "Files/uninstall_otb.sh"
    DESTINATION ${PKG_STAGE_DIR})
53 54 55 56 57 58

  add_executable(otb_loader ${CMAKE_CURRENT_SOURCE_DIR}/Files/otb_loader.cxx)
  target_link_libraries(otb_loader ${CMAKE_DL_LIBS})
  install(TARGETS otb_loader DESTINATION ${PKG_STAGE_DIR}/bin)
  add_dependencies(otb_loader PATCHELF)
endmacro()