Build both Python 2 and Python 3 bindings

If both Python 2 and Python 3 are found, then build bindings for both of
them during the build process.  Currently, one version of Python is
detected automatically, and building for the other requires changes the
CMake config.

The largest chunk of this change generalizes OpenCVDetectPython.cmake to
find both a Python 2 and Python 3 version of Python.  Secondly, the
opencv_python module is split into two modules, opencv_python2 and
opencv_python3.  Both are built from the same source. but for different
versions of Python.
This commit is contained in:
Michael Pratt 2014-06-29 16:45:24 -04:00 committed by arc
parent 2d81595ed4
commit cac1218eef
11 changed files with 454 additions and 242 deletions

View File

@ -991,18 +991,34 @@ endif()
# ========================== python ==========================
status("")
status(" Python:")
status(" Interpreter:" PYTHONINTERP_FOUND THEN "${PYTHON_EXECUTABLE} (ver ${PYTHON_VERSION_STRING})" ELSE NO)
if(BUILD_opencv_python)
if(PYTHONLIBS_VERSION_STRING)
status(" Libraries:" HAVE_opencv_python THEN "${PYTHON_LIBRARIES} (ver ${PYTHONLIBS_VERSION_STRING})" ELSE NO)
status(" Python 2:")
status(" Interpreter:" PYTHON2INTERP_FOUND THEN "${PYTHON2_EXECUTABLE} (ver ${PYTHON2_VERSION_STRING})" ELSE NO)
if(BUILD_opencv_python2)
if(PYTHON2LIBS_VERSION_STRING)
status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES} (ver ${PYTHON2LIBS_VERSION_STRING})" ELSE NO)
else()
status(" Libraries:" HAVE_opencv_python THEN "${PYTHON_LIBRARIES}" ELSE NO)
status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES}" ELSE NO)
endif()
status(" numpy:" PYTHON_NUMPY_INCLUDE_DIRS THEN "${PYTHON_NUMPY_INCLUDE_DIRS} (ver ${PYTHON_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
status(" packages path:" PYTHON_EXECUTABLE THEN "${PYTHON_PACKAGES_PATH}" ELSE "-")
status(" numpy:" PYTHON2_NUMPY_INCLUDE_DIRS THEN "${PYTHON2_NUMPY_INCLUDE_DIRS} (ver ${PYTHON2_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
status(" packages path:" PYTHON2_EXECUTABLE THEN "${PYTHON2_PACKAGES_PATH}" ELSE "-")
endif()
status("")
status(" Python 3:")
status(" Interpreter:" PYTHON3INTERP_FOUND THEN "${PYTHON3_EXECUTABLE} (ver ${PYTHON3_VERSION_STRING})" ELSE NO)
if(BUILD_opencv_python3)
if(PYTHON3LIBS_VERSION_STRING)
status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES} (ver ${PYTHON3LIBS_VERSION_STRING})" ELSE NO)
else()
status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES}" ELSE NO)
endif()
status(" numpy:" PYTHON3_NUMPY_INCLUDE_DIRS THEN "${PYTHON3_NUMPY_INCLUDE_DIRS} (ver ${PYTHON3_NUMPY_VERSION})" ELSE "NO (Python3 wrappers can not be generated)")
status(" packages path:" PYTHON3_EXECUTABLE THEN "${PYTHON3_PACKAGES_PATH}" ELSE "-")
endif()
status("")
status(" Python (for build):" PYTHON_DEFAULT_AVAILABLE THEN "${PYTHON_DEFAULT_EXECUTABLE}" ELSE NO)
# ========================== java ==========================
status("")
status(" Java:")

View File

