OSX: fix compiling Blender as MODULE
authorJens Verwiebe <info@jensverwiebe.de>
Tue, 10 Jan 2012 16:47:20 +0000 (16:47 +0000)
committerJens Verwiebe <info@jensverwiebe.de>
Tue, 10 Jan 2012 16:47:20 +0000 (16:47 +0000)
source/creator/CMakeLists.txt

index bfb27f0a20f01b602e40e3a09c9be71c1706855c..0938798c185b505b452fdd0b743b477a34056ca0 100644 (file)
@@ -165,24 +165,38 @@ 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
-                       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin  # only needed on windows
-       )
+       if(APPLE)
+               add_library(blender MODULE ${SRC})
+               set_target_properties(
+                       blender
+                       PROPERTIES
+                               PREFIX ""
+                               OUTPUT_NAME bpy
+                               LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+                               RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin  # only needed on windows
+               )
+               TARGET_LINK_LIBRARIES(blender -Wl,-undefined -Wl,dynamic_lookup)
 
-       if(WIN32)
-               # python modules use this
+       else(APPLE)
+               add_library(blender SHARED ${SRC})
                set_target_properties(
                        blender
                        PROPERTIES
-                       SUFFIX ".pyd"
+                               PREFIX ""
+                               OUTPUT_NAME bpy
+                               LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+                               RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin  # only needed on windows
                )
-       endif()
+
+               if(WIN32)
+                       # python modules use this
+                       set_target_properties(
+                               blender
+                               PROPERTIES
+                               SUFFIX ".pyd"
+                       )
+               endif()
+       endif(APPLE)
 
 else()
        add_executable(blender ${EXETYPE} ${SRC})