Replies: 9 comments
-
Isn't nanobind just a header-only C++ library? Edit: sorry, I guess it's a shared support library too, yeah. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the issue @WillAyd. I had a read through the And silently not targeting the stable ABI like this may lead to issues, because the build backend won't know: This is done also if
This is never right AFAIK; Meson is an out-of-tree build system, so all build artifact from the main project and all subprojects go into the build directory. There should be no need for it to be in-tree though? Was the problem that the shared library wasn't found in the build dir, or something else? |
Beta Was this translation helpful? Give feedback.
-
Thanks @rgommers - I probably am not expressing well enough what I am trying to do. So for instance in pandas we have a lot of "custom" vector code written in cython that sits in the
I would ideally like to replace my |
Beta Was this translation helpful? Give feedback.
-
From Python code or Cython code? The former is straightforward, because it only matters what the install directory is (not the build dir, that can be anywhere). You specify that install location directly through the I'm happy to try your Pandas branch on the weekend if it's shareable? |
Beta Was this translation helpful? Give feedback.
-
Honestly, this is just classic cmake. You get tons of power to have a custom function inject wide-ranging changes into the whole project, but at the end of the day all people actually do with it is create a cmake function that runs add_library() with additional flags. It's trivial to replicate in meson, assuming you want to:
and you are done. Meson already handles visibility for you. Nanobind doesn't default to LTO and neither does meson, but meson provides all the tools you need here. The most significant factor here is that it looks like you need to compile nanobind's helper library differently depending on whether you are targeting the limited API or not. That should really be modeled by building and installing both. Then you need to know whether you are building in meson with the limited API or not, and choose which one to get with |
Beta Was this translation helpful? Give feedback.
-
Happy to share, although its in a very initial state at the moment: https://github.com/WillAyd/pandas/tree/khashl-usage
That's great to know! I think though that I would still have the same limitations as in the OP, i.e. I wouldn't be provided "sources" to the @eli-schwartz thanks for that feedback. Apologies for a potentially naieve question, but when you mention |
Beta Was this translation helpful? Give feedback.
-
It would be done in the subproject for nanobind itself, probably. |
Beta Was this translation helpful? Give feedback.
-
Looks like I can get a simple example built by setting up
And in the meson build file doing:
|
Beta Was this translation helpful? Give feedback.
-
FWIW nanobind has been added to the wrapdb, so a lot of the above advice I provided is now moot |
Beta Was this translation helpful? Give feedback.
-
I am trying to integrate some nanobind modules into a meson project. As things stand today, nanobind only supports CMake as a build system, and I am not aware of another project that has converted that to Meson.
As far as I can tell, the best way to structure this is to put the nanobind code that requires CMake into a subproject. So I end up with a structure like this:
Is there any way at all to have the extensions built from subprojects into the
/src
build tree? I've tried something like this in meson.build:This gets me the structure I need, but generates a warning that it will be broken in a future version of meson:
WARNING: Build target new_vector.cpython-310-x86_64-linux-gnu has no sources. This was never supposed to be allowed but did because of a bug, support will be removed in a future release of Meson
and doesn't work at runtime I think because the module export function gets mangled in the process
Another option I've considered is doing a
custom_target
that moves the subproject dependency output:But that does not work because my_ext_dep is an InternalDependency, not a string (maybe meson has a way to convert this). It also seems pretty fragile, so hoping for a better way
Beta Was this translation helpful? Give feedback.
All reactions