Experimental option to build blender as a python module, rather then blender embeddin...
[blender.git] / source / creator / CMakeLists.txt
index 9e52f1881953292f02427ac5c934e11814c2a35c..f74dc655764ef01d01167afc1f8cb04cb1e6f1ab 100644 (file)
@@ -127,8 +127,21 @@ if(WITH_BUILDINFO)
 endif()
 
 # message(STATUS "Configuring blender")
-
-add_executable(blender ${EXETYPE} ${SRC})
+if(WITH_PYTHON_MODULE)
+       add_definitions(-DWITH_PYTHON_MODULE)
+
+       # creates ./bin/bpy.so which can be imported as a python module.
+       add_library(blender SHARED ${SRC})
+       set_target_properties(
+               blender
+               PROPERTIES
+                        PREFIX ""
+                        OUTPUT_NAME bpy
+                        LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/
+       )
+else()
+       add_executable(blender ${EXETYPE} ${SRC})
+endif()
 
 # Post build steps for bundling/packaging.