support for blender as a module on win32.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 24 Mar 2011 00:14:49 +0000 (00:14 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 24 Mar 2011 00:14:49 +0000 (00:14 +0000)
CMakeLists.txt
build_files/cmake/macros.cmake
source/creator/CMakeLists.txt

index d860d52..afb3d71 100644 (file)
@@ -1016,6 +1016,13 @@ if(WITH_OPENMP)
        mark_as_advanced(OpenMP_CXX_FLAGS)
 endif() 
 
+#-----------------------------------------------------------------------------
+# Configure Python.
+
+if(WITH_PYTHON_MODULE)
+       add_definitions(-DPy_ENABLE_SHARED)
+endif() 
+
 #-----------------------------------------------------------------------------
 # Extra compile flags
 
index 2297cac..0731472 100644 (file)
@@ -66,7 +66,7 @@ macro(SETUP_LIBDIRS)
 
        link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
 
-       if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE)
+       if(WITH_PYTHON)  #  AND NOT WITH_PYTHON_MODULE  # WIN32 needs
                link_directories(${PYTHON_LIBPATH})
        endif()
        if(WITH_INTERNATIONAL)
@@ -127,7 +127,7 @@ macro(setup_liblinks
        target_link_libraries(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${LLIBS})
 
        # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
-       if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE)
+       if(WITH_PYTHON)  # AND NOT WITH_PYTHON_MODULE  # WIN32 needs
                target_link_libraries(${target} ${PYTHON_LINKFLAGS})
 
                if(WIN32 AND NOT UNIX)
index f13f3f7..99c7dba 100644 (file)
@@ -169,7 +169,18 @@ if(WITH_PYTHON_MODULE)
                         PREFIX ""
                         OUTPUT_NAME bpy
                         LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/
+                        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/  # only needed on windows
        )
+       
+       if(WIN32)
+               # python modules use this
+               set_target_properties(
+                       blender
+                       PROPERTIES
+                                SUFFIX ".pyd"
+               )       
+       endif()
+       
 else()
        add_executable(blender ${EXETYPE} ${SRC})
 endif()