From bfb8922bfeb73cab78e61597d8800a2cf29c92f0 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Tue, 21 Sep 2021 14:58:12 +0200 Subject: [PATCH 01/17] ENH: Update Windows 10 Python to 3.8 --- CI/dev_env.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/dev_env.bat b/CI/dev_env.bat index a359aec111..71f60ad301 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\Python38-%ARCH%;%PATH% +set PATH=C:\tools\Python38-%ARCH%\Scripts;%PATH% :: Setup GL dlls set PATH=%PATH%;C:\tools\GL\%ARCH%\bin -- GitLab From 217826929bd677137165111f0967fff041aa7018 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Tue, 21 Sep 2021 16:35:19 +0200 Subject: [PATCH 02/17] ENH: Remove old windows CI files --- CI/windows-8.1-x64-vc14.20.cmake | 25 ------------------------- CI/windows-8.1-x86-vc14.20.cmake | 25 ------------------------- 2 files changed, 50 deletions(-) delete mode 100644 CI/windows-8.1-x64-vc14.20.cmake delete mode 100644 CI/windows-8.1-x86-vc14.20.cmake 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 8a25b55208..0000000000 --- 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 e2a0560568..0000000000 --- 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 -") -- GitLab From 73abd92811fbe01dcc7ea8a9c13d04cc933af919 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Wed, 22 Sep 2021 08:48:18 +0200 Subject: [PATCH 03/17] ENH: Specify python executable to point to 3.8 --- CI/dev_env.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/CI/dev_env.bat b/CI/dev_env.bat index 71f60ad301..4afbcc4325 100644 --- a/CI/dev_env.bat +++ b/CI/dev_env.bat @@ -76,6 +76,7 @@ echo Home dir: %HOMEDRIVE%%HOMEPATH% :: Setup Python set PATH=C:\tools\Python38-%ARCH%;%PATH% set PATH=C:\tools\Python38-%ARCH%\Scripts;%PATH% +set PYTHON_EXECUTABLE=C:\tools\Python38\python.exe :: Setup GL dlls set PATH=%PATH%;C:\tools\GL\%ARCH%\bin -- GitLab From 7ac046fff9840d1804512d7c8ba6b0a543cc7f23 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Wed, 22 Sep 2021 10:11:07 +0200 Subject: [PATCH 04/17] BUG: Python 3.8 not found by cmake on windows --- CI/dev_env.bat | 1 - CMakeLists.txt | 29 ++++++++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CI/dev_env.bat b/CI/dev_env.bat index 4afbcc4325..71f60ad301 100644 --- a/CI/dev_env.bat +++ b/CI/dev_env.bat @@ -76,7 +76,6 @@ echo Home dir: %HOMEDRIVE%%HOMEPATH% :: Setup Python set PATH=C:\tools\Python38-%ARCH%;%PATH% set PATH=C:\tools\Python38-%ARCH%\Scripts;%PATH% -set PYTHON_EXECUTABLE=C:\tools\Python38\python.exe :: Setup GL dlls set PATH=%PATH%;C:\tools\GL\%ARCH%\bin diff --git a/CMakeLists.txt b/CMakeLists.txt index 57130ad453..67ecb38595 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,18 +103,25 @@ 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(Python3_ROOT_DIR "C:/tools/Python38-x64") + endif() + find_package( Python3 REQUIRED COMPONENTS Interpreter Development) 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. -- GitLab From e73e01bca4c055dfd69011662d6ea6164cc23ce6 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Wed, 22 Sep 2021 10:36:47 +0200 Subject: [PATCH 05/17] BUG: Python 3.8 headers are not found during build --- .../SWIG/src/python/StandaloneWrapper.in | 29 ++++++++++++------- SuperBuild/CMakeLists.txt | 27 +++++++++++------ 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in index a0b9e36291..5534fc4743 100644 --- a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in +++ b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in @@ -33,18 +33,25 @@ 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 ) +else() + if(WIN32) + set(Python3_ROOT_DIR "C:/tools/Python38-x64") + endif() + find_package( Python3 REQUIRED COMPONENTS Interpreter Development) 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) diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index e112481f9a..990b6614d3 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -361,16 +361,25 @@ 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(Python3_ROOT_DIR "C:/tools/Python38-x64") + endif() + find_package( Python3 REQUIRED COMPONENTS Interpreter Development) endif() -set (Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") -find_package ( PythonLibs ) include(External_otb) -- GitLab From f24291af88da2e052d8e357603a4e66d8e9f2137 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Wed, 22 Sep 2021 13:57:15 +0200 Subject: [PATCH 06/17] BUG: Use python_include_dirs for swig --- Modules/Wrappers/SWIG/src/python/CMakeLists.txt | 2 +- Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt index de676f7027..4649906952 100644 --- a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt @@ -18,7 +18,7 @@ # limitations under the License. # -include_directories ( ${PYTHON_INCLUDE_DIR} ) +include_directories ( ${PYTHON_INCLUDE_DIRS} ) include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}) set_source_files_properties ( ../otbApplication.i PROPERTIES CPLUSPLUS ON ) # Get target name diff --git a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in index 5534fc4743..805513bc9a 100644 --- a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in +++ b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in @@ -52,7 +52,7 @@ else() endif() find_package( Python3 REQUIRED COMPONENTS Interpreter Development) endif() -include_directories(${PYTHON_INCLUDE_DIR}) +include_directories(${PYTHON_INCLUDE_DIRS}) find_package(Numpy) if ( NUMPY_FOUND ) -- GitLab From 739a6fad7285dbafc010237abadb36ccf245d419 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Wed, 22 Sep 2021 15:27:46 +0200 Subject: [PATCH 07/17] BUG: FindPackage python has changed its return values to Python_VARIABLE instead of PYTHON_VARIABLE --- CMakeLists.txt | 8 ++++++-- Modules/Wrappers/SWIG/src/python/CMakeLists.txt | 8 ++++++-- Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in | 6 ++++-- SuperBuild/CMakeLists.txt | 8 ++++++-- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67ecb38595..10348fb566 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,7 @@ repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE) # Find python stuff # Version 3 is preferred before 2 -if(CMAKE_VERSION VERSION_LESS "3.12.0") +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} ) @@ -120,7 +120,11 @@ else() if(WIN32) set(Python3_ROOT_DIR "C:/tools/Python38-x64") endif() - find_package( Python3 REQUIRED COMPONENTS Interpreter Development) + 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}") + endif() endif() #----------------------------------------------------------------------------- diff --git a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt index 4649906952..41b9cfd908 100644 --- a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt @@ -17,8 +17,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -include_directories ( ${PYTHON_INCLUDE_DIRS} ) +if(CMAKE_VERSION VERSION_LESS 3.12.0) + include_directories ( ${PYTHON_INCLUDE_DIR} ) +else() + include_directories( ${Python_INCLUDE_DIRS} ) + set(PYTHON_LIBRARIES ${Python_LIBRARIES}) +endif() include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}) set_source_files_properties ( ../otbApplication.i PROPERTIES CPLUSPLUS ON ) # Get target name diff --git a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in index 805513bc9a..a877e340f7 100644 --- a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in +++ b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in @@ -46,13 +46,15 @@ if(CMAKE_VERSION VERSION_LESS 3.12.0) # 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(Python3_ROOT_DIR "C:/tools/Python38-x64") endif() - find_package( Python3 REQUIRED COMPONENTS Interpreter Development) + find_package( Python REQUIRED COMPONENTS Interpreter Development) + include_directories(${Python_INCLUDE_DIRS}) + set(PYTHON_LIBRARIES ${Python_LIBRARIES}) endif() -include_directories(${PYTHON_INCLUDE_DIRS}) find_package(Numpy) if ( NUMPY_FOUND ) diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index 990b6614d3..6a5e4f3782 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -376,9 +376,13 @@ if(CMAKE_VERSION VERSION_LESS 3.12.0) find_package ( PythonLibs ) else() if(WIN32) - set(Python3_ROOT_DIR "C:/tools/Python38-x64") + set(Python_ROOT_DIR "C:/tools/Python38-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}") endif() - find_package( Python3 REQUIRED COMPONENTS Interpreter Development) endif() include(External_otb) -- GitLab From 4515b12cf5daaee9414ba130ec74915d5b90a745 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Wed, 22 Sep 2021 15:40:28 +0200 Subject: [PATCH 08/17] BUG: PYTHON_VERSION_STRING is now Python_VERSION --- Modules/Wrappers/SWIG/src/python/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt index 41b9cfd908..f19e098f24 100644 --- a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt @@ -22,6 +22,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12.0) else() include_directories( ${Python_INCLUDE_DIRS} ) set(PYTHON_LIBRARIES ${Python_LIBRARIES}) + set(PYTHON_VERSION_STRING ${Python_VERSION}) endif() include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}) set_source_files_properties ( ../otbApplication.i PROPERTIES CPLUSPLUS ON ) -- GitLab From 653b44bc5978f4198e1b9de6b5668b1d18004e73 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Wed, 22 Sep 2021 16:56:30 +0200 Subject: [PATCH 09/17] BUG: Python executable variable was not set in swig --- CMakeLists.txt | 6 ++++++ Modules/Wrappers/SWIG/src/python/CMakeLists.txt | 2 -- SuperBuild/CMakeLists.txt | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10348fb566..ed81c11e1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,6 +124,12 @@ else() 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() diff --git a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt index f19e098f24..ce45f280a9 100644 --- a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt @@ -21,8 +21,6 @@ if(CMAKE_VERSION VERSION_LESS 3.12.0) include_directories ( ${PYTHON_INCLUDE_DIR} ) else() include_directories( ${Python_INCLUDE_DIRS} ) - set(PYTHON_LIBRARIES ${Python_LIBRARIES}) - set(PYTHON_VERSION_STRING ${Python_VERSION}) endif() include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}) set_source_files_properties ( ../otbApplication.i PROPERTIES CPLUSPLUS ON ) diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index 6a5e4f3782..7ad4bd5b7d 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -382,6 +382,12 @@ else() 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() -- GitLab From ff8a5ceb83609e15d3ee859dd150b91155a09331 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Wed, 22 Sep 2021 18:55:28 +0200 Subject: [PATCH 10/17] BUG: Fix a typo on Windows Python detection --- CMakeLists.txt | 2 +- Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed81c11e1c..44d8829aa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12.0) find_package ( PythonLibs ) else() if(WIN32) - set(Python3_ROOT_DIR "C:/tools/Python38-x64") + set(Python_ROOT_DIR "C:/tools/Python38-x64") endif() find_package(Python REQUIRED COMPONENTS Interpreter Development) if(Python_FOUND) diff --git a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in index a877e340f7..1551422aa1 100644 --- a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in +++ b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in @@ -49,7 +49,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12.0) include_directories(${PYTHON_INCLUDE_DIR}) else() if(WIN32) - set(Python3_ROOT_DIR "C:/tools/Python38-x64") + set(Python_ROOT_DIR "C:/tools/Python38-x64") endif() find_package( Python REQUIRED COMPONENTS Interpreter Development) include_directories(${Python_INCLUDE_DIRS}) -- GitLab From ff320b80b665656c4c7b941d3dd82e5e5a4fdd2a Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Thu, 23 Sep 2021 10:43:29 +0200 Subject: [PATCH 11/17] BUG: Swig application name prefix is deprecated since cmake 3.13 --- Modules/Wrappers/SWIG/src/python/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt index ce45f280a9..74205b0e26 100644 --- a/Modules/Wrappers/SWIG/src/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/src/python/CMakeLists.txt @@ -26,11 +26,9 @@ 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}) -- GitLab From fe3989cd1a77eb5fd7c070be7ed681d8f423c70f Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Mon, 4 Oct 2021 14:33:05 +0200 Subject: [PATCH 12/17] BUG: Try to build wrapping with python 3.7 for windows --- CI/dev_env.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/dev_env.bat b/CI/dev_env.bat index 71f60ad301..91a5823311 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\Python38-%ARCH%;%PATH% -set PATH=C:\tools\Python38-%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 -- GitLab From e2c9094dfc17710adc62fcee54360ccc24579fd0 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Mon, 4 Oct 2021 15:07:24 +0200 Subject: [PATCH 13/17] BUG: modify Python_root_dir to point to 3.7 --- CI/dev_env.bat | 2 +- CMakeLists.txt | 2 +- Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in | 2 +- SuperBuild/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CI/dev_env.bat b/CI/dev_env.bat index 91a5823311..d4656791af 100644 --- a/CI/dev_env.bat +++ b/CI/dev_env.bat @@ -74,7 +74,7 @@ if "%TARGET%"=="10" ( echo Home dir: %HOMEDRIVE%%HOMEPATH% :: Setup Python -set PATH=C:\tools\Python37%ARCH%;%PATH% +set PATH=C:\tools\Python37-%ARCH%;%PATH% set PATH=C:\tools\Python37-%ARCH%\Scripts;%PATH% :: Setup GL dlls diff --git a/CMakeLists.txt b/CMakeLists.txt index 44d8829aa9..8de9aae78e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12.0) find_package ( PythonLibs ) else() if(WIN32) - set(Python_ROOT_DIR "C:/tools/Python38-x64") + set(Python_ROOT_DIR "C:/tools/Python37-x64") endif() find_package(Python REQUIRED COMPONENTS Interpreter Development) if(Python_FOUND) diff --git a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in index 1551422aa1..2613d00752 100644 --- a/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in +++ b/Modules/Wrappers/SWIG/src/python/StandaloneWrapper.in @@ -49,7 +49,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12.0) include_directories(${PYTHON_INCLUDE_DIR}) else() if(WIN32) - set(Python_ROOT_DIR "C:/tools/Python38-x64") + set(Python_ROOT_DIR "C:/tools/Python37-x64") endif() find_package( Python REQUIRED COMPONENTS Interpreter Development) include_directories(${Python_INCLUDE_DIRS}) diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index 7ad4bd5b7d..d86264cdc3 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -376,7 +376,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12.0) find_package ( PythonLibs ) else() if(WIN32) - set(Python_ROOT_DIR "C:/tools/Python38-x64") + set(Python_ROOT_DIR "C:/tools/Python37-x64") endif() find_package( Python REQUIRED COMPONENTS Interpreter Development) if(Python_FOUND) -- GitLab From b5b7cff53b1a9cb53e384af50ddd35eb07f03d14 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Tue, 5 Oct 2021 14:03:54 +0200 Subject: [PATCH 14/17] DOC: Update documentation to mention python 3.8 instead of 3.5 --- Documentation/Cookbook/rst/Installation_Linux.rst | 8 ++++---- Documentation/Cookbook/rst/Installation_Windows.rst | 3 ++- Packaging/Files/setup_python.sh | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Documentation/Cookbook/rst/Installation_Linux.rst b/Documentation/Cookbook/rst/Installation_Linux.rst index b9da9e25da..61b6b03d2f 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 f5acd106a1..188ba33bf5 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/Packaging/Files/setup_python.sh b/Packaging/Files/setup_python.sh index 416f6903fd..4e8c780ed7 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." -- GitLab From 40ec79068233c08836531999d2abc9af63f2cfd6 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Tue, 5 Oct 2021 18:01:27 +0200 Subject: [PATCH 15/17] BUG: On ubuntu, python3.8 generates a warning causing ctest failure --- CMake/CTestCustom.cmake.in | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index 4b7f814d28..60345b7632 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: -- GitLab From 1597403079434aa39b1278c1cdabf639061555b3 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Thu, 7 Oct 2021 14:53:08 +0200 Subject: [PATCH 16/17] BUG: With python3.8 a warning appears when building cookbook --- Documentation/Cookbook/rst/conf.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/Cookbook/rst/conf.py.in b/Documentation/Cookbook/rst/conf.py.in index a72cbb47c5..c9443aa5fd 100644 --- a/Documentation/Cookbook/rst/conf.py.in +++ b/Documentation/Cookbook/rst/conf.py.in @@ -25,7 +25,7 @@ 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_css_file("css/otb_theme.css") app.add_javascript("js/versions.js") # -- General configuration ------------------------------------------------ -- GitLab From 4c7054808c1139279db3f7533b60856ca542d747 Mon Sep 17 00:00:00 2001 From: Thibaut ROMAIN Date: Thu, 7 Oct 2021 16:49:58 +0200 Subject: [PATCH 17/17] BUG: Remove old sphinx syntax --- Documentation/Cookbook/CMakeLists.txt | 2 +- Documentation/Cookbook/rst/conf.py.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/Cookbook/CMakeLists.txt b/Documentation/Cookbook/CMakeLists.txt index ae504c7993..4bd1f02f4d 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/conf.py.in b/Documentation/Cookbook/rst/conf.py.in index c9443aa5fd..2cdf2b4624 100644 --- a/Documentation/Cookbook/rst/conf.py.in +++ b/Documentation/Cookbook/rst/conf.py.in @@ -26,7 +26,7 @@ import sphinx_rtd_theme # taken from https://stackoverflow.com/a/43186995/5815110 def setup(app): app.add_css_file("css/otb_theme.css") - app.add_javascript("js/versions.js") + app.add_js_file("js/versions.js") # -- General configuration ------------------------------------------------ -- GitLab