opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
76.49k stars 55.64k forks source link

Switch to FindPython3 in CMake (policy 0148) #25600

Open asmorkalov opened 4 weeks ago

asmorkalov commented 4 weeks ago

System Information

Details: https://cmake.org/cmake/help/latest/policy/CMP0148.html Related Patch: https://github.com/opencv/opencv/pull/25585

Detailed description

Current approach was deprecated with CMake

Steps to reproduce

-

Issue submission checklist

FantasqueX commented 4 weeks ago

I have some questions about this issue.

  1. FindPython3 was introduced in CMake 3.12 and OpenCV's cmake_minimum_required is 3.5(3.1). So, should we keep both old FindPythonInterp and FindPythonLibs and new FindPython3?
  2. Currently, OpenCV has both Python2 and Python3 bindings. However, Python2 reached end of life on January 1, 2020 and you only mentioned FindPython3. Should we still keep Python2 binding?
asmorkalov commented 4 weeks ago
  1. Looks like, yes. We have to support both branches for now. The team investigates an option to raise minimum CMake version, but for 5.x for now.
  2. Python2 is not supported by OpenCV team any more. We do not test it regularly and do not produce opencv-python packages. So, I think we can safely drop Python2 support with latest CMake.