New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BLD: use meson-native dependency lookup for pybind11 #18058
Conversation
This makes use of mesonbuild/meson#11463 to find pybind11 using the pybind11-config script installed in build isolation. If that doesn't work, for example the version of Meson is too old, then we fall back to the previous method of manually running some introspection code, and no harm is done.
8cd823d
to
26edc5c
Compare
Thanks @eli-schwartz! This LGTM. It is going to intersect with gh-18034 - merge order doesn't matter, but the second PR will have a conflict. Functionality-wise, given that |
If a path is specified via a cross file property, it makes sense that that path overrides any mere environment probing (even pkg-config, which doesn't run python code). That being said, it's very possible to use a native pybind11 to build a cross python extension, since it's a header-only library. So if you're setting up a cross build and pointing to a native pybind11-config, that should work fine. (But it needs meson 1.1.0, which SciPy cannot guarantee and can reasonably be expected to provide backwards-compatible cross-file based alternatives to.) |
'''from os.path import relpath | ||
# | ||
# in meson 1.1.0, this will find the pyproject.toml build-requires version | ||
pybind11_dep = dependency('pybind11', version: '>=2.10.0', required: false, allow_fallback: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eli-schwartz one question on allow_fallback: true
- that doesn't see to do anything, because we don't have a subprojects/pybind11
. Is there a reason to add this (allow packagers to add a subproject, just good style, ...)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It allows adding one with meson wrap install pybind11
(no modification of build files is done).
By default, since this is required: false
in order to allow for checking via run_command, Meson doesn't know whether you actually want to do subproject fallbacks, maybe it's just supposed to be a disabled feature instead. This kwarg tells meson that it should do fallbacks if it can, anyway, even for an "optional" dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, that makes sense, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get this merged first - in it goes.
This makes use of mesonbuild/meson#11463 to find pybind11 using the pybind11-config script installed in build isolation.
If that doesn't work, for example the version of Meson is too old, then we fall back to the previous method of manually running some introspection code, and no harm is done.