FindPythonLibs.cmake 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. ~/Library/Frameworks/Python.framework/Headers
  49. /Library/Frameworks/Python.framework/Headers
  50. ~/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3
  51. /Library/Frameworks/Python.framework/Versions/2.3/include/python2.3
  52. ~/Library/Frameworks/Python.framework/Versions/2.2/include/python2.2
  53. /Library/Frameworks/Python.framework/Versions/2.2/include/python2.2
  54. ~/Library/Frameworks/Python.framework/Versions/2.1/include/python2.1
  55. /Library/Frameworks/Python.framework/Versions/2.1/include/python2.1
  56. ~/Library/Frameworks/Python.framework/Versions/2.0/include/python2.0
  57. /Library/Frameworks/Python.framework/Versions/2.0/include/python2.0
  58. ~/Library/Frameworks/Python.framework/Versions/1.6/include/python1.6
  59. /Library/Frameworks/Python.framework/Versions/1.6/include/python1.6
  60. ~/Library/Frameworks/Python.framework/Versions/1.5/include/python1.5
  61. /Library/Frameworks/Python.framework/Versions/1.5/include/python1.5
  62. /usr/include/python2.3
  63. /usr/include/python2.2
  64. /usr/include/python2.1
  65. /usr/include/python2.0
  66. /usr/include/python1.6
  67. /usr/include/python1.5
  68. /usr/include
  69. /usr/local/include
  70. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/include
  71. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/include
  72. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/include
  73. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/include
  74. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]/include
  75. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/include
  76. )
  77. IF (WIN32)
  78. MARK_AS_ADVANCED(
  79. PYTHON_DEBUG_LIBRARY
  80. PYTHON_LIBRARY
  81. PYTHON_INCLUDE_PATH
  82. )
  83. ENDIF(WIN32)
  84. # Python Should be built and installed as a Framework on OSX
  85. IF (APPLE)
  86. IF(EXISTS ~/Library/Frameworks/Python.framework)
  87. SET(PYTHON_HAVE_FRAMEWORK 1)
  88. ENDIF(EXISTS ~/Library/Frameworks/Python.framework)
  89. IF(EXISTS /Library/Frameworks/Python.framework)
  90. SET(PYTHON_HAVE_FRAMEWORK 1)
  91. ENDIF(EXISTS /Library/Frameworks/Python.framework)
  92. IF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
  93. SET(PYTHON_LIBRARY "")
  94. SET(PYTHON_DEBUG_LIBRARY "")
  95. ENDIF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
  96. IF(PYTHON_HAVE_FRAMEWORK)
  97. IF(NOT PYTHON_LIBRARY)
  98. SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
  99. ENDIF(NOT PYTHON_LIBRARY)
  100. IF(NOT PYTHON_DEBUG_LIBRARY)
  101. SET (PYTHON_DEBUG_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
  102. ENDIF(NOT PYTHON_DEBUG_LIBRARY)
  103. ENDIF(PYTHON_HAVE_FRAMEWORK)
  104. ENDIF (APPLE)