pybind / cmake_example

Example pybind11 module built with a CMake-based build system
Other
626 stars 221 forks source link

skbuild? #14

Closed eirrgang closed 4 years ago

eirrgang commented 6 years ago

I tried to make a project depend on the Pypi cmake package to try to help a pip install with this template work more concisely, but there are headaches and incompatibilities if scikit-build is not brought up-to-date in a separate command before using this setup.py file. But it looks like using sk-build directly would simplify this setup.py file, but complicate the CMakeLists.txt. I'm trying it out in my project and I figure I'll share a minimal example from the results.

Should I issue a PR to this project proposing a setup.py in terms of skbuild? Or is there a reason that skbuild is not appropriate in this setup.py and should maybe be a separate example in the pybind ecosystem?

eirrgang commented 6 years ago

There are actually two possible scenarios:

So far, I've done the former, but not the latter.

ax3l commented 4 years ago

@eirrgang do you have example projects that build with scikit-build that we could propose here (or in a fork) as a modern install way? The first scenario is probably preferred by me. I tried to explore a transition myself a few months back but did not succeed yet: https://github.com/openPMD/openPMD-api/pull/585

eirrgang commented 4 years ago

Here is a package embedded in another project that can be built

It is a bit over-complicated as an example, and uses a pattern that I don't like: It requires some configuration information to be provided through an environment variable that should instead be an optional CMake option provided at the end of the pip or setup.py command line.

It also adopts PEP 517/518, which I don't know is appropriate here.

But if this looks like a superset of a useful example, I can create a simpler version.

ax3l commented 4 years ago

Thanks, I think PEP 517 is the future anyway, so don't feel we need to stop there.

henryiii commented 4 years ago

This exists now: https://github.com/pybind/scikit_build_example