mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.55k stars 1.61k forks source link

using config tool for GSL #8575

Open danielbarter opened 3 years ago

danielbarter commented 3 years ago

Hi there,

GSL (https://www.gnu.org/software/gsl/) is quite popular in the scientific computing world. Like SDL2, it has its own config tool gsl-config. On most machines, meson can find the correct headers/shared libraries using

gsl_dep = cc.find_library('gsl')
gslcblas_dep = cc.find_library('gslcblas')

On more exotic machines, eg large compute clusters where GSL is in a strange location, this doesn't work. I am interested in adding the gsl config tool to meson. I can see how to add it, and have some candidate machines where the above approach doesn't work, but wanted to get some expert opinion before I actually do it. Looking forward to reading your responses.

dcbaker commented 3 years ago

Looking at the source code, there's also a package-config file (at least in the master branch), which should be preferred, ie:

gsl_dep = dependency('gsl')

I haven't personally tried this, but it looks like it includes gslcblas.

That said, gsl-config looks fairly conpenant, and it shouldn't be hard to add a wrapper around it for Meson, you can look at the way this is handled in mesonbuild/dependencies/misc.py, there's a number of dependencies there that support both pkg-config and config-tool style lookup. If you do add support, please be sure to add a test case in test cases/frameworks as well.

Feel free to @ me on a PR and I'll review it.