installer_files.cmake 3.39 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
  
17
  #configure pkgsetup for mac and linux
18 19 20 21 22 23 24 25 26 27 28 29 30
  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
      )
31 32 33 34

    #install icon file for .app file. Monteverdi and Mapla has same icon!
    install(FILES
      Files/Monteverdi.icns DESTINATION ${PKG_STAGE_DIR})
35 36
  endif()

37
  #start installing script and other stuff related to package
38
  if(UNIX)
39 40 41 42 43 44 45 46 47
    install( PROGRAMS
      ${CMAKE_BINARY_DIR}/pkgsetup
      ${CMAKE_BINARY_DIR}/make_symlinks
      Files/setup_python.sh
      Files/otbenv.profile
      DESTINATION ${PKG_STAGE_DIR}
      )
  endif()

48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
  # 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
73 74 75 76 77 78 79 80 81 82
  set(my_file_ext "")
  if(WIN32)
    set(my_file_ext ".bat")
    install( PROGRAMS
      Files/otbenv.bat
      Files/otbenv.bash
      DESTINATION ${PKG_STAGE_DIR}
      )
  endif()

83 84
  #these scripts are not auto-installed in PKG_STAGE_DIR
  #could this be move them to somewhere else?
85 86 87 88
  install(PROGRAMS
    "${SUPERBUILD_INSTALL_DIR}/bin/otbcli${my_file_ext}"
    "${SUPERBUILD_INSTALL_DIR}/bin/otbgui${my_file_ext}"
    DESTINATION ${PKG_STAGE_DIR}/bin)
89

90 91
  install(PROGRAMS
    Files/selftester${SCRIPT_EXT}
92
    Files/uninstall_otb${SCRIPT_EXT}
93 94 95 96 97 98
    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
99
  if(LINUX)
100 101
    install(PROGRAMS
      "${PATCHELF_PROGRAM}"
102
      DESTINATION ${PKG_STAGE_DIR})
103
  endif()
104

105 106 107 108
  install(FILES
    Files/build_example.cmake
    DESTINATION ${PKG_STAGE_DIR}/tools)

109
  
110
  #add otb_loader
111 112
  add_executable(otb_loader ${CMAKE_CURRENT_SOURCE_DIR}/Files/otb_loader.cxx)
  target_link_libraries(otb_loader ${CMAKE_DL_LIBS})
113
  install(TARGETS otb_loader DESTINATION ${PKG_STAGE_DIR}/tools)
114 115
  add_dependencies(otb_loader PATCHELF)
endmacro()