Commit 65ad1298 authored by Zhenguo Yan's avatar Zhenguo Yan

merge Python cmake

parent cefb4a7e
......@@ -35,63 +35,42 @@ IF (NEKTAR_BUILD_PYTHON)
FIND_PACKAGE(PythonInterp ${PYTHONVER} REQUIRED)
FIND_PACKAGE(PythonLibsNew ${PYTHONVER} REQUIRED)
# Find Python
FIND_PACKAGE(PythonInterp ${PYTHONVER} REQUIRED)
FIND_PACKAGE(PythonLibsNew ${PYTHONVER} REQUIRED)
# Save include dir in Cache for subsequent configures.
SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} CACHE INTERNAL "" FORCE)
# Include headers from root directory for config file.
# Now try to find Boost::Python. For now we are relying entirely on
# distributed versions of this (versus trying to compile via ThirdParty)
# because they come with various names and FindBoost is not really geared up
# for this at present. Therefore this is done separately to avoid lots of
# warnings and extraneous output.
#
# We need to try a few variants, depending on if we're doing Python 2 or
# Python 3. Irritatingly this is all very much distriution dependent so we
# just take our best guess at filenames. Seemingly from Boost 1.67 onwards,
# names are just `python27` and `numpy32` but for now we have to deal with
# this ourselves.
STRING(REPLACE "." ";" BOOST_PYTHON_VERSION ${PYTHONLIBS_VERSION_STRING})
LIST(GET BOOST_PYTHON_VERSION 0 BOOST_PYTHON_VERSION_MAJOR)
LIST(GET BOOST_PYTHON_VERSION 1 BOOST_PYTHON_VERSION_MINOR)
SET(TMP_BOOST_LIST ${NEEDED_BOOST_LIBS})
# If we're using multi-threaded, the existing library likely has a '-mt'
# suffix so we need to append this too.
IF (Boost_SYSTEM_LIBRARY MATCHES "-mt")
SET(BOOST_LIB_SUFFIX "-mt")
ENDIF()
# Try to find Boost::Python
FIND_LIBRARY(BOOST_PYTHON_LIB
NAMES boost_python-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_python-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_LIB_SUFFIX}
PATHS ${Boost_LIBRARY_DIRS})
IF (NOT BOOST_PYTHON_LIB)
MESSAGE(FATAL_ERROR "Could not find Boost Python installation: check it is installed in your distribution.")
ENDIF()
# Include headers from root directory for config file.
# Now try to find Boost::Python. For now we are relying entirely on
# distributed versions of this (versus trying to compile via ThirdParty)
# because they come with various names and FindBoost is not really geared up
# for this at present. Therefore this is done separately to avoid lots of
# warnings and extraneous output.
#
# We need to try a few variants, depending on if we're doing Python 2 or
# Python 3. Irritatingly this is all very much distriution dependent so we
# just take our best guess at filenames. Seemingly from Boost 1.67 onwards,
# names are just `python27` and `numpy32` but for now we have to deal with
# this ourselves.
STRING(REPLACE "." ";" BOOST_PYTHON_VERSION ${PYTHONLIBS_VERSION_STRING})
LIST(GET BOOST_PYTHON_VERSION 0 BOOST_PYTHON_VERSION_MAJOR)
LIST(GET BOOST_PYTHON_VERSION 1 BOOST_PYTHON_VERSION_MINOR)
SET(TMP_BOOST_LIST ${NEEDED_BOOST_LIBS})
# If we're using multi-threaded, the existing library likely has a '-mt'
# suffix so we need to append this too.
IF (Boost_SYSTEM_LIBRARY MATCHES "-mt")
SET(BOOST_LIB_SUFFIX "-mt")
ENDIF()
# Try to find Boost.NumPy
FIND_LIBRARY(BOOST_NUMPY_LIB
NAMES boost_numpy-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_numpy${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_numpy-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_numpy${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_numpy${BOOST_LIB_SUFFIX}
PATHS ${Boost_LIBRARY_DIRS})
# Try to find Boost::Python
FIND_LIBRARY(BOOST_PYTHON_LIB
NAMES boost_python-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_PYTHON_VERSION_MAJOR}${BOOST_PYTHON_VERSION_MINOR}${BOOST_LIB_SUFFIX}
boost_python-py${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_PYTHON_VERSION_MAJOR}${BOOST_LIB_SUFFIX}
boost_python${BOOST_LIB_SUFFIX}
PATHS ${Boost_LIBRARY_DIRS})
SET(NEKTAR_PYTHON3_STATUS ${NEKTAR_USE_PYTHON3} CACHE INTERNAL "")
IF (NOT BOOST_PYTHON_LIB)
MESSAGE(FATAL_ERROR "Could not find Boost Python installation: check it is installed in your distribution.")
ENDIF()
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
ADD_DEFINITIONS(-DWITH_PYTHON)
# Try to find Boost.NumPy
FIND_LIBRARY(BOOST_NUMPY_LIB
......
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