[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51976] trunk/blender/build_files/cmake/ Modules/FindPythonLibsUnix.cmake: Update to make it work with new debian-like py3.3 packages.

Bastien Montagne montagne29 at wanadoo.fr
Wed Nov 7 12:44:44 CET 2012


Revision: 51976
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51976
Author:   mont29
Date:     2012-11-07 11:44:39 +0000 (Wed, 07 Nov 2012)
Log Message:
-----------
Update to make it work with new debian-like py3.3 packages. A bit hackish (this arch-dependent stuff makes things a bit complex), and probably only working for amd64 arch, but at least should not create any regression...

Modified Paths:
--------------
    trunk/blender/build_files/cmake/Modules/FindPythonLibsUnix.cmake

Modified: trunk/blender/build_files/cmake/Modules/FindPythonLibsUnix.cmake
===================================================================
--- trunk/blender/build_files/cmake/Modules/FindPythonLibsUnix.cmake	2012-11-07 11:41:08 UTC (rev 51975)
+++ trunk/blender/build_files/cmake/Modules/FindPythonLibsUnix.cmake	2012-11-07 11:44:39 UTC (rev 51976)
@@ -9,6 +9,7 @@
 # This module defines
 #  PYTHON_VERSION
 #  PYTHON_INCLUDE_DIRS
+#  PYTHON_INCLUDE_CONFIG_DIRS
 #  PYTHON_LIBRARIES
 #  PYTHON_LIBPATH, Used for installation
 #  PYTHON_LINKFLAGS
@@ -46,17 +47,25 @@
 
 # if the user passes these defines as args, we dont want to overwrite
 SET(_IS_INC_DEF OFF)
+SET(_IS_INC_CONF_DEF OFF)
 SET(_IS_LIB_DEF OFF)
+SET(_IS_LIB_PATH_DEF OFF)
 IF(DEFINED PYTHON_INCLUDE_DIR)
   SET(_IS_INC_DEF ON)
 ENDIF()
+IF(DEFINED PYTHON_INCLUDE_CONFIG_DIR)
+  SET(_IS_INC_CONF_DEF ON)
+ENDIF()
 IF(DEFINED PYTHON_LIBRARY)
   SET(_IS_LIB_DEF ON)
 ENDIF()
+IF(DEFINED PYTHON_LIBPATH)
+  SET(_IS_LIB_PATH_DEF ON)
+ENDIF()
 
 
 # only search for the dirs if we havn't already
-IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
+IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_LIB_PATH_DEF))
 
   SET(_python_ABI_FLAGS
     "m;mu;u; "    # release
@@ -85,9 +94,22 @@
           ${_python_SEARCH_DIRS}
         PATH_SUFFIXES
           include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
+          include/x86_64-linux-gnu/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
       )
     ENDIF()
 
+    IF(NOT DEFINED PYTHON_INCLUDE_CONFIG_DIR)
+      FIND_PATH(PYTHON_INCLUDE_CONFIG_DIR
+        NAMES
+          pyconfig.h
+        HINTS
+          ${_python_SEARCH_DIRS}
+        PATH_SUFFIXES
+          include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
+          include/x86_64-linux-gnu/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
+      )
+    ENDIF()
+
     IF(NOT DEFINED PYTHON_LIBRARY)
       FIND_LIBRARY(PYTHON_LIBRARY
         NAMES
@@ -99,16 +121,33 @@
       )
     ENDIF()
 
-    IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR)
+    IF(NOT DEFINED PYTHON_LIBPATH)
+      FIND_PATH(PYTHON_LIBPATH
+        NAMES
+          "python${PYTHON_VERSION}/abc.py" # This is a bit hackish! :/
+        HINTS
+          ${_python_SEARCH_DIRS}
+        PATH_SUFFIXES
+          lib64 lib
+      )
+    ENDIF()
+
+    IF(PYTHON_LIBRARY AND PYTHON_LIBPATH AND PYTHON_INCLUDE_DIR AND PYTHON_INCLUDE_CONFIG_DIR)
       break()
     ELSE()
       # ensure we dont find values from 2 different ABI versions
       IF(NOT _IS_INC_DEF)
         UNSET(PYTHON_INCLUDE_DIR CACHE)
       ENDIF()
+      IF(NOT _IS_INC_CONF_DEF)
+        UNSET(PYTHON_INCLUDE_CONFIG_DIR CACHE)
+      ENDIF()
       IF(NOT _IS_LIB_DEF)
         UNSET(PYTHON_LIBRARY CACHE)
       ENDIF()
+      IF(NOT _IS_LIB_PATH_DEF)
+        UNSET(PYTHON_LIBPATH CACHE)
+      ENDIF()
     ENDIF()
   ENDFOREACH()
 
@@ -120,22 +159,25 @@
 ENDIF()
 
 UNSET(_IS_INC_DEF)
+UNSET(_IS_INC_CONF_DEF)
 UNSET(_IS_LIB_DEF)
+UNSET(_IS_LIB_PATH_DEF)
 
 # handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF 
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix  DEFAULT_MSG
-    PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
+    PYTHON_LIBRARY PYTHON_LIBPATH PYTHON_INCLUDE_DIR PYTHON_INCLUDE_CONFIG_DIR)
 
 
 IF(PYTHONLIBSUNIX_FOUND)
   # Assign cache items
-  SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR})
+  SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR})
   SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
 
   # we need this for installation
-  GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
+  # XXX No more valid with debian-like py3.3 packages...
+#  GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
 
   # not used
   # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
@@ -143,5 +185,6 @@
 
 MARK_AS_ADVANCED(
   PYTHON_INCLUDE_DIR
+  PYTHON_INCLUDE_CONFIG_DIR
   PYTHON_LIBRARY
 )




More information about the Bf-blender-cvs mailing list