[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54765] trunk/blender: WITH_PYTHON_FRAMEWORK cmake option for OSX

Dalai Felinto dfelinto at gmail.com
Fri Feb 22 23:24:40 CET 2013


Revision: 54765
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54765
Author:   dfelinto
Date:     2013-02-22 22:24:38 +0000 (Fri, 22 Feb 2013)
Log Message:
-----------
WITH_PYTHON_FRAMEWORK cmake option for OSX
This option allow Blender to be linked against the Framework python
It's useful if you want to have blenderplayer and bpy in the same application and need to avoid PyThread problems.

patch reviewed by Jens Verwiebe before 2.66. He may want to change something though.
(also small: I changed:
/Library/Frameworks/Python.framework/Versions//python
by
/Library/Frameworks/Python.framework/Versions//Python
as the latter seems to be the norm)

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/source/creator/CMakeLists.txt

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2013-02-22 20:37:14 UTC (rev 54764)
+++ trunk/blender/CMakeLists.txt	2013-02-22 22:24:38 UTC (rev 54765)
@@ -124,6 +124,10 @@
 
 option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
 option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF)
+if (APPLE)
+	option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
+endif()
+
 option(WITH_BUILDINFO     "Include extra build details (only disable for development & faster builds)" ON)
 option(WITH_IK_ITASC      "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
 option(WITH_IK_SOLVER     "Enable Legacy IK solver (only disable for development)" ON)
@@ -1457,11 +1461,10 @@
 	endif()
 
 	if(WITH_PYTHON)
-		if(NOT WITH_PYTHON_MODULE)
-			# we use precompiled libraries for py 3.3 and up by default
-
+		# we use precompiled libraries for py 3.3 and up by default
+		set(PYTHON_VERSION 3.3)
+		if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
 			# normally cached but not since we include them with blender
-			set(PYTHON_VERSION 3.3)
 			set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
 			# set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
 			set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
@@ -1469,9 +1472,6 @@
 			# set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
 		else()
 			# module must be compiled against Python framework
-
-			# normally cached but not since we include them with blender
-			set(PYTHON_VERSION 3.3)
 			set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m")
 			set(PYTHON_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
 			#set(PYTHON_LIBRARY python${PYTHON_VERSION})
@@ -1573,8 +1573,8 @@
 		set(WITH_INPUT_NDOF OFF)  # unsupported
 	endif()
 	
-	if(WITH_PYTHON_MODULE)
-		set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/python")# force cmake to link right framework
+	if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
+		set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")# force cmake to link right framework
 	endif()
 	
 	if(WITH_OPENCOLLADA)
@@ -2182,6 +2182,9 @@
 	info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
 	info_cfg_option(WITH_PYTHON_MODULE)
 	info_cfg_option(WITH_PYTHON_SAFETY)
+	if(APPLE)
+		info_cfg_option(WITH_PYTHON_FRAMEWORK)
+	endif()
 
 	info_cfg_text("Modifiers:")
 	info_cfg_option(WITH_MOD_BOOLEAN)

Modified: trunk/blender/source/creator/CMakeLists.txt
===================================================================
--- trunk/blender/source/creator/CMakeLists.txt	2013-02-22 20:37:14 UTC (rev 54764)
+++ trunk/blender/source/creator/CMakeLists.txt	2013-02-22 22:24:38 UTC (rev 54765)
@@ -689,7 +689,7 @@
 	)
 
 	# python
-	if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE)
+	if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
 		# the python zip is first extract as part of the build process,
 		# and then later installed as part of make install. this is much
 		# quicker, and means we can easily exclude files on copy
@@ -742,7 +742,7 @@
 		)
 
 		# python
-		if(WITH_PYTHON)
+		if(WITH_PYTHON AND NOT WITH_PYTHON_FRAMEWORK)
 			add_custom_command(
 				OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
 				COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/




More information about the Bf-blender-cvs mailing list