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.
This commit is contained in:
parent
92764260d7
commit
3b12a4b92b
@ -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()
|
||||
|
||||
|
@ -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[]);
|
||||
|
Loading…
Reference in New Issue
Block a user