Someone setup for us cmake to use pybind to create a .pyd module we package, together with some pure python files, into a wheel.
We are switching from an old 3.7 python to a modern one, so we want to support wheels for both the old and new python version, at least for now.
I've read the pybind documentation and, due to my unfamiliarity with cmake, I found it unclear. So I'm looking for clarification.
My understanding is that you would have to compile twice, one time "targeting" 3.7 and another time targeting the newer version. But I wouldn't expect this to matter at all (if you were to handcode wrapping to python), or at most I'd expect it to matter if we were targeting two different major version (i.e. python2 vs python3).
My question is if this is really needed. Can I just avoid a second compilation and slam the .pyd I get when compiling "for python 3.7" into the wheel we build for the newer python too?
Yes, it is necessary. The CPython ABI changes from version to version, often in incompatible ways, so you have to compile for each version separately.
pybind c++ for multiple python versions