2005-12-14 18:51:08 +00:00
|
|
|
# - Find python libraries
|
2001-05-11 14:27:46 +00:00
|
|
|
# This module finds if Python is installed and determines where the
|
|
|
|
# include files and libraries are. It also determines what the name of
|
|
|
|
# the library is. This code sets the following variables:
|
|
|
|
#
|
2005-12-15 19:17:43 +00:00
|
|
|
# PYTHON_LIBRARIES = path to the python library
|
|
|
|
# PYTHON_INCLUDE_PATH = path to where Python.h is found
|
|
|
|
# PYTHON_DEBUG_LIBRARIES = path to the debug library
|
2001-05-11 14:27:46 +00:00
|
|
|
#
|
|
|
|
|
2004-08-27 02:52:53 +00:00
|
|
|
INCLUDE(CMakeFindFrameworks)
|
2003-12-29 21:18:18 +00:00
|
|
|
|
2001-11-30 15:23:00 +00:00
|
|
|
IF(WIN32)
|
2003-11-20 20:31:40 +00:00
|
|
|
FIND_LIBRARY(PYTHON_DEBUG_LIBRARY
|
2005-02-10 03:45:43 +00:00
|
|
|
NAMES python24_d python23_d python22_d python21_d python20_d python
|
2001-11-30 15:23:00 +00:00
|
|
|
PATHS
|
2005-02-10 03:45:43 +00:00
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs/Debug
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs
|
2002-12-09 21:22:44 +00:00
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs/Debug
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs
|
2002-11-14 14:38:45 +00:00
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs/Debug
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs
|
2002-12-09 21:22:44 +00:00
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs/Debug
|
2001-11-30 15:23:00 +00:00
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs
|
2002-12-09 21:22:44 +00:00
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs/Debug
|
2001-11-30 15:23:00 +00:00
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs
|
2002-12-09 21:22:44 +00:00
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/libs/Debug
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/libs
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs/Debug
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs
|
2001-11-30 15:23:00 +00:00
|
|
|
)
|
|
|
|
ENDIF(WIN32)
|
2001-05-11 14:27:46 +00:00
|
|
|
|
2003-11-20 20:31:40 +00:00
|
|
|
FIND_LIBRARY(PYTHON_LIBRARY
|
2006-03-24 19:47:25 +00:00
|
|
|
NAMES python24 python2.4
|
|
|
|
python23 python2.3
|
|
|
|
python22 python2.2
|
|
|
|
python21 python2.1
|
|
|
|
python20 python2.0
|
|
|
|
python16 python1.6
|
|
|
|
python15 python1.5
|
|
|
|
|
2001-05-11 14:27:46 +00:00
|
|
|
PATHS
|
2006-03-24 19:47:25 +00:00
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/libs
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs
|
|
|
|
|
|
|
|
PATH_SUFFIXES
|
|
|
|
python2.4/config
|
|
|
|
python2.3/config
|
|
|
|
python2.2/config
|
|
|
|
python2.1/config
|
|
|
|
python2.0/config
|
|
|
|
python1.6/config
|
|
|
|
python1.5/config
|
|
|
|
|
|
|
|
# Avoid finding the .dll in the PATH. We want the .lib.
|
|
|
|
NO_SYSTEM_ENVIRONMENT_PATH
|
2001-05-11 14:27:46 +00:00
|
|
|
)
|
2001-12-04 15:27:04 +00:00
|
|
|
|
2003-12-29 21:18:18 +00:00
|
|
|
# Search for the python framework on Apple.
|
|
|
|
CMAKE_FIND_FRAMEWORKS(Python)
|
|
|
|
SET(PYTHON_FRAMEWORK_INCLUDES)
|
|
|
|
IF(Python_FRAMEWORKS)
|
|
|
|
IF(NOT PYTHON_INCLUDE_PATH)
|
2005-02-10 03:45:43 +00:00
|
|
|
FOREACH(version 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
|
2003-12-29 21:18:18 +00:00
|
|
|
FOREACH(dir ${Python_FRAMEWORKS})
|
|
|
|
SET(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES}
|
|
|
|
${dir}/Versions/${version}/include/python${version})
|
|
|
|
ENDFOREACH(dir)
|
|
|
|
ENDFOREACH(version)
|
|
|
|
ENDIF(NOT PYTHON_INCLUDE_PATH)
|
|
|
|
ENDIF(Python_FRAMEWORKS)
|
|
|
|
|
2006-03-24 19:47:25 +00:00
|
|
|
FIND_PATH(PYTHON_INCLUDE_PATH
|
|
|
|
NAMES Python.h
|
|
|
|
|
|
|
|
PATHS
|
|
|
|
${PYTHON_FRAMEWORK_INCLUDES}
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/include
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/include
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/include
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/include
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/include
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/include
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/include
|
|
|
|
|
|
|
|
PATH_SUFFIXES
|
|
|
|
python2.4
|
|
|
|
python2.3
|
|
|
|
python2.2
|
|
|
|
python2.1
|
|
|
|
python2.0
|
|
|
|
python1.6
|
|
|
|
python1.5
|
2001-05-11 14:27:46 +00:00
|
|
|
)
|
|
|
|
|
2001-12-04 15:27:04 +00:00
|
|
|
IF (WIN32)
|
|
|
|
MARK_AS_ADVANCED(
|
2003-11-20 20:31:40 +00:00
|
|
|
PYTHON_DEBUG_LIBRARY
|
|
|
|
PYTHON_LIBRARY
|
2001-12-04 15:27:04 +00:00
|
|
|
PYTHON_INCLUDE_PATH
|
|
|
|
)
|
|
|
|
ENDIF(WIN32)
|
2002-12-27 16:14:52 +00:00
|
|
|
|
|
|
|
# Python Should be built and installed as a Framework on OSX
|
2003-12-29 21:18:18 +00:00
|
|
|
IF(Python_FRAMEWORKS)
|
|
|
|
# If a framework has been selected for the include path,
|
|
|
|
# make sure "-framework" is used to link it.
|
2003-01-03 22:36:34 +00:00
|
|
|
IF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
|
|
|
|
SET(PYTHON_LIBRARY "")
|
|
|
|
SET(PYTHON_DEBUG_LIBRARY "")
|
|
|
|
ENDIF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
|
2003-12-29 21:18:18 +00:00
|
|
|
IF(NOT PYTHON_LIBRARY)
|
|
|
|
SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
|
|
|
|
ENDIF(NOT PYTHON_LIBRARY)
|
|
|
|
IF(NOT PYTHON_DEBUG_LIBRARY)
|
|
|
|
SET (PYTHON_DEBUG_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
|
|
|
|
ENDIF(NOT PYTHON_DEBUG_LIBRARY)
|
|
|
|
ENDIF(Python_FRAMEWORKS)
|
2003-11-20 20:41:29 +00:00
|
|
|
|
|
|
|
# We use PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the cache entries
|
|
|
|
# because they are meant to specify the location of a single library.
|
|
|
|
# We now set the variables listed by the documentation for this
|
|
|
|
# module.
|
|
|
|
SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
|
|
|
|
SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
|