Used to make easier the creation of bindings to C++ projects (Warning - far from complete but might be useful)
It works in two stages:
This is the slowest step. This is done as follows:
/usr/include/opencascade
.
python parse_headers.py "/usr/include/opencascade/*.hxx" occt
gp_*.hxx
. This is useful for very big libraries like OpenCascade (>8000 header files).
python parse_headers.py "/usr/include/opencascade/gp_*.hxx" occt
python parse_headers.py "/usr/include/opencascade/gp_Pnt.hxx" occt
And for OpenSceneGraph:
$ python parse_headers.py "/usr/include/osg/*" osg
$ python parse_headers.py "/usr/include/osgViewer/**/*" osg
Provided that those libraries are installed on your system. (only tested on linux)
The execution will create the folder writen in the second parameter (occt
or osg
in the prior examples). Within them the file deleteme/files.pickle
will be created with the result from the parsing. It should be easy to export it to yaml
or json
and process it directly with nim.
To create the bindings, you just need to do something like:
$ python analyse.py osg
This will:
osg/deleteme/files.pickle
<header>.nim
file per header.osg_types.nim
file with shared types across different headers.osg.nim
which imports all the other headers.The result most likel won't work, but hopefully will get you closer to the result.
I recommend to adapt it to your own needs.
I hope somebody make something better than this. ;oP