diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-01-16 18:13:41 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-01-16 18:13:41 +0400 |
commit | 3b12a4b92b3115c0be4f194bb77edb9d4173e018 (patch) | |
tree | 0f20b82d1ce558a7f9d39df868874321d4f42df3 /source/creator | |
parent | 92764260d7050800572c9d5b8a80f954572e9a0f (diff) |
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.
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/CMakeLists.txt | 15 | ||||
-rw-r--r-- | source/creator/creator.c | 13 |
2 files changed, 26 insertions, 2 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index d8c0a5a4f0d..9c15932f140 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -178,6 +178,15 @@ if(WITH_PYTHON_MODULE) 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 @@ elseif(WIN32) 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() diff --git a/source/creator/creator.c b/source/creator/creator.c index 698646ce1b3..68a7bc415a8 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1108,6 +1108,13 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) /* 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) @@ -1117,6 +1124,10 @@ int main(int argc, const char **argv) bArgs *ba; #ifdef WITH_PYTHON_MODULE +#ifdef __APPLE__ + environ = *_NSGetEnviron(); +#endif + #undef main evil_C= C; #endif @@ -1130,7 +1141,7 @@ int main(int argc, const char **argv) #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[]); |