FindPythonLibs.cmake 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #
  2. # This module finds if Python is installed and determines where the
  3. # include files and libraries are. It also determines what the name of
  4. # the library is. This code sets the following variables:
  5. #
  6. # PYTHON_LIBRARY = the full path to the library found
  7. # PYTHON_INCLUDE_PATH = the path to where tcl.h can be found
  8. # PYTHON_DEBUG_LIBRARY = the full path to the debug library found
  9. #
  10. IF(WIN32)
  11. FIND_LIBRARY(PYTHON_DEBUG_LIBRARY
  12. NAMES python23_d python22_d python21_d python20_d python
  13. PATHS
  14. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs/Debug
  15. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs
  16. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs/Debug
  17. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs
  18. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs/Debug
  19. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs
  20. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs/Debug
  21. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs
  22. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/libs/Debug
  23. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/libs
  24. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs/Debug
  25. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs
  26. )
  27. ENDIF(WIN32)
  28. FIND_LIBRARY(PYTHON_LIBRARY
  29. NAMES python23 python2.3 python22 python2.2 python21 python2.1
  30. python20 python2.0 python16 python1.6 python15 python1.5
  31. PATHS
  32. /usr/lib/python2.3/config
  33. /usr/lib/python2.2/config
  34. /usr/lib/python2.1/config
  35. /usr/lib/python2.0/config
  36. /usr/lib/python1.6/config
  37. /usr/lib/python1.5/config
  38. /usr/lib
  39. /usr/local/lib
  40. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs
  41. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs
  42. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs
  43. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs
  44. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/libs
  45. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs
  46. )
  47. FIND_PATH(PYTHON_INCLUDE_PATH Python.h
  48. /usr/include/python2.3
  49. /usr/include/python2.2
  50. /usr/include/python2.1
  51. /usr/include/python2.0
  52. /usr/include/python1.6
  53. /usr/include/python1.5
  54. /usr/include
  55. /usr/local/include
  56. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/include
  57. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/include
  58. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/include
  59. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/include
  60. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/include
  61. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/include
  62. )
  63. IF (WIN32)
  64. MARK_AS_ADVANCED(
  65. PYTHON_DEBUG_LIBRARY
  66. PYTHON_LIBRARY
  67. PYTHON_INCLUDE_PATH
  68. )
  69. ENDIF(WIN32)
  70. # Python Should be built and installed as a Framework on OSX
  71. IF (APPLE)
  72. IF (EXISTS ~/Library/Frameworks/Python.framework)
  73. SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
  74. SET (PYTHON_INCLUDE_PATH "~/Library/Frameworks/Python.framework/Headers" CACHE INTERNAL "Hack into the framework")
  75. ENDIF (EXISTS ~/Library/Frameworks/Python.framework)
  76. IF (EXISTS /Library/Frameworks/Python.framework)
  77. SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
  78. SET (PYTHON_INCLUDE_PATH "/Library/Frameworks/Python.framework/Headers" CACHE INTERNAL "Hack into the framework")
  79. ENDIF (EXISTS /Library/Frameworks/Python.framework)
  80. ENDIF (APPLE)