0

I'm looking for a way in meson to get either the found library name and path, or in the case the library was not found the output path where the wrapped subproject for that dependency will be built. As a specfic example, the line:

sdl2_dep = dependency('SDL2', version: '>=2', required: true, fallback: ['sdl2', 'sdl2_dep'])

Yields sdl2_dep, which I understand to be a "Dependency object". From this, I would like to derive the location/name of the found library file, or if the dependency was not found and will be built as a subproject the location/name of the library file that will be generated.

The specific reason that I need this is that when cross-compiling I need to copy the library and put it next to the binary in order to easily run it for testing. Currently I'm manually copying it but that's inconvenient (and possibly in the future would make CI integration difficult).

*Note: I'm sure there must be some reference to the composition of the dependency object being returned by the dependency() method, but I can't seem to find it. If someone can point to the documentation it would be very much appreciated.

Kagetsuki
  • 309
  • 2
  • 18
  • This question is essentially the same: https://stackoverflow.com/questions/75232869/get-the-path-of-a-found-library-in-meson . – Kagetsuki Jul 19 '23 at 07:22
  • 1
    I'm afraid you'd have to look that up in the `meson-info` subdir of your build dir, which is what you IDE does. See [IDE integration](https://mesonbuild.com/IDE-integration.html) – droptop Jul 20 '23 at 16:05
  • @droptop I'm afraid that particular info isn't clearly listed, and I'd have to write a script to scrape it to use it. For now I wrote a small script that just makes some assumptions and is called as a custom_target. I'm considering implementing extended functionality for dep.get_variable if I can find the time. I also found an open (stale) issue which is basically this: https://github.com/mesonbuild/meson/issues/4563 – Kagetsuki Jul 21 '23 at 02:27

0 Answers0