installer_files.cmake 4.01 KB
Newer Older
1
#
Julien Michel's avatar
Julien Michel committed
2
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#
# This file is part of Orfeo Toolbox
#
#     https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
20
macro(installer_files)
21 22

  #configure README from rst docs
23 24
  set(RSTDOC_DIR "${PACKAGE_OTB_SRC_DIR}/Documentation/Cookbook/rst")
  if(APPLE)
25
    set(README_FILE ${RSTDOC_DIR}/Installation_Macos.rst)
26
  elseif(LINUX) #not osx
27
    set(README_FILE ${RSTDOC_DIR}/Installation_Linux.rst)
28
  elseif(WIN32) #windows
29
    set(README_FILE ${RSTDOC_DIR}/Installation_Windows.rst)
30 31 32 33
  endif()
  configure_file("${README_FILE}" ${CMAKE_BINARY_DIR}/README )
  install(FILES ${CMAKE_BINARY_DIR}/README DESTINATION ${PKG_STAGE_DIR} )

34
  
35
  #configure pkgsetup for mac and linux
36 37 38 39 40 41 42 43 44 45 46 47 48
  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
      )
49 50 51 52

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

55
  #start installing script and other stuff related to package
56
  if(UNIX)
57 58 59 60 61 62 63 64 65
    install( PROGRAMS
      ${CMAKE_BINARY_DIR}/pkgsetup
      ${CMAKE_BINARY_DIR}/make_symlinks
      Files/setup_python.sh
      Files/otbenv.profile
      DESTINATION ${PKG_STAGE_DIR}
      )
  endif()

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
  # 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
91 92 93 94 95 96 97 98 99 100
  set(my_file_ext "")
  if(WIN32)
    set(my_file_ext ".bat")
    install( PROGRAMS
      Files/otbenv.bat
      Files/otbenv.bash
      DESTINATION ${PKG_STAGE_DIR}
      )
  endif()

101 102
  #these scripts are not auto-installed in PKG_STAGE_DIR
  #could this be move them to somewhere else?
103 104 105 106
  install(PROGRAMS
    "${SUPERBUILD_INSTALL_DIR}/bin/otbcli${my_file_ext}"
    "${SUPERBUILD_INSTALL_DIR}/bin/otbgui${my_file_ext}"
    DESTINATION ${PKG_STAGE_DIR}/bin)
107

108 109
  install(PROGRAMS
    Files/selftester${SCRIPT_EXT}
110
    Files/uninstall_otb${SCRIPT_EXT}
111 112 113 114 115 116
    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
117
  if(LINUX)
118 119
    install(PROGRAMS
      "${PATCHELF_PROGRAM}"
120
      DESTINATION ${PKG_STAGE_DIR})
121
  endif()
122

123
  install(FILES
124
    Files/build_examples.cmake
125 126
    DESTINATION ${PKG_STAGE_DIR}/tools)

127
  
128
  #add otb_loader
129 130
  add_executable(otb_loader ${CMAKE_CURRENT_SOURCE_DIR}/Files/otb_loader.cxx)
  target_link_libraries(otb_loader ${CMAKE_DL_LIBS})
131
  install(TARGETS otb_loader DESTINATION ${PKG_STAGE_DIR}/tools)
132 133
  add_dependencies(otb_loader PATCHELF)
endmacro()