build: Override dependency for use as subproject

A pkgconfig file is already provided, which enables using `thorvg` once
it is installed. However, this file is not, and cannot be, available at
setup time if using `thorvg` as a subproject.

In such cases, Meson provides the `override_dependency` mechanism for a
subproject to tell its parent how to use it.
This commit is contained in:
Elliott Sales de Andrade 2024-08-17 23:24:07 -04:00 committed by Hermet Park
parent 9c36b78140
commit 966aeb5ee3
2 changed files with 8 additions and 0 deletions

View file

@ -1,3 +1,5 @@
header_files = ['thorvg.h'] header_files = ['thorvg.h']
thorvg_inc = include_directories('.')
install_headers(header_files) install_headers(header_files)

View file

@ -62,6 +62,12 @@ thorvg_lib = library(
override_options : override_options override_options : override_options
) )
thorvg_dep = declare_dependency(
include_directories: thorvg_inc,
link_with: thorvg_lib,
)
meson.override_dependency('thorvg', thorvg_dep)
pkg_mod = import('pkgconfig') pkg_mod = import('pkgconfig')
pkg_mod.generate( pkg_mod.generate(