Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force meson to use only wrap subproject

Tags:

meson-build

I have a few subprojects defined in wrap files in the subprojects directory and declared in the meson.build file. Unfortunately I am forced to have some of the subprojects installed on my host system. Meson by default checks if a subproject is installed in the host os filesystem then eventually downloads and builds the subproject if it is unavailable. How to force meson to not use system libraries/headers but to always download/build subprojects independently in own build directory and link it during compilation?

subprojects/xyz.wrap:

[wrap-git]
url = https://github.com/bar/xyz.git
revision = HEAD

[provide]
xyz = xyz_dep

meson.build:

xyz = dependency('xyz')
...
deps = [
    ...
    xyz
    ...
]
executable(foo, dependencies: deps)
like image 702
Piotr Zych Avatar asked Nov 30 '25 01:11

Piotr Zych


1 Answers

You can force a dependency to fallback to its local subprojects version using --force-fallback-for=<dependency_name> during meson setup ....

For example, I have SDL2 installed as a system package, but I can use the WrapDB version with the following command:

meson setup build --force-fallback-for=sdl2

Reference:

  • https://github.com/mesonbuild/meson/issues/7218
like image 51
Joshua Taylor Eppinette Avatar answered Dec 02 '25 05:12

Joshua Taylor Eppinette



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!