How to run scripts/generate_bindings.py ?
The help says:
Syntax: scripts/generate_bindings.py <path_to_c++_files>
If I try:
python scripts/generate_bindings.py ~/Repos/libigl/include/igl/cotmatrix.h
I get this error
Collecting cpp files for parsing...
Parsing header files...
Traceback (most recent call last):
File "scripts/generate_bindings.py", line 197, in <module>
with open("headers.dat", 'rb') as fs:
FileNotFoundError: [Errno 2] No such file or directory: 'headers.dat'
try setting load_headers = True to False
Thanks! I also realized that the argument should be a path containing .h/.cpp files without a final /. So,
python scripts/generate_bindings.py ~/Repos/libigl/include/igl
but not
python scripts/generate_bindings.py ~/Repos/libigl/include/igl/
ok... I think that script was built for internal usage :)
Make sense. Is there another recommended way to make a new binding from scratch? Just copy-paste the documentation?
i think we should fix the script, it is super useful :)
In particular add the ability to skip existing bindings
Sounds good. I'm hoping to go after all the functions in the other libigl modules, so maybe time to freshen this script to also work with those.
the script uses clang to generate the code. https://github.com/libigl/libigl-python-bindings/blob/master/scripts/parser.py
The reason of the headers.dat is that it requires time to compile each file and get the ast, while generating the code from the ast is quick. I dont think this feature is necessary anymore as the generation is now ok