Commit 52a5b977 authored by David Gobbi's avatar David Gobbi

14552: Check python interp and lib versions.

Add a variable to allow the user to choose a version for the python
interpreter.  Attempt to locate libraries with the same version number.
Emit a warning if the library version number and the interpreter
version number do not match.

Change-Id: I0c555c01deb7d6fa9a4f57d65ff5125463de7aef
parent cf3929c5
......@@ -33,10 +33,15 @@ INCLUDE(CMakeFindFrameworks)
# Search for the python framework on Apple.
CMAKE_FIND_FRAMEWORKS(Python)
set(_PythonInterp_VERSION)
if(PYTHONINTERP_FOUND)
set(_PythonInterp_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
endif()
# Set up the versions we know about, in the order we will search. Always add
# the user supplied additional versions to the front.
set(_Python_VERSIONS
${Python_ADDITIONAL_VERSIONS}
${Python_ADDITIONAL_VERSIONS} ${_PythonInterp_VERSION}
2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
FOREACH(_CURRENT_VERSION ${_Python_VERSIONS})
......
......@@ -59,7 +59,7 @@ function (vtk_module_python_package name)
endif()
endforeach()
find_package(PythonInterp REQUIRED)
find_package(PythonInterp ${VTK_PYTHON_VERSION} REQUIRED)
set (_depencies)
foreach(pkg ${_packages})
......
find_package(PythonLibs REQUIRED)
include(vtkWrapPython)
if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND)
set(_interp_version "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
set(_libs_version "${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}")
if(NOT ${_interp_version} STREQUAL ${_libs_version})
message(WARNING "Python library ${_libs_version} mismatches python ${_interp_version}.")
endif()
endif()
function(vtk_add_python_wrapping module_name)
if(NOT VTK_WRAP_PYTHON_INIT_EXE)
......
......@@ -356,6 +356,8 @@ include(VTKParallelCMakeTests)
# Add the option for build the Python wrapping to VTK.
option(VTK_WRAP_PYTHON "Should VTK Python wrapping be built?" OFF)
set(VTK_PYTHON_VERSION 2 CACHE STRING
"Python version to use: 2, 2.x, or empty")
# Add the option for build the Python wrapping to VTK.
option(VTK_WRAP_JAVA "Should VTK Java wrapping be built?" OFF)
......@@ -376,7 +378,7 @@ mark_as_advanced(VTK_WRAP_HINTS)
if(BUILD_TESTING OR VTK_WRAP_PYTHON)
# Need PYTHON_EXECUTABLE for HeaderTesting or python wrapping
find_package(PythonInterp QUIET)
find_package(PythonInterp ${VTK_PYTHON_VERSION} QUIET)
mark_as_advanced(PYTHON_EXECUTABLE)
endif()
......
......@@ -13,7 +13,7 @@ PROJECT(mpi4py)
# Set locations where to install the binaries.
# MPI4PY_INSTALL_PACKAGE_DIR is the location where all mpi4py package is
# installed.
# installed.
# are to be installed.
if (NOT MPI4PY_INSTALL_PACKAGE_DIR)
set (MPI4PY_INSTALL_PACKAGE_DIR "lib/site-packages")
......@@ -23,8 +23,8 @@ if (NOT MPI4PY_PACKAGE_BINARY_DIR)
set (MPI4PY_PACKAGE_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
endif()
FIND_PACKAGE(PythonInterp)
FIND_PACKAGE(PythonLibs)
FIND_PACKAGE(PythonInterp ${VTK_PYTHON_VERSION})
FIND_PACKAGE(PythonLibs ${VTK_PYTHON_VERSION})
FIND_PACKAGE(MPI)
# -------------------------------------------------------------------------
......
......@@ -92,8 +92,8 @@ endif(XDMF_WRAP_PYTHON OR XDMF_WRAP_JAVA)
# If we are wrapping python, let's include it in the top level
if(XDMF_WRAP_PYTHON)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonInterp ${VTK_PYTHON_VERSION} REQUIRED)
find_package(PythonLibs ${VTK_PYTHON_VERSION} REQUIRED)
if (XDMF_BUILD_DSM)
find_package (MPI4PY REQUIRED)
if (MPI4PY_FOUND)
......
vtk_module_impl()
vtk_module_export("")
find_package(PythonInterp REQUIRED)
find_package(PythonInterp ${VTK_PYTHON_VERSION} REQUIRED)
set(WEB_APPLICATIONS
Cone
......
vtk_module_impl()
vtk_module_export("")
find_package(PythonInterp REQUIRED)
find_package(PythonInterp ${VTK_PYTHON_VERSION} REQUIRED)
if(NOT vtkWeb_WWW_DEST)
set(vtkWeb_WWW_DEST "${VTK_WWW_DIR}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment