mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
cmake: python module updates
This commit is contained in:
parent
c0a27ea1a1
commit
4adede4246
@ -37,6 +37,7 @@ if(PYTHON_EXECUTABLE)
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID AND NOT IOS)
|
||||
ocv_check_environment_variables(PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
|
||||
if(CMAKE_VERSION VERSION_GREATER 2.8.8 AND PYTHON_VERSION_FULL)
|
||||
find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
|
||||
else()
|
||||
|
@ -11,6 +11,17 @@ if(NOT COMMAND find_host_program)
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
macro(ocv_check_environment_variables)
|
||||
foreach(_var ${ARGN})
|
||||
if(NOT DEFINED ${_var} AND DEFINED ENV{${_var}})
|
||||
set(__value "$ENV{${_var}}")
|
||||
file(TO_CMAKE_PATH "${__value}" __value) # Assume that we receive paths
|
||||
set(${_var} "${__value}")
|
||||
message(STATUS "Update variable ${_var} from environment: ${${_var}}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
||||
function(ocv_include_directories)
|
||||
set(__add_before "")
|
||||
|
@ -105,10 +105,29 @@ else()
|
||||
set(PYTHON_INSTALL_CONFIGURATIONS "")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${the_module}
|
||||
${PYTHON_INSTALL_CONFIGURATIONS}
|
||||
RUNTIME DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT main
|
||||
LIBRARY DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT main
|
||||
ARCHIVE DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT main
|
||||
)
|
||||
install(FILES src2/cv.py ${PYTHON_INSTALL_CONFIGURATIONS} DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT main)
|
||||
if(WIN32)
|
||||
set(PYTHON_INSTALL_ARCHIVE "")
|
||||
else()
|
||||
set(PYTHON_INSTALL_ARCHIVE ARCHIVE DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT main)
|
||||
endif()
|
||||
|
||||
if(NOT INSTALL_CREATE_DISTRIB)
|
||||
install(TARGETS ${the_module}
|
||||
${PYTHON_INSTALL_CONFIGURATIONS}
|
||||
RUNTIME DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT main
|
||||
LIBRARY DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT main
|
||||
${PYTHON_INSTALL_ARCHIVE}
|
||||
)
|
||||
install(FILES src2/cv.py ${PYTHON_INSTALL_CONFIGURATIONS} DESTINATION ${PYTHON_PACKAGES_PATH} COMPONENT main)
|
||||
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 main
|
||||
LIBRARY DESTINATION python/${__ver}/${OpenCV_ARCH} COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user