install_python_bindings.cmake 1.94 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 21 22 23
function(install_python_bindings)
  if(HAVE_PYTHON)
    install(DIRECTORY ${SUPERBUILD_INSTALL_DIR}/lib/otb/python
      DESTINATION ${PKG_STAGE_DIR}/lib
24
      PATTERN "*.pyc" EXCLUDE
Guillaume Pasero's avatar
Guillaume Pasero committed
25 26
      PATTERN "__pycache__" EXCLUDE
      )
27 28 29
    install(DIRECTORY ${SUPERBUILD_INSTALL_DIR}/share/otb/swig
      DESTINATION ${PKG_STAGE_DIR}/share/otb
      )
30 31 32 33 34
    install(FILES Files/build_wrapping.cmake
            DESTINATION ${PKG_STAGE_DIR}/share/otb/swig)
    install(FILES Files/build_wrapping.md
            DESTINATION ${PKG_STAGE_DIR}/share/otb/swig
            RENAME README.md)
Guillaume Pasero's avatar
Guillaume Pasero committed
35
  endif()
36 37 38 39 40 41
  # Handle GDAL python bindings
  file(GLOB gdal_python_scripts "${SUPERBUILD_INSTALL_DIR}/bin/gdal*.py")
  foreach(_script ${gdal_python_scripts})
    install(PROGRAMS ${_script}
      DESTINATION ${PKG_STAGE_DIR}/bin)
  endforeach()
42 43
  # file(GLOB gdal_python_wrappings "${SUPERBUILD_INSTALL_DIR}/lib/python[2|3]*")
  # Do we need to get rid of gdal python 2 bindings too?
Antoine Regimbeau's avatar
Antoine Regimbeau committed
44
  file(GLOB gdal_python_wrappings "${SUPERBUILD_INSTALL_DIR}/lib/python*")
45
  foreach(_wrap ${gdal_python_wrappings})
46
    if (IS_DIRECTORY "${_wrap}")
47 48 49 50 51 52
      install(DIRECTORY ${_wrap}
        DESTINATION ${PKG_STAGE_DIR}/lib
        PATTERN "*.pyc" EXCLUDE
        PATTERN "__pycache__" EXCLUDE)
    endif()
  endforeach()
53
endfunction()