[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35032] trunk/blender: build python module without binreloc, add dummy argv[0] to initialize bprogname.
Campbell Barton
ideasman42 at gmail.com
Mon Feb 21 14:13:08 CET 2011
Revision: 35032
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35032
Author: campbellbarton
Date: 2011-02-21 13:13:08 +0000 (Mon, 21 Feb 2011)
Log Message:
-----------
build python module without binreloc, add dummy argv[0] to initialize bprogname.
Modified Paths:
--------------
trunk/blender/CMakeLists.txt
trunk/blender/extern/CMakeLists.txt
trunk/blender/source/blender/blenlib/CMakeLists.txt
trunk/blender/source/blender/blenlib/intern/path_util.c
trunk/blender/source/blender/python/intern/bpy_interface.c
trunk/blender/source/blenderplayer/CMakeLists.txt
trunk/blender/source/creator/CMakeLists.txt
Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt 2011-02-21 13:00:38 UTC (rev 35031)
+++ trunk/blender/CMakeLists.txt 2011-02-21 13:13:08 UTC (rev 35032)
@@ -161,6 +161,9 @@
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 @@
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")
Modified: trunk/blender/extern/CMakeLists.txt
===================================================================
--- trunk/blender/extern/CMakeLists.txt 2011-02-21 13:00:38 UTC (rev 35031)
+++ trunk/blender/extern/CMakeLists.txt 2011-02-21 13:13:08 UTC (rev 35032)
@@ -31,7 +31,7 @@
add_subdirectory(bullet2)
endif()
-if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+if(WITH_BINRELOC)
add_subdirectory(binreloc)
endif()
Modified: trunk/blender/source/blender/blenlib/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/blenlib/CMakeLists.txt 2011-02-21 13:00:38 UTC (rev 35031)
+++ trunk/blender/source/blender/blenlib/CMakeLists.txt 2011-02-21 13:13:08 UTC (rev 35032)
@@ -133,7 +133,8 @@
intern/dynamiclist.h
)
-if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+if(WITH_BINRELOC)
+ add_definitions(-DWITH_BINRELOC)
list(APPEND INC "${BINRELOC_INC}")
endif()
Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/path_util.c 2011-02-21 13:00:38 UTC (rev 35031)
+++ trunk/blender/source/blender/blenlib/intern/path_util.c 2011-02-21 13:13:08 UTC (rev 35032)
@@ -71,7 +71,7 @@
#else /* non windows */
-#ifdef __linux__
+#ifdef WITH_BINRELOC
#include "binreloc.h"
#endif
@@ -1661,7 +1661,7 @@
#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) {
Modified: trunk/blender/source/blender/python/intern/bpy_interface.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_interface.c 2011-02-21 13:00:38 UTC (rev 35031)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c 2011-02-21 13:13:08 UTC (rev 35032)
@@ -669,6 +669,7 @@
#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 @@
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() */
Modified: trunk/blender/source/blenderplayer/CMakeLists.txt
===================================================================
--- trunk/blender/source/blenderplayer/CMakeLists.txt 2011-02-21 13:00:38 UTC (rev 35031)
+++ trunk/blender/source/blenderplayer/CMakeLists.txt 2011-02-21 13:13:08 UTC (rev 35032)
@@ -33,7 +33,7 @@
add_definitions(-DWITH_QUICKTIME)
endif()
-if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+if(WITH_BINRELOC)
add_definitions(-DWITH_BINRELOC)
blender_include_dirs(${BINRELOC_INC})
endif()
Modified: trunk/blender/source/creator/CMakeLists.txt
===================================================================
--- trunk/blender/source/creator/CMakeLists.txt 2011-02-21 13:00:38 UTC (rev 35031)
+++ trunk/blender/source/creator/CMakeLists.txt 2011-02-21 13:13:08 UTC (rev 35032)
@@ -90,7 +90,7 @@
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 @@
bf_intern_mikktspace
)
- if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ if(WITH_BINRELOC)
list(APPEND BLENDER_SORTED_LIBS extern_binreloc)
endif()
More information about the Bf-blender-cvs
mailing list