@ -63,6 +63,19 @@ if(MSVC)
set ( CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE )
endif ( )
# i n c a s e o f c r o s s c o m p i l a t i o n t h i s m a c r o w i l l s e a r c h p a c k a g e s
# f o r h o s t s y s t e m i n s t e a d o f p a c k a g e s f o r t a r g e t s y s t e m
if ( NOT COMMAND find_host_package )
macro ( find_host_package )
find_package ( ${ ARGN } )
endmacro ( )
endif ( )
if ( NOT COMMAND find_host_program )
macro ( find_host_program )
find_program ( ${ ARGN } )
endmacro ( )
endif ( )
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I n d i c a t e C M a k e 2 . 7 a n d a b o v e t h a t w e d o n ' t w a n t t o m i x r e l a t i v e
@ -168,7 +181,7 @@ set(PACKAGE_VERSION "${OPENCV_VERSION}")
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# A u t o d e t e c t i f w e a r e i n a S V N r e p o s i t o r y
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
find_program ( SVNVERSION_PATH svnversion )
find_host_ program ( SVNVERSION_PATH svnversion )
mark_as_advanced ( force SVNVERSION_PATH )
if ( SVNVERSION_PATH )
message ( STATUS "Extracting svn version, please wait..." )
@ -564,69 +577,74 @@ if(WITH_OPENEXR)
include ( OpenCVFindOpenEXR.cmake )
endif ( )
# P y t h o n s u p p o r t
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
set ( BUILD_NEW_PYTHON_SUPPORT ON CACHE BOOL "Build with Python support" )
if ( WIN32 )
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
set ( BUILD_NEW_PYTHON_SUPPORT OFF )
endif ( )
set ( BUILD_NEW_PYTHON_SUPPORT OFF )
endif ( )
endif ( )
if ( ANDROID )
set ( BUILD_NEW_PYTHON_SUPPORT OFF )
endif ( )
if ( BUILD_NEW_PYTHON_SUPPORT )
find_package ( PythonInterp )
find_package ( PythonLibs )
# A l w a y s t r y t o f i n d p y t h o n
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
find_host_package ( PythonInterp )
find_host_package ( PythonLibs )
# c m a k e 2 . 4 ( at least on Ubuntu 8.04 ( hardy ) ) d o n ' t d e f i n e P Y T H O N L I B S _ F O U N D
if ( NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH )
set ( PYTHONLIBS_FOUND ON )
endif ( NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH )
# c m a k e 2 . 4 ( at least on Ubuntu 8.04 ( hardy ) ) d o n ' t d e f i n e P Y T H O N L I B S _ F O U N D
if ( NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH )
set ( PYTHONLIBS_FOUND ON )
endif ( NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH )
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } --version
E R R O R _ V A R I A B L E P Y T H O N _ V E R S I O N _ F U L L
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } --version
E R R O R _ V A R I A B L E P Y T H O N _ V E R S I O N _ F U L L
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
string ( REGEX MATCH "[0-9].[0-9]" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}" )
if ( UNIX )
set ( PYTHON_PLUGIN_INSTALL_PATH lib/python ${ PYTHON_VERSION_MAJOR_MINOR } /site-packages/opencv )
if ( APPLE )
set ( PYTHON_PACKAGES_PATH lib/python ${ PYTHON_VERSION_MAJOR_MINOR } /site-packages CACHE PATH "Where to install the python packages." )
else ( ) # d e b i a n b a s e d a s s u m e d , i n s t a l l t o t h e d i s t - p a c k a g e s .
set ( PYTHON_PACKAGES_PATH lib/python ${ PYTHON_VERSION_MAJOR_MINOR } /dist-packages CACHE PATH "Where to install the python packages." )
endif ( )
endif ( )
if ( WIN32 )
get_filename_component ( PYTHON_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION_MAJOR_MINOR}\\InstallPath]" ABSOLUTE CACHE )
set ( PYTHON_PLUGIN_INSTALL_PATH "${PYTHON_PATH}/Lib/site-packages/opencv" )
set ( PYTHON_PACKAGES_PATH "${PYTHON_PATH}/Lib/site-packages" )
string ( REGEX MATCH "[0-9].[0-9]" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}" )
if ( UNIX )
set ( PYTHON_PLUGIN_INSTALL_PATH lib/python ${ PYTHON_VERSION_MAJOR_MINOR } /site-packages/opencv )
if ( APPLE )
set ( PYTHON_PACKAGES_PATH lib/python ${ PYTHON_VERSION_MAJOR_MINOR } /site-packages CACHE PATH "Where to install the python packages." )
else ( ) # d e b i a n b a s e d a s s u m e d , i n s t a l l t o t h e d i s t - p a c k a g e s .
set ( PYTHON_PACKAGES_PATH lib/python ${ PYTHON_VERSION_MAJOR_MINOR } /dist-packages CACHE PATH "Where to install the python packages." )
endif ( )
endif ( )
if ( WIN32 )
get_filename_component ( PYTHON_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION_MAJOR_MINOR}\\InstallPath]" ABSOLUTE CACHE )
set ( PYTHON_PLUGIN_INSTALL_PATH "${PYTHON_PATH}/Lib/site-packages/opencv" )
set ( PYTHON_PACKAGES_PATH "${PYTHON_PATH}/Lib/site-packages" )
endif ( )
# A t t e m p t t o d i s c o v e r t h e N u m P y i n c l u d e d i r e c t o r y . I f t h i s s u c c e e d s , t h e n b u i l d p y t h o n A P I w i t h N u m P y
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } -c "import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
R E S U L T _ V A R I A B L E P Y T H O N _ N U M P Y _ P R O C E S S
O U T P U T _ V A R I A B L E P Y T H O N _ N U M P Y _ I N C L U D E _ D I R S
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
if ( PYTHON_NUMPY_PROCESS EQUAL 0 )
set ( PYTHON_USE_NUMPY 1 )
add_definitions ( -D PYTHON_USE_NUMPY=1 )
include_directories ( AFTER ${ PYTHON_NUMPY_INCLUDE_DIRS } )
message ( STATUS " Use INCLUDE: ${PYTHON_NUMPY_INCLUDE_DIRS}" )
else ( )
set ( PYTHON_USE_NUMPY 0 )
endif ( )
# A t t e m p t t o d i s c o v e r t h e N u m P y i n c l u d e d i r e c t o r y . I f t h i s s u c c e e d s , b u i l d w i t h N u m P y
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } -c "import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
R E S U L T _ V A R I A B L E P Y T H O N _ N U M P Y _ P R O C E S S
O U T P U T _ V A R I A B L E P Y T H O N _ N U M P Y _ I N C L U D E _ D I R S
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
if ( PYTHON_NUMPY_PROCESS EQUAL 0 )
set ( PYTHON_USE_NUMPY 1 )
add_definitions ( -D PYTHON_USE_NUMPY=1 )
include_directories ( AFTER ${ PYTHON_NUMPY_INCLUDE_DIRS } )
message ( STATUS " Use INCLUDE: ${PYTHON_NUMPY_INCLUDE_DIRS}" )
else ( )
set ( PYTHON_USE_NUMPY 0 )
endif ( )
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } -c "import sphinx; print sphinx.__version__"
R E S U L T _ V A R I A B L E S P H I N X _ P R O C E S S
O U T P U T _ V A R I A B L E S P H I N X _ V E R S I O N
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
set ( HAVE_SPHINX 0 )
if ( SPHINX_PROCESS EQUAL 0 )
find_program ( SPHINX_BUILD sphinx-build )
if ( SPHINX_BUILD )
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } -c "import sphinx; print sphinx.__version__"
R E S U L T _ V A R I A B L E S P H I N X _ P R O C E S S
O U T P U T _ V A R I A B L E S P H I N X _ V E R S I O N
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
set ( HAVE_SPHINX 0 )
if ( SPHINX_PROCESS EQUAL 0 )
find_host_program ( SPHINX_BUILD sphinx-build )
if ( SPHINX_BUILD )
set ( HAVE_SPHINX 1 )
message ( STATUS " Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}" )
endif ( )
endif ( )
endif ( )