meson: Override dependencies to improve usage as a subproject

With this change, sysprof can be consumed as a subproject without
making any changes to the build files of a project. All you need to do
is provide a wrap file with a `[provide]` section:

https://mesonbuild.com/Wrap-dependency-system-manual.html#provide-section

This is also necessary because otherwise projects need to hard-code
the subproject name, which might be `sysprof` when using `wrap-git` or
`sysprof-3.46.0` when using `wrap-file` (to build from a release
tarball). This can cause conflicts between different subprojects that
consume sysprof differently.

Other projects like glib, cairo, pango, etc already do this.
This commit is contained in:
Nirbheek Chauhan
2022-12-18 10:00:10 +05:30
parent 82a32f70e8
commit 6d50f3ca7b
3 changed files with 3 additions and 0 deletions

View File

@ -64,6 +64,7 @@ libsysprof_capture_dep = declare_dependency(
dependencies: libsysprof_capture_deps,
include_directories: libsysprof_capture_include_dirs,
)
meson.override_dependency('sysprof-capture-@0@'.format(libsysprof_api_version), libsysprof_capture_dep)
if install_static
pkgconfig.generate(

View File

@ -118,6 +118,7 @@ libsysprof_ui_dep = declare_dependency(
dependencies: libsysprof_ui_deps,
include_directories: include_directories('.'),
)
meson.override_dependency('sysprof-ui-@0@'.format(libsysprof_api_version), libsysprof_ui_dep)
pkgconfig.generate(
libsysprof_ui,

View File

@ -178,6 +178,7 @@ libsysprof_dep = declare_dependency(
dependencies: libsysprof_deps,
include_directories: [include_directories('.'), libsysprof_capture_include_dirs],
)
meson.override_dependency('sysprof-@0@'.format(libsysprof_api_version), libsysprof_dep)
pkgconfig.generate(
libsysprof,