@ -1,9 +1,37 @@
if(WIN32 AND NOT PYTHON_EXECUTABLE)
# Find specified Python version
# Arguments:
# preferred_version (value): Version to check for first
# min_version (value): Minimum supported version
# library_env (value): Name of Python library ENV variable to check
# include_dir_env (value): Name of Python include directory ENV variable to check
# found (variable): Set if interpreter found
# executable (variable): Output of executable found
# version_string (variable): Output of found version
# version_major (variable): Output of found major version
# version_minor (variable): Output of found minor version
# libs_found (variable): Set if libs found
# libs_version_string (variable): Output of found libs version
# libraries (variable): Output of found Python libraries
# library (variable): Output of found Python library
# debug_libraries (variable): Output of found Python debug libraries
# debug_library (variable): Output of found Python debug library
# include_path (variable): Output of found Python include path
# include_dir (variable): Output of found Python include dir
# include_dir2 (variable): Output of found Python include dir2
# packages_path (variable): Output of found Python packages path
# numpy_include_dirs (variable): Output of found Python Numpy include dirs
# numpy_version (variable): Output of found Python Numpy version
function(find_python preferred_version min_version library_env include_dir_env
found executable version_string version_major version_minor
libs_found libs_version_string libraries library debug_libraries
debug_library include_path include_dir include_dir2 packages_path
numpy_include_dirs numpy_version)
if(WIN32 AND NOT ${executable})
# search for executable with the same bitness as resulting binaries
# standard FindPythonInterp always prefers executable from system path
# this is really important because we are using the interpreter for numpy search and for choosing the install location
foreach(_CURRENT_VERSION ${Python_ADDITIONAL_VERSIONS} 2.7 "${MIN_VER_PYTHON}")
find_host_program(PYTHON_EXECUTABLE
foreach(_CURRENT_VERSION ${Python_ADDITIONAL_VERSIONS} "${preferred_version}" "${min_version}")
find_host_program(executable
NAMES python${_CURRENT_VERSION} python
PATHS
[HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\${_CURRENT_VERSION}\\\\InstallPath]
@ -11,91 +39,196 @@ if(WIN32 AND NOT PYTHON_EXECUTABLE)
NO_SYSTEM_ENVIRONMENT_PATH
)
endforeach()
endif()
find_host_package(PythonInterp 2.7)
if(NOT PYTHONINTERP_FOUND)
find_host_package(PythonInterp "${MIN_VER_PYTHON}")
endif()
endif()
unset(HAVE_SPHINX CACHE)
find_host_package(PythonInterp "${preferred_version}")
if(NOT PYTHONINTERP_FOUND)
find_host_package(PythonInterp "${min_version}")
endif()
if(PYTHONINTERP_FOUND)
set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
if(PYTHONINTERP_FOUND)
# Copy outputs
set(_found ${PYTHONINTERP_FOUND})
set(_executable ${PYTHON_EXECUTABLE})
set(_version_string ${PYTHON_VERSION_STRING})
set(_version_major ${PYTHON_VERSION_MAJOR})
set(_version_minor ${PYTHON_VERSION_MINOR})
set(_version_patch ${PYTHON_VERSION_PATCH})
# Clear find_host_package side effects
unset(PYTHONINTERP_FOUND)
unset(PYTHON_EXECUTABLE CACHE)
unset(PYTHON_VERSION_STRING)
unset(PYTHON_VERSION_MAJOR)
unset(PYTHON_VERSION_MINOR)
unset(PYTHON_VERSION_PATCH)
endif()
if(_found)
set(_version_major_minor "${_version_major}.${_version_minor}")
if(NOT ANDROID AND NOT IOS)
ocv_check_environment_variables(PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
# not using PYTHON_VERSION_STRING here, because it might not conform to the CMake version format
find_host_package(PythonLibs "${PYTHON_VERSION_MAJOR_MINOR}.${PYTHON_VERSION_PATCH}" EXACT)
ocv_check_environment_variables(${library_env} ${include_dir_env})
if(${library})
set(PYTHON_LIBRARY "${${library_env}}")
endif()
if(${include_dir})
set(PYTHON_INCLUDE_DIR "${${include_dir_env}}")
endif()
# not using _version_string here, because it might not conform to the CMake version format
find_host_package(PythonLibs "${_version_major_minor}.${_version_patch}" EXACT)
if(PYTHONLIBS_FOUND)
# Copy outputs
set(_libs_found ${PYTHONLIBS_FOUND})
set(_libraries ${PYTHON_LIBRARIES})
set(_include_path ${PYTHON_INCLUDE_PATH})
set(_include_dirs ${PYTHON_INCLUDE_DIRS})
set(_debug_libraries ${PYTHON_DEBUG_LIBRARIES})
set(_libs_version_string ${PYTHONLIBS_VERSION_STRING})
set(_debug_library ${PYTHON_DEBUG_LIBRARY})
set(_library ${PYTHON_LIBRARY})
set(_library_debug ${PYTHON_LIBRARY_DEBUG})
set(_library_release ${PYTHON_LIBRARY_RELEASE})
set(_include_dir ${PYTHON_INCLUDE_DIR})
set(_include_dir2 ${PYTHON_INCLUDE_DIR2})
# Clear find_host_package side effects
unset(PYTHONLIBS_FOUND)
unset(PYTHON_LIBRARIES)
unset(PYTHON_INCLUDE_PATH)
unset(PYTHON_INCLUDE_DIRS)
unset(PYTHON_DEBUG_LIBRARIES)
unset(PYTHONLIBS_VERSION_STRING)
unset(PYTHON_DEBUG_LIBRARY CACHE)
unset(PYTHON_LIBRARY)
unset(PYTHON_LIBRARY_DEBUG)
unset(PYTHON_LIBRARY_RELEASE)
unset(PYTHON_LIBRARY CACHE)
unset(PYTHON_LIBRARY_DEBUG CACHE)
unset(PYTHON_LIBRARY_RELEASE CACHE)
unset(PYTHON_INCLUDE_DIR CACHE)
unset(PYTHON_INCLUDE_DIR2 CACHE)
endif()
endif()
if(NOT ANDROID AND NOT IOS)
if(CMAKE_HOST_UNIX)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print(get_python_lib())"
RESULT_VARIABLE PYTHON_CVPY_PROCESS
OUTPUT_VARIABLE PYTHON_STD_PACKAGES_PATH
execute_process(COMMAND ${_executable} -c "from distutils.sysconfig import *; print(get_python_lib())"
RESULT_VARIABLE _cvpy_process
OUTPUT_VARIABLE _std_packages_path
OUTPUT_STRIP_TRAILING_WHITESPACE)
if("${PYTHON_STD_PACKAGES_PATH}" MATCHES "site-packages")
set(_PYTHON_PACKAGES_PATH "python${PYTHON_VERSION_MAJOR_MINOR}/site-packages")
if("${_std_packages_path}" MATCHES "site-packages")
set(_packages_path "python${_version_major_minor}/site-packages")
else() #debian based assumed, install to the dist-packages.
set(_PYTHON_PACKAGES_PATH "python${PYTHON_VERSION_MAJOR_MINOR}/dist-packages")
set(_packages_path "python${_version_major_minor}/dist-packages")
endif()
if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${PYTHON_PACKAGES_PATH}")
set(_PYTHON_PACKAGES_PATH "lib${LIB_SUFFIX}/${_PYTHON_PACKAGES_PATH}")
if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${${packages_path}}")
set(_packages_path "lib${LIB_SUFFIX}/${_packages_path}")
else()
set(_PYTHON_PACKAGES_PATH "lib/${_PYTHON_PACKAGES_PATH}")
set(_packages_path "lib/${_packages_path}")
endif()
elseif(CMAKE_HOST_WIN32)
get_filename_component(PYTHON_PATH "${PYTHON_EXECUTABLE}" PATH)
file(TO_CMAKE_PATH "${PYTHON_PATH}" PYTHON_PATH)
if(NOT EXISTS "${PYTHON_PATH}/Lib/site-packages")
unset(PYTHON_PATH)
get_filename_component(PYTHON_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION_MAJOR_MINOR}\\InstallPath]" ABSOLUTE)
if(NOT PYTHON_PATH)
get_filename_component(PYTHON_PATH "[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION_MAJOR_MINOR}\\InstallPath]" ABSOLUTE)
get_filename_component(_path "${_executable}" PATH)
file(TO_CMAKE_PATH "${_path}" _path)
if(NOT EXISTS "${_path}/Lib/site-packages")
unset(_path)
get_filename_component(_path "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_version_major_minor}\\InstallPath]" ABSOLUTE)
if(NOT _path)
get_filename_component(_path "[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_version_major_minor}\\InstallPath]" ABSOLUTE)
endif()
file(TO_CMAKE_PATH "${PYTHON_PATH}" PYTHON_PATH)
file(TO_CMAKE_PATH "${_path}" _path)
endif()
set(_PYTHON_PACKAGES_PATH "${PYTHON_PATH}/Lib/site-packages")
set(_packages_path "${_path}/Lib/site-packages")
unset(_path)
endif()
SET(PYTHON_PACKAGES_PATH "${_PYTHON_PACKAGES_PATH}" CACHE PATH "Where to install the python packages.")
if(NOT PYTHON_NUMPY_INCLUDE_DIRS)
set(_numpy_include_dirs ${${numpy_include_dirs}})
if(NOT _numpy_include_dirs)
if(CMAKE_CROSSCOMPILING)
message(STATUS "Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)")
message(STATUS "If you want to enable Python/Numpy support, set the following variables:")
message(STATUS " PYTHON_INCLUDE_PATH")
message(STATUS " PYTHON_LIBRARIES")
message(STATUS " PYTHON_NUMPY_INCLUDE_DIRS")
message(STATUS " PYTHON2_INCLUDE_PATH")
message(STATUS " PYTHON2_LIBRARIES")
message(STATUS " PYTHON2_NUMPY_INCLUDE_DIRS")
message(STATUS " PYTHON3_INCLUDE_PATH")
message(STATUS " PYTHON3_LIBRARIES")
message(STATUS " PYTHON3_NUMPY_INCLUDE_DIRS")
else()
# Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print(os.pathsep.join(numpy.distutils.misc_util.get_numpy_include_dirs()))"
RESULT_VARIABLE PYTHON_NUMPY_PROCESS
OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS
execute_process(COMMAND "${_executable}" -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print(os.pathsep.join(numpy.distutils.misc_util.get_numpy_include_dirs()))"
RESULT_VARIABLE _numpy_process
OUTPUT_VARIABLE _numpy_include_dirs
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT PYTHON_NUMPY_PROCESS EQUAL 0)
unset(PYTHON_NUMPY_INCLUDE_DIRS)
if(NOT _numpy_process EQUAL 0)
unset(_numpy_include_dirs)
endif()
endif()
endif()
if(PYTHON_NUMPY_INCLUDE_DIRS)
file(TO_CMAKE_PATH "${PYTHON_NUMPY_INCLUDE_DIRS}" _PYTHON_NUMPY_INCLUDE_DIRS)
set(PYTHON_NUMPY_INCLUDE_DIRS ${_PYTHON_NUMPY_INCLUDE_DIRS} CACHE PATH "Path to numpy headers")
if(_numpy_include_dirs)
file(TO_CMAKE_PATH "${_numpy_include_dirs}" _numpy_include_dirs)
if(CMAKE_CROSSCOMPILING)
if(NOT PYTHON_NUMPY_VERSION)
set(PYTHON_NUMPY_VERSION "undefined - cannot be probed because of the cross-compilation")
if(NOT _numpy_version)
set(_numpy_version "undefined - cannot be probed because of the cross-compilation")
endif()
else()
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import numpy; print(numpy.version.version)"
RESULT_VARIABLE PYTHON_NUMPY_PROCESS
OUTPUT_VARIABLE PYTHON_NUMPY_VERSION
execute_process(COMMAND "${_executable}" -c "import numpy; print(numpy.version.version)"
RESULT_VARIABLE _numpy_process
OUTPUT_VARIABLE _numpy_version
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
endif(NOT ANDROID AND NOT IOS)
endif()
# Export return values
set(${found} "${_found}" PARENT_SCOPE)
set(${executable} "${_executable}" CACHE FILEPATH "Path to Python interpretor")
set(${version_string} "${_version_string}" PARENT_SCOPE)
set(${version_major} "${_version_major}" PARENT_SCOPE)
set(${version_minor} "${_version_minor}" PARENT_SCOPE)
set(${libs_found} "${_libs_found}" PARENT_SCOPE)
set(${libs_version_string} "${_libs_version_string}" PARENT_SCOPE)
set(${libraries} "${_libraries}" PARENT_SCOPE)
set(${library} "${_library}" CACHE FILEPATH "Path to Python library")
set(${debug_libraries} "${_debug_libraries}" PARENT_SCOPE)
set(${debug_library} "${_debug_library}" CACHE FILEPATH "Path to Python debug")
set(${include_path} "${_include_path}" PARENT_SCOPE)
set(${include_dir} "${_include_dir}" CACHE PATH "Python include dir")
set(${include_dir2} "${_include_dir2}" CACHE PATH "Python include dir 2")
set(${packages_path} "${_packages_path}" CACHE PATH "Where to install the python packages.")
set(${numpy_include_dirs} ${_numpy_include_dirs} CACHE PATH "Path to numpy headers")
set(${numpy_version} "${_numpy_version}" PARENT_SCOPE)
endfunction(find_python)
find_python(2.7 "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR
PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING
PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND
PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY
PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH
PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH
PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_NUMPY_VERSION)
find_python(3.4 "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
PYTHON3INTERP_FOUND PYTHON3_EXECUTABLE PYTHON3_VERSION_STRING
PYTHON3_VERSION_MAJOR PYTHON3_VERSION_MINOR PYTHON3LIBS_FOUND
PYTHON3LIBS_VERSION_STRING PYTHON3_LIBRARIES PYTHON3_LIBRARY
PYTHON3_DEBUG_LIBRARIES PYTHON3_LIBRARY_DEBUG PYTHON3_INCLUDE_PATH
PYTHON3_INCLUDE_DIR PYTHON3_INCLUDE_DIR2 PYTHON3_PACKAGES_PATH
PYTHON3_NUMPY_INCLUDE_DIRS PYTHON3_NUMPY_VERSION)
# Use Python 2 as default Python interpreter
if(PYTHON2LIBS_FOUND)
set(PYTHON_DEFAULT_AVAILABLE "TRUE")
set(PYTHON_DEFAULT_EXECUTABLE "${PYTHON2_EXECUTABLE}")
endif()
unset(HAVE_SPHINX CACHE)
if(BUILD_DOCS)
find_host_program(SPHINX_BUILD sphinx-build)
find_host_program(PLANTUML plantuml)

View File

@ -1,5 +1,6 @@
set(MIN_VER_CMAKE 2.8.7)
set(MIN_VER_CUDA 4.2)
set(MIN_VER_PYTHON 2.6)
set(MIN_VER_PYTHON2 2.6)
set(MIN_VER_PYTHON3 3.2)
set(MIN_VER_ZLIB 1.2.3)
set(MIN_VER_GTK 2.18.0)

View File

@ -105,8 +105,8 @@ if(BUILD_DOCS AND HAVE_SPHINX)
COMMAND ${SPHINX_BUILD} ${BUILD_PLANTUML} -b latex -c "${CMAKE_CURRENT_SOURCE_DIR}" "${DOC_FAKE_ROOT}" .
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/pics ${CMAKE_CURRENT_BINARY_DIR}/doc/opencv1/pics
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/mymath.sty ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/patch_refman_latex.py" opencv2refman.tex
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/patch_refman_latex.py" opencv2manager.tex
COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/patch_refman_latex.py" opencv2refman.tex
COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/patch_refman_latex.py" opencv2manager.tex
COMMAND ${CMAKE_COMMAND} -E echo "Generating opencv2refman.pdf"
COMMAND ${PDFLATEX_COMPILER} -interaction=batchmode opencv2refman.tex
COMMAND ${PDFLATEX_COMPILER} -interaction=batchmode opencv2refman.tex

View File

@ -1,7 +1,7 @@
# ----------------------------------------------------------------------------
# CMake file for java support
# ----------------------------------------------------------------------------
if(IOS OR NOT PYTHON_EXECUTABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)))
if(IOS OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)))
ocv_module_disable(java)
endif()
@ -100,7 +100,7 @@ foreach(module ${OPENCV_JAVA_MODULES})
# first run of gen_java.py (to get list of generated files)
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out")
execute_process(COMMAND ${PYTHON_EXECUTABLE} "${scripts_gen_java}" "${scripts_hdr_parser}" ${module} ${opencv_public_headers_${module}}
execute_process(COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${scripts_gen_java}" "${scripts_hdr_parser}" ${module} ${opencv_public_headers_${module}}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out"
OUTPUT_QUIET ERROR_QUIET)
unset(generated_java_sources_${module})
@ -124,7 +124,7 @@ set(step1_depends "${scripts_gen_java}" "${scripts_hdr_parser}" ${opencv_public_
foreach(module ${OPENCV_JAVA_MODULES})
# second run of gen_java.py (at build time)
add_custom_command(OUTPUT ${generated_java_sources_${module}} "${CMAKE_CURRENT_BINARY_DIR}/${module}.cpp"
COMMAND ${PYTHON_EXECUTABLE} "${scripts_gen_java}" "${scripts_hdr_parser}" ${module} ${opencv_public_headers_${module}}
COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${scripts_gen_java}" "${scripts_hdr_parser}" ${module} ${opencv_public_headers_${module}}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${scripts_gen_java}" "${scripts_hdr_parser}" ${opencv_public_headers_${module}}
)
@ -134,7 +134,7 @@ endforeach()
set(step2_depends ${step1_depends} ${scripts_gen_javadoc} ${scripts_rst_parser} ${javadoc_rst_sources} ${generated_java_sources} ${handwrittren_java_sources})
string(REPLACE ";" "," OPENCV_JAVA_MODULES_STR "${OPENCV_JAVA_MODULES}")
add_custom_command(OUTPUT ${documented_java_files}
COMMAND ${PYTHON_EXECUTABLE} "${scripts_gen_javadoc}" --modules ${OPENCV_JAVA_MODULES_STR} "${CMAKE_CURRENT_SOURCE_DIR}/generator/src/java" "${CMAKE_CURRENT_BINARY_DIR}" 2> "${CMAKE_CURRENT_BINARY_DIR}/get_javadoc_errors.log"
COMMAND ${PYTHON_DEFUALT_EXECUTABLE} "${scripts_gen_javadoc}" --modules ${OPENCV_JAVA_MODULES_STR} "${CMAKE_CURRENT_SOURCE_DIR}/generator/src/java" "${CMAKE_CURRENT_BINARY_DIR}" 2> "${CMAKE_CURRENT_BINARY_DIR}/get_javadoc_errors.log"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${step2_depends}
VERBATIM

View File

@ -59,9 +59,9 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E
add_dependencies(opencv_tests ${PROJECT_NAME})
if(PYTHON_EXECUTABLE)
if(PYTHON_DEFAULT_AVAILABLE)
set(CHECK_TEST_COVERAGE "${OPENCV_MODULE_opencv_java_LOCATION}/check-tests.py")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} ${CHECK_TEST_COVERAGE} "${CMAKE_CURRENT_SOURCE_DIR}/src" "${OpenCV_BINARY_DIR}/src" > "${CMAKE_CURRENT_BINARY_DIR}/tests_coverage.log"
COMMAND ${PYTHON_DEFAULT_EXECUTABLE} ${CHECK_TEST_COVERAGE} "${CMAKE_CURRENT_SOURCE_DIR}/src" "${OpenCV_BINARY_DIR}/src" > "${CMAKE_CURRENT_BINARY_DIR}/tests_coverage.log"
)
endif()

View File

@ -51,7 +51,7 @@ endmacro()
if (IOS OR ANDROID OR NOT MATLAB_FOUND)
ocv_module_disable(matlab)
return()
elseif (NOT PYTHONLIBS_FOUND)
elseif (NOT PYTHON_DEFAULT_AVAILABLE)
message(WARNING "A required dependency of the matlab module (PythonLibs) was not found. Disabling Matlab bindings...")
ocv_module_disable(matlab)
return()
@ -152,7 +152,7 @@ if (NOT MEX_WORKS)
# attempt to generate a gateway for a function
message(STATUS "Trying to generate Matlab code")
execute_process(
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${PYTHON_DEFAULT_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/generator/gen_matlab.py
--jinja2 ${JINJA2_PATH}
--hdrparser ${HDR_PARSER_PATH}
@ -212,7 +212,7 @@ file(REMOVE ${GENERATE_PROXY} ${COMPILE_PROXY})
# call the python executable to generate the Matlab gateways
add_custom_command(
OUTPUT ${GENERATE_PROXY}
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${PYTHON_DEFAULT_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/generator/gen_matlab.py
--jinja2 ${JINJA2_PATH}
--hdrparser ${HDR_PARSER_PATH}
@ -221,7 +221,7 @@ add_custom_command(
--modules ${opencv_modules}
--extra ${opencv_extra_hdrs}
--outdir ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${PYTHON_DEFAULT_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/generator/build_info.py
--jinja2 ${JINJA2_PATH}
--os ${CMAKE_SYSTEM}
@ -235,7 +235,7 @@ add_custom_command(
--modules ${opencv_modules}
--configuration $<CONFIGURATION>
--outdir ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${PYTHON_DEFAULT_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/generator/cvmex.py
--jinja2 ${JINJA2_PATH}
--opts="${MEX_OPTS}"
@ -298,7 +298,7 @@ string(REPLACE " " "\\ " MEX_CXXFLAGS ${MEX_CXXFLAGS})
string(REPLACE ";" "\\ " MEX_INCLUDE_DIRS "${MEX_INCLUDE_DIRS}")
install(CODE
"execute_process(
COMMAND ${PYTHON_EXECUTABLE}
COMMAND ${PYTHON_DEFAULT_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/generator/cvmex.py
--jinja2 ${JINJA2_PATH}
--opts=${MEX_OPTS}

View File

@ -3,132 +3,14 @@
# ----------------------------------------------------------------------------
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
ocv_module_disable(python)
ocv_module_disable(python2)
ocv_module_disable(python3)
endif()
if(ANDROID OR IOS OR NOT PYTHONLIBS_FOUND OR NOT PYTHON_NUMPY_INCLUDE_DIRS)
ocv_module_disable(python)
if(ANDROID OR IOS)
ocv_module_disable(python2)
ocv_module_disable(python3)
endif()
set(the_description "The python bindings")
ocv_add_module(python BINDINGS opencv_core opencv_flann opencv_imgproc opencv_video opencv_ml opencv_features2d opencv_highgui opencv_calib3d opencv_photo opencv_objdetect OPTIONAL opencv_nonfree)
ocv_module_include_directories(
"${PYTHON_INCLUDE_PATH}"
${PYTHON_NUMPY_INCLUDE_DIRS}
"${CMAKE_CURRENT_SOURCE_DIR}/src2"
)
set(opencv_hdrs
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/base.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/types.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/persistence.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/utility.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/ocl.hpp"
"${OPENCV_MODULE_opencv_flann_LOCATION}/include/opencv2/flann/miniflann.hpp"
"${OPENCV_MODULE_opencv_imgproc_LOCATION}/include/opencv2/imgproc.hpp"
"${OPENCV_MODULE_opencv_video_LOCATION}/include/opencv2/video/background_segm.hpp"
"${OPENCV_MODULE_opencv_video_LOCATION}/include/opencv2/video/tracking.hpp"
"${OPENCV_MODULE_opencv_photo_LOCATION}/include/opencv2/photo.hpp"
"${OPENCV_MODULE_opencv_highgui_LOCATION}/include/opencv2/highgui.hpp"
"${OPENCV_MODULE_opencv_ml_LOCATION}/include/opencv2/ml.hpp"
"${OPENCV_MODULE_opencv_features2d_LOCATION}/include/opencv2/features2d.hpp"
"${OPENCV_MODULE_opencv_calib3d_LOCATION}/include/opencv2/calib3d.hpp"
"${OPENCV_MODULE_opencv_objdetect_LOCATION}/include/opencv2/objdetect.hpp"
)
if(HAVE_opencv_nonfree)
list(APPEND opencv_hdrs "${OPENCV_MODULE_opencv_nonfree_LOCATION}/include/opencv2/nonfree/features2d.hpp"
"${OPENCV_MODULE_opencv_nonfree_LOCATION}/include/opencv2/nonfree.hpp")
endif()
set(cv2_generated_hdrs
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_funcs.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_func_tab.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_types.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_type_reg.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_const_reg.h")
add_custom_command(
OUTPUT ${cv2_generated_hdrs}
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/src2/gen2.py" ${CMAKE_CURRENT_BINARY_DIR} ${opencv_hdrs}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src2/gen2.py
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src2/hdr_parser.py
DEPENDS ${opencv_hdrs})
add_library(${the_module} SHARED src2/cv2.cpp ${cv2_generated_hdrs})
set_target_properties(${the_module} PROPERTIES COMPILE_DEFINITIONS OPENCV_NOSTL)
if(PYTHON_DEBUG_LIBRARIES AND NOT PYTHON_LIBRARIES MATCHES "optimized.*debug")
target_link_libraries(${the_module} debug ${PYTHON_DEBUG_LIBRARIES} optimized ${PYTHON_LIBRARIES})
else()
target_link_libraries(${the_module} ${PYTHON_LIBRARIES})
endif()
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('SO'))"
RESULT_VARIABLE PYTHON_CVPY_PROCESS
OUTPUT_VARIABLE CVPY_SUFFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
set_target_properties(${the_module} PROPERTIES
PREFIX ""
OUTPUT_NAME cv2
SUFFIX ${CVPY_SUFFIX})
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_module} PROPERTIES FOLDER "bindings")
endif()
if(MSVC)
add_definitions(-DCVAPI_EXPORTS)
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
endif()
if(MSVC AND NOT ENABLE_NOISY_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100") #unreferenced formal parameter
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4127") #conditional expression is constant
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4505") #unreferenced local function has been removed
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
if(MSVC AND NOT BUILD_SHARED_LIBS)
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")
endif()
if(MSVC AND NOT PYTHON_DEBUG_LIBRARIES)
set(PYTHON_INSTALL_CONFIGURATIONS CONFIGURATIONS Release)
else()
set(PYTHON_INSTALL_CONFIGURATIONS "")
endif()
if(WIN32)
set(PYTHON_INSTALL_ARCHIVE "")
else()
set(PYTHON_INSTALL_ARCHIVE ARCHIVE DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT python)
endif()
if(NOT INSTALL_CREATE_DISTRIB)
install(TARGETS ${the_module}
${PYTHON_INSTALL_CONFIGURATIONS}
RUNTIME DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT python
LIBRARY DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT python
${PYTHON_INSTALL_ARCHIVE}
)
else()
if(DEFINED PYTHON_VERSION_MAJOR)
set(__ver "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
else()
set(__ver "unknown")
endif()
install(TARGETS ${the_module}
CONFIGURATIONS Release
RUNTIME DESTINATION python/${__ver}/${OpenCV_ARCH} COMPONENT python
LIBRARY DESTINATION python/${__ver}/${OpenCV_ARCH} COMPONENT python
)
endif()
add_subdirectory(python2)
add_subdirectory(python3)

128
modules/python/common.cmake Normal file
View File

@ -0,0 +1,128 @@
# This file is included from a subdirectory
set(PYTHON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../")
ocv_module_include_directories(
"${PYTHON_INCLUDE_PATH}"
${PYTHON_NUMPY_INCLUDE_DIRS}
"${PYTHON_SOURCE_DIR}/src2"
)
set(opencv_hdrs
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/base.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/types.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/persistence.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/utility.hpp"
"${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/ocl.hpp"
"${OPENCV_MODULE_opencv_flann_LOCATION}/include/opencv2/flann/miniflann.hpp"
"${OPENCV_MODULE_opencv_imgproc_LOCATION}/include/opencv2/imgproc.hpp"
"${OPENCV_MODULE_opencv_video_LOCATION}/include/opencv2/video/background_segm.hpp"
"${OPENCV_MODULE_opencv_video_LOCATION}/include/opencv2/video/tracking.hpp"
"${OPENCV_MODULE_opencv_photo_LOCATION}/include/opencv2/photo.hpp"
"${OPENCV_MODULE_opencv_highgui_LOCATION}/include/opencv2/highgui.hpp"
"${OPENCV_MODULE_opencv_ml_LOCATION}/include/opencv2/ml.hpp"
"${OPENCV_MODULE_opencv_features2d_LOCATION}/include/opencv2/features2d.hpp"
"${OPENCV_MODULE_opencv_calib3d_LOCATION}/include/opencv2/calib3d.hpp"
"${OPENCV_MODULE_opencv_objdetect_LOCATION}/include/opencv2/objdetect.hpp"
)
if(HAVE_opencv_nonfree)
list(APPEND opencv_hdrs "${OPENCV_MODULE_opencv_nonfree_LOCATION}/include/opencv2/nonfree/features2d.hpp"
"${OPENCV_MODULE_opencv_nonfree_LOCATION}/include/opencv2/nonfree.hpp")
endif()
set(cv2_generated_hdrs
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_funcs.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_func_tab.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_types.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_type_reg.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_const_reg.h")
add_custom_command(
OUTPUT ${cv2_generated_hdrs}
COMMAND ${PYTHON_EXECUTABLE} "${PYTHON_SOURCE_DIR}/src2/gen2.py" ${CMAKE_CURRENT_BINARY_DIR} ${opencv_hdrs}
DEPENDS ${PYTHON_SOURCE_DIR}/src2/gen2.py
DEPENDS ${PYTHON_SOURCE_DIR}/src2/hdr_parser.py
DEPENDS ${opencv_hdrs})
add_library(${the_module} SHARED ${PYTHON_SOURCE_DIR}/src2/cv2.cpp ${cv2_generated_hdrs})
set_target_properties(${the_module} PROPERTIES COMPILE_DEFINITIONS OPENCV_NOSTL)
if(PYTHON_DEBUG_LIBRARIES AND NOT PYTHON_LIBRARIES MATCHES "optimized.*debug")
target_link_libraries(${the_module} debug ${PYTHON_DEBUG_LIBRARIES} optimized ${PYTHON_LIBRARIES})
else()
target_link_libraries(${the_module} ${PYTHON_LIBRARIES})
endif()
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('SO'))"
RESULT_VARIABLE PYTHON_CVPY_PROCESS
OUTPUT_VARIABLE CVPY_SUFFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
set_target_properties(${the_module} PROPERTIES
PREFIX ""
OUTPUT_NAME cv2
SUFFIX ${CVPY_SUFFIX})
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_module} PROPERTIES FOLDER "bindings")
endif()
if(MSVC)
add_definitions(-DCVAPI_EXPORTS)
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
endif()
if(MSVC AND NOT ENABLE_NOISY_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100") #unreferenced formal parameter
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4127") #conditional expression is constant
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4505") #unreferenced local function has been removed
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
if(MSVC AND NOT BUILD_SHARED_LIBS)
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")
endif()
if(MSVC AND NOT PYTHON_DEBUG_LIBRARIES)
set(PYTHON_INSTALL_CONFIGURATIONS CONFIGURATIONS Release)
else()
set(PYTHON_INSTALL_CONFIGURATIONS "")
endif()
if(WIN32)
set(PYTHON_INSTALL_ARCHIVE "")
else()
set(PYTHON_INSTALL_ARCHIVE ARCHIVE DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT python)
endif()
if(NOT INSTALL_CREATE_DISTRIB)
install(TARGETS ${the_module}
${PYTHON_INSTALL_CONFIGURATIONS}
RUNTIME DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT python
LIBRARY DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT python
${PYTHON_INSTALL_ARCHIVE}
)
else()
if(DEFINED PYTHON_VERSION_MAJOR)
set(__ver "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
else()
set(__ver "unknown")
endif()
install(TARGETS ${the_module}
CONFIGURATIONS Release
RUNTIME DESTINATION python/${__ver}/${OpenCV_ARCH} COMPONENT python
LIBRARY DESTINATION python/${__ver}/${OpenCV_ARCH} COMPONENT python
)
endif()
unset(PYTHON_SRC_DIR)
unset(PYTHON_CVPY_PROCESS)
unset(CVPY_SUFFIX)
unset(PYTHON_INSTALL_CONFIGURATIONS)
unset(PYTHON_INSTALL_ARCHIVE)

View File

@ -0,0 +1,26 @@
if(NOT PYTHON2LIBS_FOUND OR NOT PYTHON2_NUMPY_INCLUDE_DIRS)
ocv_module_disable(python2)
endif()
set(the_description "The python2 bindings")
ocv_add_module(python2 BINDINGS opencv_core opencv_flann opencv_imgproc opencv_video opencv_ml opencv_features2d opencv_highgui opencv_calib3d opencv_photo opencv_objdetect OPTIONAL opencv_nonfree)
set(PYTHON_INCLUDE_PATH ${PYTHON2_INCLUDE_PATH})
set(PYTHON_NUMPY_INCLUDE_PATH ${PYTHON2_NUMPY_INCLUDE_PATH})
set(PYTHON_EXECUTABLE ${PYTHON2_EXECUTABLE})
set(PYTHON_DEBUG_LIBRARIES ${PYTHON2_DEBUG_LIBRARIES})
set(PYTHON_LIBRARIES ${PYTHON2_LIBRARIES})
set(PYTHON_PACKAGES_PATH ${PYTHON2_PACKAGES_PATH})
set(PYTHON_VERSION_MAJOR ${PYTHON2_VERSION_MAJOR})
set(PYTHON_VERSION_MINOR ${PYTHON2_VERSION_MINOR})
include(../common.cmake)
unset(PYTHON_INCLUDE_PATH)
unset(PYTHON_NUMPY_INCLUDE_PATH)
unset(PYTHON_EXECUTABLE)
unset(PYTHON_DEBUG_LIBRARIES)
unset(PYTHON_LIBRARIES)
unset(PYTHON_PACKAGES_PATH)
unset(PYTHON_VERSION_MAJOR)
unset(PYTHON_VERSION_MINOR)

View File

@ -0,0 +1,26 @@
if(NOT PYTHON3LIBS_FOUND OR NOT PYTHON3_NUMPY_INCLUDE_DIRS)
ocv_module_disable(python3)
endif()
set(the_description "The python3 bindings")
ocv_add_module(python3 BINDINGS opencv_core opencv_flann opencv_imgproc opencv_video opencv_ml opencv_features2d opencv_highgui opencv_calib3d opencv_photo opencv_objdetect OPTIONAL opencv_nonfree)
set(PYTHON_INCLUDE_PATH ${PYTHON3_INCLUDE_PATH})
set(PYTHON_NUMPY_INCLUDE_PATH ${PYTHON3_NUMPY_INCLUDE_PATH})
set(PYTHON_EXECUTABLE ${PYTHON3_EXECUTABLE})
set(PYTHON_DEBUG_LIBRARIES ${PYTHON3_DEBUG_LIBRARIES})
set(PYTHON_LIBRARIES ${PYTHON3_LIBRARIES})
set(PYTHON_PACKAGES_PATH ${PYTHON3_PACKAGES_PATH})
set(PYTHON_VERSION_MAJOR ${PYTHON3_VERSION_MAJOR})
set(PYTHON_VERSION_MINOR ${PYTHON3_VERSION_MINOR})
include(../common.cmake)
unset(PYTHON_INCLUDE_PATH)
unset(PYTHON_NUMPY_INCLUDE_PATH)
unset(PYTHON_EXECUTABLE)
unset(PYTHON_DEBUG_LIBRARIES)
unset(PYTHON_LIBRARIES)
unset(PYTHON_PACKAGES_PATH)
unset(PYTHON_VERSION_MAJOR)
unset(PYTHON_VERSION_MINOR)