diff --git a/CI/dev_env.bat b/CI/dev_env.bat index a359aec11198207f41a6dbc177e91b0d6469fbdb..d4656791afa42d19eed86b7a4ef35c5dc8fd8f9b 100644 --- a/CI/dev_env.bat +++ b/CI/dev_env.bat @@ -74,8 +74,8 @@ if "%TARGET%"=="10" ( echo Home dir: %HOMEDRIVE%%HOMEPATH% :: Setup Python -set PATH=C:\tools\Python35-%ARCH%;%PATH% -set PATH=C:\tools\Python35-%ARCH%\Scripts;%PATH% +set PATH=C:\tools\Python37-%ARCH%;%PATH% +set PATH=C:\tools\Python37-%ARCH%\Scripts;%PATH% :: Setup GL dlls set PATH=%PATH%;C:\tools\GL\%ARCH%\bin diff --git a/CI/windows-8.1-x64-vc14.20.cmake b/CI/windows-8.1-x64-vc14.20.cmake deleted file mode 100644 index 8a25b55208d6dbe78e00e6372bc228b2e8ddf660..0000000000000000000000000000000000000000 --- a/CI/windows-8.1-x64-vc14.20.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES) -# -# 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. -# - -# Configuration options for windows-8.1-x64-vc14.0.cmake - -set(site_option -"CMAKE_CXX_FLAGS:STRING=/DTHROW_QCRITICAL=0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_ENABLE_EXTENDED_ALIGNED_STORAGE -") diff --git a/CI/windows-8.1-x86-vc14.20.cmake b/CI/windows-8.1-x86-vc14.20.cmake deleted file mode 100644 index e2a05605684eb761bc7e3dc5087ef5b342c47724..0000000000000000000000000000000000000000 --- a/CI/windows-8.1-x86-vc14.20.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES) -# -# 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. -# - -# Configuration options for windows-8.1-x86-vc14.0.cmake - -set(site_option -"CMAKE_CXX_FLAGS:STRING=/DTHROW_QCRITICAL=0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_ENABLE_EXTENDED_ALIGNED_STORAGE -") diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index 710573aa41a84d5f79402e312afcde7fc1120583..f9ea5ec4da1df52d56b258894955290c241a66bf 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -38,12 +38,9 @@ #---------------------------------------------------------------------- set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000) +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 300) set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50) -if(NOT DEFINED CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS) - set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 300) -endif() - set(CTEST_CUSTOM_COVERAGE_EXCLUDE ${CTEST_CUSTOM_COVERAGE_EXCLUDE} @@ -84,6 +81,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION ".*gdal_priv.h.*[Ww]arning.*" ".*cpl_string.h.*[Ww]arning.*" ".*ogr_feature.h.*[Ww]arning.*" + ".*abstract.h.*warning.*" # Ignore clang's summary warning, assuming prior text has matched some # other warning expression: diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b77fbfcadc376468e443bb2f74d2f88e67e8549..7253c157e953cb1640d496346a4e1637ab1d2b4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,18 +103,35 @@ repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE) # Find python stuff # Version 3 is preferred before 2 -set ( Python_ADDITIONAL_VERSIONS "3;2" ) -set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) -set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) -find_package( PythonInterp ) -if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) ) - message (WARNING "Python3 not found. There is no longer support of \ - wrapping in python2 in OTB, but it can still be used.") +if(CMAKE_VERSION VERSION_LESS 3.12.0) + set ( Python_ADDITIONAL_VERSIONS "3;2" ) + set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) + set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) + find_package( PythonInterp ) + if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) ) + message (WARNING "Python3 not found. There is no longer support of \ + wrapping in python2 in OTB, but it can still be used.") + endif() + # Now that we have a python version the addditional versions should only + # contain the version we have to get the corresponding libs + set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") + find_package ( PythonLibs ) +else() + if(WIN32) + set(Python_ROOT_DIR "C:/tools/Python37-x64") + endif() + find_package(Python REQUIRED COMPONENTS Interpreter Development) + if(Python_FOUND) + message(STATUS "Python Library directory : ${Python_LIBRARY_DIRS}") + message(STATUS "Python Headers directory : ${Python_INCLUDE_DIRS}") + #For compatibility reason, we have to define these variables + set(PYTHON_LIBRARIES ${Python_LIBRARIES}) + set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS}) + set(PYTHON_LIBRARY_DIR ${Python_LIBRARY_DIRS}) + set(PYTHON_VERSION_STRING ${Python_VERSION}) + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) + endif() endif() -# Now that we have a python version the addditional versions should only -# contain the version we have to get the corresponding libs -set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") -find_package ( PythonLibs ) #----------------------------------------------------------------------------- # Configure the default OTB_DATA_ROOT for the location of OTB Data. diff --git a/Documentation/Cookbook/CMakeLists.txt b/Documentation/Cookbook/CMakeLists.txt index ae504c79938f74817bf2e1925dfd44f15ce37f53..4bd1f02f4d974c508c44b4ae9451034b76a3751a 100644 --- a/Documentation/Cookbook/CMakeLists.txt +++ b/Documentation/Cookbook/CMakeLists.txt @@ -31,7 +31,7 @@ message(STATUS "") message(STATUS "Configuring Cookbook...") # Check we have python bindings with python 3+ -if (NOT OTB_WRAP_PYTHON OR ${PYTHONLIBS_VERSION_STRING} STRLESS "3.0.0") +if (NOT OTB_WRAP_PYTHON) message(FATAL_ERROR "CookBook build requires Python 3 wrappers. Try setting OTB_WRAP_PYTHON=ON in the CMake configuration, or disable the CookBook with BUILD_COOKBOOK=OFF.") endif() diff --git a/Documentation/Cookbook/rst/Installation_Linux.rst b/Documentation/Cookbook/rst/Installation_Linux.rst index b9da9e25da9ca606f43ce3d8630b0f4a29e04f17..61b6b03d2f631c90ee62d38ae8f04d7f1867ffde 100644 --- a/Documentation/Cookbook/rst/Installation_Linux.rst +++ b/Documentation/Cookbook/rst/Installation_Linux.rst @@ -84,8 +84,8 @@ necessary to install one of the following packages: Python bindings ~~~~~~~~~~~~~~~ -Since OTB 6.7.0 OTB bindings for Python 3.5 are distributed as a binary -package. +Since OTB 8.0.0 OTB bindings for Python 3.8 are distributed as a binary +package. (From OTB 6.7 to 7.4, bindings are provided for Python 3.5) Please note that using a different Python version may not be compatible with OTB wrappings. If the installation completes without issue, information relating to your Python bindings will be provided. @@ -94,12 +94,12 @@ You must have Python NumPy bindings installed in your system. They can be instal without admin rights as follows: "pip install --user numpy". This is to give users the option to select their own existing Python installation rather than the one dibstributed by the OTB package. -By default, bindings for Python 3.5 will be enabled with the ``otbenv`` script. +By default, bindings for Python 3.8 will be enabled with the ``otbenv`` script. Recompiling Python bindings +++++++++++++++++++++++++++ -If you are using another version of Python 3 than 3.5, but still want to use OTB Python bindings, it is possible +If you are using another version of Python 3 than 3.8, but still want to use OTB Python bindings, it is possible to compile the python bindings again with your version of Python. CMake is required (it is available in most package managers or at [https://cmake.org/]). At the root of the OTB installation run : diff --git a/Documentation/Cookbook/rst/Installation_Windows.rst b/Documentation/Cookbook/rst/Installation_Windows.rst index f5acd106a187b0c6feeb6be2afae803c58d1d85c..188ba33bf54a41fa12f19dc34d1ef84b8fc6b597 100644 --- a/Documentation/Cookbook/rst/Installation_Windows.rst +++ b/Documentation/Cookbook/rst/Installation_Windows.rst @@ -51,6 +51,7 @@ Python bindings Since OTB 6.7.0 OTB bindings for Python 3.5 are distributed as a binary package. +Since OTB 8.0.0, the bindings for Python 3.7 are distributed Please note that using a different Python version may not be compatible with OTB wrappings. If the installation completes without issue, information relating to your Python bindings will be provided. @@ -59,5 +60,5 @@ You must have Python numpy bindings installed in your system. They can be instal without admin rights as follows: "pip install --user numpy". This is to give users the option to select their own existing Python installation rather than the one dibstributed by the OTB package. -By default, bindings for Python 3.5 will be enabled with the ``otbenv`` script. +By default, bindings for Python 3.7 will be enabled with the ``otbenv`` script. diff --git a/Documentation/Cookbook/rst/conf.py.in b/Documentation/Cookbook/rst/conf.py.in index a72cbb47c5154be2c64d23b3c5c7e1013b3dff3d..2cdf2b46243ff890ce814c01c38fcbee63069642 100644 --- a/Documentation/Cookbook/rst/conf.py.in +++ b/Documentation/Cookbook/rst/conf.py.in @@ -25,8 +25,8 @@ import sphinx_rtd_theme # and a custom version selection widget # taken from https://stackoverflow.com/a/43186995/5815110 def setup(app): - app.add_stylesheet("css/otb_theme.css") - app.add_javascript("js/versions.js") + app.add_css_file("css/otb_theme.css") + app.add_js_file("js/versions.js") # -- General configuration ------------------------------------------------ diff --git a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt index de676f70272dadc3fd7b5678f675560cd89d437c..74205b0e26966957b17feda65e4aedd67139ed9e 100644 --- a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt @@ -17,17 +17,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -include_directories ( ${PYTHON_INCLUDE_DIR} ) +if(CMAKE_VERSION VERSION_LESS 3.12.0) + include_directories ( ${PYTHON_INCLUDE_DIR} ) +else() + include_directories( ${Python_INCLUDE_DIRS} ) +endif() include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}) set_source_files_properties ( ../otbApplication.i PROPERTIES CPLUSPLUS ON ) # Get target name set(extension_target _otbApplication) -if(POLICY CMP0078) - cmake_policy(GET CMP0078 swig_target_name_policy) - if (swig_target_name_policy STREQUAL "NEW") - set(extension_target otbApplication) - endif() +if(CMAKE_VERSION VERSION_GREATER 3.13.0) + #UseSwig now defaults its target name to the name of the .i file + set(extension_target otbApplication) endif() # Run swig set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_GLOBAL_FLAGS}) diff --git a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in index a0b9e362917c8aa87c0552b3e8076bad27006385..2613d00752c909d41c0b5de9927adfd6363d7306 100644 --- a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in +++ b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in @@ -33,19 +33,28 @@ find_package(OTB REQUIRED HINTS ${PKG_PREFIX}/@OTB_INSTALL_PACKAGE_DIR@) list(APPEND CMAKE_MODULE_PATH ${OTB_CMAKE_DIR}) include(${OTB_USE_FILE}) -set ( Python_ADDITIONAL_VERSIONS "3;2" ) -set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) -set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) -find_package( PythonInterp ) -if ( OTB_WRAP_PYTHON AND ( ${PYTHON_VERSION_MAJOR} EQUAL 2 ) ) - message (WARNING "Python3 not found. There is no longer support of \ - wrapping in python2 in OTB, but it can still be used.") +if(CMAKE_VERSION VERSION_LESS 3.12.0) + set ( Python_ADDITIONAL_VERSIONS "3;2" ) + set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) + set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) + find_package( PythonInterp ) + if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) ) + message (WARNING "Python3 not found. There is no longer support of \ + wrapping in python2 in OTB, but it can still be used.") + endif() + # Now that we have a python version the addditional versions should only + # contain the version we have to get the corresponding libs + set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") + find_package ( PythonLibs ) + include_directories(${PYTHON_INCLUDE_DIR}) +else() + if(WIN32) + set(Python_ROOT_DIR "C:/tools/Python37-x64") + endif() + find_package( Python REQUIRED COMPONENTS Interpreter Development) + include_directories(${Python_INCLUDE_DIRS}) + set(PYTHON_LIBRARIES ${Python_LIBRARIES}) endif() -# Now that we have a python version the addditional versions should only -# contain the version we have to get the corresponding libs -set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") -find_package ( PythonLibs ) -include_directories(${PYTHON_INCLUDE_DIR}) find_package(Numpy) if ( NUMPY_FOUND ) diff --git a/Packaging/Files/setup_python.sh b/Packaging/Files/setup_python.sh index 416f6903fdf82219dec85cef9d1093e5a7e166ee..4e8c780ed77390aa9a5f20fdbd5ac629970fd271 100755 --- a/Packaging/Files/setup_python.sh +++ b/Packaging/Files/setup_python.sh @@ -29,9 +29,9 @@ python_version_check() { python_check_failed() { printf %s\\n "*****Error occurred during installation******" - printf %s\\n "OTB python bindings normally require python 3.5 but current \ + printf %s\\n "OTB python bindings normally require python 3.8 (or 3.7 for windows users) but current \ detected python version is $python_version" - printf %s\\n "If you have python 3.5 installed in your system you should \ + printf %s\\n "If you have python 3.8 (or 3.7 for win users) installed in your system you should \ set OTB_PYTHON_EXE and re-run this installation script." printf %s\\n "eg: OTB_PYTHON_EXE=/path/to/python3 ./OTB-X.Y-Linux64.run" printf %s\\n "Python bindings might not work." diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index 86a4cee21704a602b2af8f0e23e31c8872bede7b..8e5e51308d4072147ed55ef8996227db20d19d19 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -359,16 +359,35 @@ configure_file(${CMAKE_SOURCE_DIR}/CMake/CTestCustom.cmake.in # -PYTHON_EXECUTABLE # -PYTHON_INCLUDE_DIR # -PYTHON_LIBRARY -set ( Python_ADDITIONAL_VERSIONS "3;2" ) -set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) -set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) -find_package( PythonInterp ) -if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) ) - message (WARNING "Python3 not found. There is no longer support of \ - wrapping in python2 in OTB, but it can still be used.") +if(CMAKE_VERSION VERSION_LESS 3.12.0) + set ( Python_ADDITIONAL_VERSIONS "3;2" ) + set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) + set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} ) + find_package( PythonInterp ) + if ( OTB_WRAP_PYTHON AND ( "x${PYTHON_VERSION_MAJOR}" STREQUAL "x2" ) ) + message (WARNING "Python3 not found. There is no longer support of \ + wrapping in python2 in OTB, but it can still be used.") + endif() + # Now that we have a python version the addditional versions should only + # contain the version we have to get the corresponding libs + set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") + find_package ( PythonLibs ) +else() + if(WIN32) + set(Python_ROOT_DIR "C:/tools/Python37-x64") + endif() + find_package( Python REQUIRED COMPONENTS Interpreter Development) + if(Python_FOUND) + message(STATUS "Python Library directory : ${Python_LIBRARY_DIRS}") + message(STATUS "Python Headers directory : ${Python_INCLUDE_DIRS}") + #For compatibility reason, we have to define these variables + set(PYTHON_LIBRARIES ${Python_LIBRARIES}) + set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS}) + set(PYTHON_LIBRARY_DIR ${Python_LIBRARY_DIRS}) + set(PYTHON_VERSION_STRING ${Python_VERSION}) + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) + endif() endif() -set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") -find_package ( PythonLibs ) include(External_otb)