Skip to content
Snippets Groups Projects
Commit 9797de13 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

PKG: also install a ctest script and README

parent b700e216
No related branches found
No related tags found
No related merge requests found
#
# Copyright (C) 2005-2019 CS Systemes d'Information (CS SI)
#
# 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.
#
cmake_minimum_required(VERSION 3.10.1)
project(OTBPythonWrappers)
......
#
# Copyright (C) 2005-2019 CS Systemes d'Information (CS SI)
#
# 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.
#
get_filename_component(PKG_PREFIX "${CTEST_SCRIPT_DIRECTORY}" PATH)
get_filename_component(PKG_PREFIX "${PKG_PREFIX}" PATH)
get_filename_component(PKG_PREFIX "${PKG_PREFIX}" PATH)
set(CTEST_SOURCE_DIRECTORY ${CTEST_SCRIPT_DIRECTORY})
set(CTEST_BINARY_DIRECTORY ${CTEST_SCRIPT_DIRECTORY}/build)
if(WIN32)
set(CTEST_CMAKE_GENERATOR "NMake Makefiles")
else()
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
endif()
set(CTEST_BUILD_CONFIGURATION "Release")
if(IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
file(REMOVE_RECURSE "${CTEST_BINARY_DIRECTORY}")
endif()
set(CONFIGURE_OPTIONS
"-DCMAKE_INSTALL_PREFIX=${PKG_PREFIX}"
"-DCMAKE_BUILD_TYPE=Release")
if(PYTHON_EXECUTABLE)
list(APPEND CONFIGURE_OPTIONS "-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}")
endif()
ctest_start(Experimental)
ctest_configure(OPTIONS "${CONFIGURE_OPTIONS}")
ctest_build(TARGET install)
# How to recompile OTB Python bindings with your Python version?
The OTB Python bindings are made of:
* a Python module `otbApplication.py`
* a Python C++ extension `_otbApplication.so` (or `_otbApplication.pyd` on Windows)
The Python module should be independent from the Python version you are using,
but the compiled C++ extension is linked to a specific Python library. If this
library is not present on your system, you can recompile the extension to use
your Python version.
The procedure is simple, once you have the following prerequisite:
* A C++ compiler:
* On Linux: GCC >= 5.0
* On macos: XCode
* On Windows: either Visual Studio >= 2015 with the desktop C++ workload,
or just the MSVC Build Tools.
* CMake >= 3.10
* Python library and headers for your Python version
* On macos and Windows: they are usually supplied with installers from
official website
* On Linux packages: you should look for a `python-dev` package matching
your Python interpreter version.
* Numpy module for your Python version
The compilation and installation of the C++ extension can be launched from the
command line (on Windows you can use `cmd.exe`):
```
ctest -S build_wrapping.cmake
```
If you want to use a specific Python interpreter:
```
ctest -DPYTHON_EXECUTABLE=/my/own/python -S build_wrapping.cmake
```
Note: on Windows, you have to setup MSVC compiler before calling `ctest`. Use
the `vcvarsall.bat` script with the right architecture (x32 or x64). For
instance:
```
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
```
......@@ -27,6 +27,11 @@ function(install_python_bindings)
install(DIRECTORY ${SUPERBUILD_INSTALL_DIR}/share/otb/swig
DESTINATION ${PKG_STAGE_DIR}/share/otb
)
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)
endif()
# Handle GDAL python bindings
file(GLOB gdal_python_scripts "${SUPERBUILD_INSTALL_DIR}/bin/gdal*.py")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment