Re: [pygccxml-development] Help with single header setup
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2009-07-31 04:46:40
|
On Thu, Jul 30, 2009 at 6:53 PM, Brendan Duncan<Bre...@di...> wrote: > I've been testing Py++ lately as an alternative to swig. Some of the > libraries I'm trying to wrap cause Py++/PyGCCXML to consume well over > 6GB of RAM, and take quite a while to process (considerably longer than > swig). Interesting. I would like to investigate the problem. Is this an open source project? > I read the section of documentation that said putting all of the headers > into a single header is the way to go. This is where I'm stuck, and I > don't have a lot of time to try and figure it out. > > Here's a greatly simplified version of what I'm currently doing. Can > anyone tell me what I need to be doing instead? > > Foo.h: > class Foo { > public: > Foo(void) { } > void test(void) { } > }; > > headers.h: > #include "Foo.h" > > generate.py: > from pyplusplus import module_builder > GCCXML = '/path/to/gccxml' > mb = module_builder.module_builder_t(files=['headers.h'], > gccxml_path=GCCXML) > mb.build_code_creator(module_name='_test') > targets = mb.split_module('build') > > When I run generate.py, it produces _test.main.cpp: > #include "boost/python.hpp" > #include "headers.h" > namespace bp = boost::python; > BOOST_PYTHON_MODULE(_test){ > } > > > If instead of headers.h I pass Foo.h to module_builder_t, then it builds > fine, except this is the case where in my large project it consumes far > too much memory and takes too long. I tried having the pygccxml parser > generate an xml for headers.h and passing that to module_builder, but > that didn't work either. Looking at the xml file I do see the Foo > declarations though, so it's just module_builder that's ignoring them. > > Any ideas would be greatly appreciated. I'm using the SVN version, on > Linux (if that matters). The following documents should help you: * http://language-binding.net/pyplusplus/documentation/tutorials/module_builder/module_builder.html * http://language-binding.net/pygccxml/query_interface.html In general you can write: mb.class_( 'Foo' ).include() -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |