Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-02-21 16:13:08 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-21 16:13:08 +0300
commit9ef0eed4b64325092dc90bf2db0ca9825fd94f83 (patch)
tree179c4ae843eb3192683457e19d2ea903b8690b70
parentef60ae95215ef9fe88a93e97f70413e8075506e4 (diff)
build python module without binreloc, add dummy argv[0] to initialize bprogname.
-rw-r--r--CMakeLists.txt18
-rw-r--r--extern/CMakeLists.txt2
-rw-r--r--source/blender/blenlib/CMakeLists.txt3
-rw-r--r--source/blender/blenlib/intern/path_util.c4
-rw-r--r--source/blender/python/intern/bpy_interface.c14
-rw-r--r--source/blenderplayer/CMakeLists.txt2
-rw-r--r--source/creator/CMakeLists.txt4
7 files changed, 31 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4796187a2b..ce881f24e97 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
-
- # binreloc is linux only
- set(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
- set(BINRELOC_INC ${BINRELOC}/include)
+ 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)
+ set(WITH_BINRELOC ON)
+ endif()
endif()
set(PLATFORM_LINKFLAGS "-pthread")
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 52b804b7bfc..999e60980db 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -31,7 +31,7 @@ if(WITH_BULLET)
add_subdirectory(bullet2)
endif()
-if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+if(WITH_BINRELOC)
add_subdirectory(binreloc)
endif()
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 9f6b1a8ab05..d5ed8956f7a 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -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()
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index ec137d21033..10455e806b3 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -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) {
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index d1773e5fd7a..b6f0182a267 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -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() */
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index 8ef06e9fc21..8f1730eb8fb 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -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()
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 01cea0565ab..19b62b0ce68 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -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()