installer_files.cmake 3.24 KB
Newer Older
1
#thi macro calls add_uninstall_otb_script macro(another file)
2
macro(installer_files)
3 4

  #configure README from rst docs
5 6 7 8 9 10 11 12 13 14 15
  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} )

16
  #configure pkgsetup for mac and linux
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  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()

32
  #start installing script and other stuff related to package
33
  if(UNIX)
34 35 36 37 38 39 40 41 42
    install( PROGRAMS
      ${CMAKE_BINARY_DIR}/pkgsetup
      ${CMAKE_BINARY_DIR}/make_symlinks
      Files/setup_python.sh
      Files/otbenv.profile
      DESTINATION ${PKG_STAGE_DIR}
      )
  endif()

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
  # We also need wrapper script to start mapla & monteverdi
  #if(NOT HAVE_MVD)
  #  message(FATAL_ERROR "not have mvd")
  #endif()
  if(HAVE_MVD)
    install(PROGRAMS
      Files/mapla${SCRIPT_EXT}
      Files/monteverdi${SCRIPT_EXT}
      DESTINATION ${PKG_STAGE_DIR}
      )

    #for mac osx, we have a template.app which is
    # later processed in pkgsetup (macx_pkgsetup.in)
    if(APPLE)
      install(DIRECTORY Files/template.app
	DESTINATION "${PKG_STAGE_DIR}")
    endif()
  endif() #HAVE_MVD

  #my_file_ext is required for otbcli and otbgui files which has
  # no extension on linux. (hence we cannot use SCRIPT_EXT

  #For windows otbenv.bash and otbenv.bat is required.
  # Former is for windows shell users and latter is for other
  # linux emulator such as bash for windows or mobxterm
68 69 70 71 72 73 74 75 76 77
  set(my_file_ext "")
  if(WIN32)
    set(my_file_ext ".bat")
    install( PROGRAMS
      Files/otbenv.bat
      Files/otbenv.bash
      DESTINATION ${PKG_STAGE_DIR}
      )
  endif()

78 79
  #these scripts are not auto-installed in PKG_STAGE_DIR
  #could this be move them to somewhere else?
80 81 82 83
  install(PROGRAMS
    "${SUPERBUILD_INSTALL_DIR}/bin/otbcli${my_file_ext}"
    "${SUPERBUILD_INSTALL_DIR}/bin/otbgui${my_file_ext}"
    DESTINATION ${PKG_STAGE_DIR}/bin)
84

85 86
  install(PROGRAMS
    Files/selftester${SCRIPT_EXT}
87
    Files/uninstall_otb${SCRIPT_EXT}
88 89 90 91 92 93
    DESTINATION ${PKG_STAGE_DIR}/tools)

  # only required for linux.
  # THIS WILL BE REMOVED ONCE INSTALLATION IS DONE
  # USE --noexec option when running .run file to keep this file
  # along with other installation files
94
  if(LINUX)
95 96
    install(PROGRAMS
      "${PATCHELF_PROGRAM}"
97
      DESTINATION ${PKG_STAGE_DIR})
98
  endif()
99

100 101 102 103
  install(FILES
    Files/build_example.cmake
    DESTINATION ${PKG_STAGE_DIR}/tools)

104
  
105
  #add otb_loader
106 107
  add_executable(otb_loader ${CMAKE_CURRENT_SOURCE_DIR}/Files/otb_loader.cxx)
  target_link_libraries(otb_loader ${CMAKE_DL_LIBS})
108
  install(TARGETS otb_loader DESTINATION ${PKG_STAGE_DIR}/tools)
109 110
  add_dependencies(otb_loader PATCHELF)
endmacro()