Downgrade LIMITED_API_VERSION, if python3 is older than 3.6.

This commit is contained in:
Alexander Smorkalov 2024-01-15 10:53:14 +03:00
parent 2791bb7062
commit 985506c251

View File

@ -295,7 +295,12 @@ find_python("${OPENCV_PYTHON3_VERSION}" "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYT
OCV_OPTION(PYTHON3_LIMITED_API "Build with Python Limited API (not available with numpy >=1.15 <1.17)" NO OCV_OPTION(PYTHON3_LIMITED_API "Build with Python Limited API (not available with numpy >=1.15 <1.17)" NO
VISIBLE_IF PYTHON3_NUMPY_VERSION VERSION_LESS "1.15" OR NOT PYTHON3_NUMPY_VERSION VERSION_LESS "1.17") VISIBLE_IF PYTHON3_NUMPY_VERSION VERSION_LESS "1.15" OR NOT PYTHON3_NUMPY_VERSION VERSION_LESS "1.17")
if(PYTHON3_LIMITED_API) if(PYTHON3_LIMITED_API)
set(PYTHON3_LIMITED_API_VERSION "0x03060000" CACHE STRING "Minimal Python version for Limited API") set(_default_ver "0x03060000")
if(PYTHON3_VERSION_STRING VERSION_LESS "3.6")
# fix for older pythons
set(_default_ver "0x030${PYTHON3_VERSION_MINOR}0000")
endif()
set(PYTHON3_LIMITED_API_VERSION ${_default_ver} CACHE STRING "Minimal Python version for Limited API")
endif() endif()
if(PYTHON_DEFAULT_EXECUTABLE) if(PYTHON_DEFAULT_EXECUTABLE)