concaveman-cpp icon indicating copy to clipboard operation
concaveman-cpp copied to clipboard

use pybind11 and cppimport

Open poke1024 opened this issue 4 years ago • 1 comments

Thank you for porting this to C++.

This PR changes the compilation to pybind11 and cppimport.

In this way, it becomes really easy to install and run, e.g. running

cd src/main
python demo.py

will just work (assuming you have cppimport installed): it will automatically compile src/main/cpp/concaveman.cpp and load it.

The code for passing in and returning the arrays also becomes a lot simpler.

Not directly related to this change: I added a DEBUG flag for removing the std::cout printouts, and fixed one compiler warning for a missing typedef.

poke1024 avatar Jun 22 '20 21:06 poke1024

Nice work!

could this be restructured to use pybind11 and pre-build the all teh code so it would run without a compiler or any other dependencies?

I've done that with Cython (#14) -- because that's what I'm used to -- but pybind11 would probably make cleaner binding code.

ChrisBarker-NOAA avatar Aug 27 '20 19:08 ChrisBarker-NOAA