@ -2,7 +2,7 @@ if(WIN32 AND NOT PYTHON_EXECUTABLE)
# s e a r c h f o r e x e c u t a b l e w i t h t h e s a m e b i t n e s s a s r e s u l t i n g b i n a r i e s
# s t a n d a r d F i n d P y t h o n I n t e r p a l w a y s p r e f e r s e x e c u t a b l e f r o m s y s t e m p a t h
# t h i s i s r e a l l y i m p o r t a n t b e c a u s e w e a r e u s i n g t h e i n t e r p r e t e r f o r n u m p y s e a r c h a n d f o r c h o o s i n g t h e i n s t a l l l o c a t i o n
foreach ( _CURRENT_VERSION ${ Python_ADDITIONAL_VERSIONS } 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 )
foreach ( _CURRENT_VERSION ${ Python_ADDITIONAL_VERSIONS } 2.7 "${MIN_VER_PYTHON}" )
find_host_program ( PYTHON_EXECUTABLE
N A M E S p y t h o n $ { _ C U R R E N T _ V E R S I O N } p y t h o n
P A T H S
@ -12,39 +12,15 @@ if(WIN32 AND NOT PYTHON_EXECUTABLE)
)
endforeach ( )
endif ( )
find_host_package ( PythonInterp 2.0 )
find_host_package ( PythonInterp "${MIN_VER_PYTHON}" )
unset ( HAVE_SPHINX CACHE )
if ( PYTHON_EXECUTABLE )
if ( PYTHON_VERSION_STRING )
set ( PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" )
set ( PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}" )
else ( )
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
E R R O R _ 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}" )
endif ( )
if ( "${PYTHON_VERSION_FULL}" MATCHES "[0-9]+.[0-9]+.[0-9]+" )
set ( PYTHON_VERSION_FULL "${CMAKE_MATCH_0}" )
elseif ( "${PYTHON_VERSION_FULL}" MATCHES "[0-9]+.[0-9]+" )
set ( PYTHON_VERSION_FULL "${CMAKE_MATCH_0}" )
else ( )
unset ( PYTHON_VERSION_FULL )
endif ( )
if ( PYTHONINTERP_FOUND )
set ( PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" )
if ( NOT ANDROID AND NOT IOS )
if ( CMAKE_VERSION VERSION_GREATER 2.8.8 AND PYTHON_VERSION_FULL )
find_host_package ( PythonLibs ${ PYTHON_VERSION_FULL } EXACT )
else ( )
find_host_package ( PythonLibs ${ PYTHON_VERSION_FULL } )
endif ( )
# 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 ( )
find_host_package ( PythonLibs "${PYTHON_VERSION_STRING}" EXACT )
endif ( )
if ( NOT ANDROID AND NOT IOS )
@ -78,28 +54,29 @@ if(PYTHON_EXECUTABLE)
endif ( )
SET ( PYTHON_PACKAGES_PATH "${_PYTHON_PACKAGES_PATH}" CACHE PATH "Where to install the python packages." )
if ( NOT PYTHON_NUMPY_INCLUDE_DIR )
if ( NOT PYTHON_NUMPY_INCLUDE_DIRS )
# 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 os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print(numpy.distutils.misc_util.get_numpy_include_dirs()[0])"
execute_process ( COMMAND "${PYTHON_EXECUTABLE}" -c
" i m p o r t o s ; o s . e n v i r o n [ ' D I S T U T I L S _ U S E _ S D K ' ] = ' 1 ' ; i m p o r t n u m p y . d i s t u t i l s ; print ( os.pathsep.join(numpy.distutils.misc_util.get_numpy_include_dirs( ) ) ) "
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
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 )
file ( TO_CMAKE_PATH "${PYTHON_NUMPY_INCLUDE_DIR}" _PYTHON_NUMPY_INCLUDE_DIR )
set ( PYTHON_NUMPY_INCLUDE_DIR ${ _PYTHON_NUMPY_INCLUDE_DIR } CACHE PATH "Path to numpy headers" )
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" )
endif ( )
endif ( )
if ( PYTHON_NUMPY_INCLUDE_DIR )
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } -c "import numpy; print(numpy.version.version)"
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
if ( PYTHON_NUMPY_INCLUDE_DIRS )
execute_process ( COMMAND "${PYTHON_EXECUTABLE}" -c "import numpy; print(numpy.version.version)"
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 _ 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 )
endif ( )
endif ( NOT ANDROID AND NOT IOS )
endif ( )
if ( BUILD_DOCS )
if ( BUILD_DOCS )
find_host_program ( SPHINX_BUILD sphinx-build )
if ( SPHINX_BUILD )
execute_process ( COMMAND "${SPHINX_BUILD}"
@ -112,5 +89,4 @@ if(PYTHON_EXECUTABLE)
message ( STATUS "Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}" )
endif ( )
endif ( )
endif ( BUILD_DOCS )
endif ( PYTHON_EXECUTABLE )
endif ( BUILD_DOCS )