automatic generation of swig interface files

Buzz

10-10-2005 15:48:03

Hello PyOgre community,

I've started to generate Java bindings for OGRE using SWIG. Building on Windows with VC++ SWIG as a custom build option.
Now I need to generate the corresponding .i files for the OGRE project.
Has anyone already written a tool to create the interface files for Pyton or could you just send me the files you used for the Pyton bindings?

Thanks

Clay

10-10-2005 16:29:58

You can get them from the pyogre project here: https://developer.berlios.de/projects/pyogre/, but you will need to change all of the python specific code.

Buzz

11-10-2005 07:55:28

Thanks for the qick answer, but I need either the interface files generated out of the OgreMain header files or the source code of a programm generating them. I couldn't find anything matching in the PyOgre project.

Kanma

11-10-2005 08:14:09

AFAIK the interface files are "generated" by hand. You can retrieve them from the SVN repository of pyOgre https://developer.berlios.de/svn/?group_id=3464.

Clay

11-10-2005 08:14:54

I'm not sure I fully understand what you mean. You are asking for the interface files (.i files) correct? They are in the subversion repository here: http://svn.berlios.de/viewcvs/pyogre/trunk/pyogre/ogre/
Is this what you are looking for?

We didn't generate these actually, we wrote them from scratch. =)

Buzz

11-10-2005 09:01:37

That's exactly what I was looking for. I'll have a look at these files to write a Java application to generate all the interface files with Java bindings.

fog

11-10-2005 13:51:52

You don't want to generate the .i files automatically. The .i files are used to generate the bindings automatically but they should be written by hand. Too many things can go bad and too many glitches in Ogre need to be fixed in the .i files to generate them.

Clay

11-10-2005 16:33:47

Chances are you'll spend more time trying to tweak the output to make it work for boundry cases. My recommendation is to download the pyogre .i files and modify them to #ifdef PYTHON_BUILD (or some such) around all python specific code, and add a #ifdef JAVA_BUILD around your java specifc stuff. This way you can build either by using the proper #define on the command line:

swig -DPYTHON_BUILD -python -c++ ...
swig -DJAVA_BUILD -java ...

And only use one set of .i files. If you do this then you can use our work to keep the java bindings up to date. I would accept a patch into pyogre that did the above.

But that's only a suggestion.

samlii

12-10-2005 22:00:38

Is there any talk of this getting into the main OGRE repo? It seems as if this may be a great collaborative effort to setup the bindings correctly for SWIG in general with code specific #ifdef blocks?

Tubez

12-10-2005 22:51:04

It's an add-on, and i guess this suits everyone just fine. THere is no need to burden the main CVS with it.

Clay

13-10-2005 00:46:35

Is there any talk of this getting into the main OGRE repo? It seems as if this may be a great collaborative effort to setup the bindings correctly for SWIG in general with code specific #ifdef blocks?
Once upon a time (about a year ago), pyogre was in the main repository (under the addons section) and the old pyogre code still resides there. This is why I'm listed on the developer's list. However, we decided to move away from the ogre repository when we decided to rewrite pyogre in SWIG. We *could* have deleted the code from CVS, but our reasons to move elsewhere I think are pretty sound:
  1. Subversion is far superior to CVS.[/*:m]
  2. We have more control over adding/removing access to the repository.[/*:m]
  3. This allows us to use patch tracking and bug tracking software provided by berliOS.[/*:m]
  4. We can use berliOS to release files.[/*:m]
  5. etc[/*:m][/list:u]

    I've often expressed interest in using the SWIG wrappers for other languages, but no one has actually stepped up to do this. Fog and I will be working on python bindings only. If someone would like to build Java/Ruby/whatever bindings using pyogre it would only require them submitting a few patches to get an initial version working. Then we could talk about svn access as soon as they knew how to not break the build for python (and understood the coding standards).

    Though occasionally talk comes up on the forums, no one has ever emailed me, submitted a patch, or (to my knowledge) modified pyogre to work with any other language.