Skip to content
Snippets Groups Projects
Commit 3d9dc6a2 authored by Dalai Felinto's avatar Dalai Felinto
Browse files

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)
parent b3c08969
Branches
Tags
No related merge requests found
...@@ -124,6 +124,10 @@ mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a secur ...@@ -124,6 +124,10 @@ mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a secur
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_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) 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_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_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) option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON)
...@@ -1457,11 +1461,10 @@ elseif(APPLE) ...@@ -1457,11 +1461,10 @@ elseif(APPLE)
endif() endif()
if(WITH_PYTHON) 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 # 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_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
# set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
set(PYTHON_LIBRARY python${PYTHON_VERSION}m) set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
...@@ -1469,9 +1472,6 @@ elseif(APPLE) ...@@ -1469,9 +1472,6 @@ elseif(APPLE)
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled # set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
else() else()
# module must be compiled against Python framework # 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_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_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
#set(PYTHON_LIBRARY python${PYTHON_VERSION}) #set(PYTHON_LIBRARY python${PYTHON_VERSION})
...@@ -1573,8 +1573,8 @@ elseif(APPLE) ...@@ -1573,8 +1573,8 @@ elseif(APPLE)
set(WITH_INPUT_NDOF OFF) # unsupported set(WITH_INPUT_NDOF OFF) # unsupported
endif() endif()
if(WITH_PYTHON_MODULE) 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 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")# force cmake to link right framework
endif() endif()
if(WITH_OPENCOLLADA) if(WITH_OPENCOLLADA)
...@@ -2182,6 +2182,9 @@ if(FIRST_RUN) ...@@ -2182,6 +2182,9 @@ if(FIRST_RUN)
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY) info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
info_cfg_option(WITH_PYTHON_MODULE) info_cfg_option(WITH_PYTHON_MODULE)
info_cfg_option(WITH_PYTHON_SAFETY) info_cfg_option(WITH_PYTHON_SAFETY)
if(APPLE)
info_cfg_option(WITH_PYTHON_FRAMEWORK)
endif()
info_cfg_text("Modifiers:") info_cfg_text("Modifiers:")
info_cfg_option(WITH_MOD_BOOLEAN) info_cfg_option(WITH_MOD_BOOLEAN)
......
...@@ -689,7 +689,7 @@ elseif(APPLE) ...@@ -689,7 +689,7 @@ elseif(APPLE)
) )
# python # 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, # the python zip is first extract as part of the build process,
# and then later installed as part of make install. this is much # and then later installed as part of make install. this is much
# quicker, and means we can easily exclude files on copy # quicker, and means we can easily exclude files on copy
...@@ -742,7 +742,7 @@ elseif(APPLE) ...@@ -742,7 +742,7 @@ elseif(APPLE)
) )
# python # python
if(WITH_PYTHON) if(WITH_PYTHON AND NOT WITH_PYTHON_FRAMEWORK)
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/ COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment