build python module without binreloc, add dummy argv[0] to initialize bprogname.

This commit is contained in:
Campbell Barton 2011-02-21 13:13:08 +00:00
parent ef60ae9521
commit 9ef0eed4b6
7 changed files with 30 additions and 15 deletions

View File

@ -161,6 +161,9 @@ endif()
TEST_SSE_SUPPORT()
# linux only, not cached
set(WITH_BINRELOC OFF)
# disabled for now, not supported
# option(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)
@ -346,12 +349,15 @@ if(UNIX AND NOT APPLE)
set(LLIBS "-lutil -lc -lm -lpthread -lstdc++ ${X11_X11_LIB} ${X11_Xinput_LIB}")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
# BSD's dont use libdl.so
list(APPEND LLIBS -ldl)
if(NOT WITH_PYTHON_MODULE)
# BSD's dont use libdl.so
list(APPEND LLIBS -ldl)
# binreloc is linux only
set(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
set(BINRELOC_INC ${BINRELOC}/include)
# binreloc is linux only
set(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
set(BINRELOC_INC ${BINRELOC}/include)
set(WITH_BINRELOC ON)
endif()
endif()
set(PLATFORM_LINKFLAGS "-pthread")

View File

@ -31,7 +31,7 @@ if(WITH_BULLET)
add_subdirectory(bullet2)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(WITH_BINRELOC)
add_subdirectory(binreloc)
endif()

View File

@ -133,7 +133,8 @@ set(SRC
intern/dynamiclist.h
)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(WITH_BINRELOC)
add_definitions(-DWITH_BINRELOC)
list(APPEND INC "${BINRELOC_INC}")
endif()

View File

@ -71,7 +71,7 @@
#else /* non windows */
#ifdef __linux__
#ifdef WITH_BINRELOC
#include "binreloc.h"
#endif
@ -1661,7 +1661,7 @@ void BLI_where_am_i(char *fullname, const int maxlen, const char *name)
#endif
#ifdef __linux__
#ifdef WITH_BINRELOC
/* linux uses binreloc since argv[0] is not relyable, call br_init( NULL ) first */
path = br_find_exe( NULL );
if (path) {

View File

@ -669,6 +669,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
#ifdef WITH_PYTHON_MODULE
#include "BLI_storage.h"
/* TODO, reloading the module isnt functional at the moment. */
extern int main_python(int argc, const char **argv);
@ -687,9 +688,16 @@ static struct PyModuleDef bpy_proxy_def = {
PyMODINIT_FUNC
PyInit_bpy(void)
{
int argc= 0;
const char *argv[]={NULL};
int argc= 1;
char *argv[2]={NULL, NULL};
/* give the CWD as the first arg, blender uses */
char path[240]= "";
BLI_getwdN(path, sizeof(path));
BLI_join_dirfile(path, sizeof(path), path, "bpy");
argv[0]= path;
/* done with cwd */
main_python(argc, argv);
/* initialized in BPy_init_modules() */

View File

@ -33,7 +33,7 @@ if(WITH_CODEC_QUICKTIME)
add_definitions(-DWITH_QUICKTIME)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(WITH_BINRELOC)
add_definitions(-DWITH_BINRELOC)
blender_include_dirs(${BINRELOC_INC})
endif()

View File

@ -90,7 +90,7 @@ if(NOT WITH_SDL)
add_definitions(-DDISABLE_SDL)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(WITH_BINRELOC)
add_definitions(-DWITH_BINRELOC)
blender_include_dirs(${BINRELOC_INC})
endif()
@ -592,7 +592,7 @@ endif()
bf_intern_mikktspace
)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(WITH_BINRELOC)
list(APPEND BLENDER_SORTED_LIBS extern_binreloc)
endif()