Guidance for using Meson #449
Replies: 3 comments 10 replies
-
The meson project maintains a database of wraps.
|
Beta Was this translation helpful? Give feedback.
-
@WillAyd Writing a build system that compiles and links Did you check that the compiler+linker flags are identical when using meson vs cmake? I'm hesitant to advertise this here if it's not following the best practices. "The extension works" is a good start but not the target. |
Beta Was this translation helpful? Give feedback.
-
@wjakob do you have any opposition to creating a WrapDB entry for nanobind in Meson? Ideally we would add the meson.build files to this repo directly, but if that's not something you care for I think we could also just add them upstream to Meson's WrapDB. I am happy to lead that contribution either way Meson and meson-python have picked up momentum in the scientific python space (pandas, NumPy, and SciPy all use those tools) so having an easy way to install nanobind with Meson projects I think would be a great asset to the ecosystem |
Beta Was this translation helpful? Give feedback.
-
Since quite a few libraries in the scientific python stack use meson as a build tool, I wanted to share what I've found to be a viable solution to integrate nanobind into a meson build system. Much of this was inspired by the discussion on the meson-python discussions page
For starters, Meson requires you to create a subprojects folder at the top level of your project. Therein you can create a wrap file that looks something like this:
Be sure to change the revision above and the target name to fit your needs. Meson does not know the name of the dependency that CMake generates, so the
dep_name = <target_name>_dep
syntax is required in the provide section.Within your meson file(s) you can then use the dependency when building extension modules:
Beta Was this translation helpful? Give feedback.
All reactions