Experimental option to build blender as a python module, rather then blender embedding python.

CMake build option WITH_PYTHON_MODULE, will build ./bin/bpy.so

This allows 'bpy' to be imported from python or other applications/IDE's which embed python, eg:
   python -c "import bpy ; bpy.ops.render.render(write_still=True)"

This runs in background mode and has similar restrictions to running a script:
   blender --background --python test.py

TODO:
 - install to site-packages with blender scripts
 - add support for imp.reload()
This commit is contained in:
Campbell Barton
2011-02-20 23:39:29 +00:00
parent 55a0e21a03
commit c30149991c
9 changed files with 114 additions and 15 deletions

View File

@@ -69,6 +69,7 @@ get_blender_version()
# Blender internal features
option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
option(WITH_PYTHON "Enable Embedded Python API" ON)
option(WITH_PYTHON_MODULE "Enable building as a python module (experemental)" OFF)
option(WITH_BUILDINFO "Include extra build details" ON)
option(WITH_IK_ITASC "Enable ITASC IK solver" ON)
option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke and audio effects)" OFF)
@@ -1038,6 +1039,9 @@ endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
#-------------------------------------------------------------------------------
# Global Defines
# better not define flags here but this is a debugging option thats off by default.
if(WITH_CXX_GUARDEDALLOC)
set(CMAKE_CXX_FLAGS " -DWITH_CXX_GUARDEDALLOC -I${CMAKE_SOURCE_DIR}/intern/guardedalloc ${CMAKE_CXX_FLAGS}")