[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43423] trunk/blender/source/creator: Fix for standalone bpy module building link errors on Mac.

Brecht Van Lommel brechtvanlommel at pandora.be
Mon Jan 16 15:13:49 CET 2012


Revision: 43423
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43423
Author:   blendix
Date:     2012-01-16 14:13:41 +0000 (Mon, 16 Jan 2012)
Log Message:
-----------
Fix for standalone bpy module building link errors on Mac.

It seems to be working now, however make sure to build against the exact same
python version as the one you will use it with, the version in the lib/darwin*
directory is likely to differ from python installed on your system.

Modified Paths:
--------------
    trunk/blender/source/creator/CMakeLists.txt
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/source/creator/CMakeLists.txt
===================================================================
--- trunk/blender/source/creator/CMakeLists.txt	2012-01-16 13:13:37 UTC (rev 43422)
+++ trunk/blender/source/creator/CMakeLists.txt	2012-01-16 14:13:41 UTC (rev 43423)
@@ -178,6 +178,15 @@
 			RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin  # only needed on windows
 	)
 
+	if(APPLE)
+		set_target_properties(
+			blender
+			PROPERTIES
+				LINK_FLAGS_RELEASE "${PLATFORM_LINKFLAGS}"
+				LINK_FLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG}"
+		)
+	endif()
+
 	if(WIN32)
 		# python modules use this
 		set_target_properties(
@@ -234,7 +243,11 @@
 	set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
 
 elseif(APPLE)
-	set(TARGETDIR_VER ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION})
+	if(WITH_PYTHON_MODULE)
+		set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
+	else()
+		set(TARGETDIR_VER ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION})
+	endif()
 
 endif()
 

Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c	2012-01-16 13:13:37 UTC (rev 43422)
+++ trunk/blender/source/creator/creator.c	2012-01-16 14:13:41 UTC (rev 43423)
@@ -1108,8 +1108,15 @@
 /* allow python module to call main */
 #define main main_python_enter
 static void *evil_C= NULL;
+
+#ifdef __APPLE__
+/* environ is not available in mac shared libraries */
+#include <crt_externs.h>
+char **environ = NULL;
 #endif
 
+#endif
+
 int main(int argc, const char **argv)
 {
 	SYS_SystemHandle syshandle;
@@ -1117,6 +1124,10 @@
 	bArgs *ba;
 
 #ifdef WITH_PYTHON_MODULE
+#ifdef __APPLE__
+	environ = *_NSGetEnviron();
+#endif
+
 #undef main
 	evil_C= C;
 #endif
@@ -1130,7 +1141,7 @@
 #endif
 
 	setCallbacks();
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE)
 		/* patch to ignore argument finder gives us (pid?) */
 	if (argc==2 && strncmp(argv[1], "-psn_", 5)==0) {
 		extern int GHOST_HACK_getFirstFile(char buf[]);



More information about the Bf-blender-cvs mailing list