bazaar: Py prepared for boost python usage with BOOSTPY flag. test package soon to follow

git-svn-id: svn://ultimatepp.org/upp/trunk@3333 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
kohait 2011-04-11 07:47:56 +00:00
parent 209423b323
commit b9af10dd64
5 changed files with 50 additions and 11 deletions

View file

@ -1,10 +1,17 @@
#ifndef _Python_Python_h #ifndef _Python_Python_h
#define _Python_Python_h #define _Python_Python_h
//this drops any auto linking/inclusion of python/python_d libs
//use this when we use those boost python prelinked dlls
//which link to python27.dll even in debug mode
#define MS_NO_COREDLL 1
#define Py_ENABLE_SHARED 1
#ifdef flagBOOSTPY #ifdef flagBOOSTPY
#ifdef _DEBUG // #ifdef _DEBUG
#define BOOST_DEBUG_PYTHON 1 // #define BOOST_DEBUG_PYTHON 1
#endif // #endif
#include <boost/python.hpp> #include <boost/python.hpp>
#else #else
#include <Python.h> #include <Python.h>

View file

@ -1,6 +1,12 @@
uses uses
Core; Core;
library(MSC BOOSTPY) python27;
library(MSC !BOOSTPY !DEBUG) python27;
library(MSC !BOOSTPY DEBUG) python27_d;
file file
Py.h, Py.h,
init.icpp, init.icpp,

View file

@ -75,4 +75,29 @@ SIDENOTE:
_Py_NoneStruct reference errors when linking result due to Py_ENABLE_SHARED beeing undefined in pyport.h _Py_NoneStruct reference errors when linking result due to Py_ENABLE_SHARED beeing undefined in pyport.h
BOOST: BOOST:
Py package is prepared to be used with Boost Python, just add BOOSTPY to your compile configuration Py package is prepared to be used with Boost Python, just add BOOSTPY to your compile configuration
Boost Installation:
esiest way is to download the boostpro installer
http://www.boostpro.com/download/
selct during installation MSC9 derivates (or respective your compiler) and, best, all the variants, shared, multi threaded, etc.
enhance your build method paths
PATH: C:\Prpgram Files\boost\boost_1_46_1\bin and C:\Prpgram Files\boost\boost_1_46_1\lib
INCLUDE C:\Prpgram Files\boost\boost_1_46_1
LIB: C:\Prpgram Files\boost\boost_1_46_1\lib
BOOST CAVEAT
see point 8 at
http://www.boost.org/doc/libs/1_46_1/libs/python/doc/building.html
the boost libraries from boostpro come with release and debug variants linked to python27.dll both
(the debug should theoretically be linked to python27_d)
when compiling release, all is fine, but compiling debug can render the executable unusable,
since it loads both python27.dll through the boost.python lib, and the python27_d.dll through
the pragma comment(lib,) which results in mixed inits and crashes/access violations.
not even the BOOST_DEBUG_PYTHON define seems to help here, since it seems to be provided
during build of the boost python libs to instruct them proper linkage.
thats why it is the esiest way to control manually, which lib is going to be included manually.
#define MS_NO_COREDLL 1
#define Py_ENABLE_SHARED 1
are to disable the pragma comment(lib,) stuff so we manually can specify the libs while preserving all shared stuff.

View file

@ -73,6 +73,7 @@ PyConsoleCtrl::PyConsoleCtrl()
savelog <<= THISBACK(SaveLog); savelog <<= THISBACK(SaveLog);
clearlog <<= THISBACK(ClearLog); clearlog <<= THISBACK(ClearLog);
clonex.SetLabel("AutoCl");
clonex.Set(1); clonex.Set(1);
PyCon::SetStream(log); PyCon::SetStream(log);

View file

@ -1,13 +1,13 @@
LAYOUT(PyConsoleCtrlLay, 600, 400) LAYOUT(PyConsoleCtrlLay, 600, 400)
ITEM(Button, exec, SetLabel(t_("Exec")).RightPosZ(0, 56).BottomPosZ(0, 20)) ITEM(Button, exec, SetLabel(t_("Exec")).RightPosZ(0, 56).BottomPosZ(0, 20))
ITEM(Button, load, SetLabel(t_("Load")).LeftPosZ(0, 56).BottomPosZ(0, 20)) ITEM(Button, load, SetLabel(t_("Load")).LeftPosZ(0, 28).BottomPosZ(0, 20))
ITEM(Button, save, SetLabel(t_("Save")).LeftPosZ(56, 56).BottomPosZ(0, 20)) ITEM(Button, save, SetLabel(t_("Save")).LeftPosZ(28, 28).BottomPosZ(0, 20))
ITEM(Button, clear, SetLabel(t_("Clear")).LeftPosZ(112, 56).BottomPosZ(0, 20)) ITEM(Button, clear, SetLabel(t_("Clear")).LeftPosZ(56, 28).BottomPosZ(0, 20))
ITEM(Button, savelog, SetLabel(t_("Save Log")).LeftPosZ(196, 56).BottomPosZ(0, 20)) ITEM(Button, savelog, SetLabel(t_("Save Log")).LeftPosZ(92, 48).BottomPosZ(0, 20))
ITEM(Button, clearlog, SetLabel(t_("Clear Log")).LeftPosZ(252, 56).BottomPosZ(0, 20)) ITEM(Button, clearlog, SetLabel(t_("Clear Log")).LeftPosZ(140, 48).BottomPosZ(0, 20))
ITEM(EditString, ex, SetEditable(false).WantFocus(false).RightPosZ(56, 56).BottomPosZ(1, 19)) ITEM(EditString, ex, SetEditable(false).WantFocus(false).RightPosZ(56, 56).BottomPosZ(1, 19))
ITEM(StaticText, dv___7, SetText(t_("exit:")).SetAlign(ALIGN_RIGHT).RightPosZ(112, 24).BottomPosZ(0, 20)) ITEM(StaticText, dv___7, SetText(t_("exit#:")).SetAlign(ALIGN_RIGHT).RightPosZ(112, 48).BottomPosZ(0, 20))
ITEM(Splitter, spl, LeftPosZ(0, 600).TopPosZ(0, 380)) ITEM(Splitter, spl, LeftPosZ(0, 600).TopPosZ(0, 380))
ITEM(Option, clonex, SetLabel(t_("Clear On Exec")).LeftPosZ(308, 88).BottomPosZ(4, 16)) ITEM(ButtonOption, clonex, LeftPosZ(188, 48).BottomPosZ(0, 20))
END_LAYOUT END_LAYOUT