| 1 |
name: dep |
| 2 |
long_name: Dependency object |
| 3 |
description: Abstract representation of a dependency |
| 4 |
|
| 5 |
methods: |
| 6 |
- name: found |
| 7 |
returns: bool |
| 8 |
description: Returns whether the dependency was found. |
| 9 |
|
| 10 |
- name: name |
| 11 |
since: 0.48.0 |
| 12 |
returns: str |
| 13 |
description: | |
| 14 |
Returns the name of the dependency that was searched. |
| 15 |
Returns `'internal'` for dependencies created with |
| 16 |
[[declare_dependency]]. |
| 17 |
|
| 18 |
NOTE: This was not implemented for dep objects returned by |
| 19 |
[[compiler.find_library]] until Meson 1.5.0 |
| 20 |
|
| 21 |
- name: get_pkgconfig_variable |
| 22 |
since: 0.36.0 |
| 23 |
deprecated: 0.56.0 |
| 24 |
returns: str |
| 25 |
description: | |
| 26 |
Gets the pkg-config variable specified, |
| 27 |
or, if invoked on a non pkg-config |
| 28 |
dependency, error out. |
| 29 |
|
| 30 |
posargs: |
| 31 |
var_name: |
| 32 |
type: str |
| 33 |
description: Name of the variable to query |
| 34 |
|
| 35 |
kwargs: |
| 36 |
define_variable: |
| 37 |
type: list[str] |
| 38 |
since: 0.44.0 |
| 39 |
description: | |
| 40 |
You can also redefine a |
| 41 |
variable by passing a list to this kwarg |
| 42 |
that can affect the retrieved variable: `['prefix', '/'])`. |
| 43 |
|
| 44 |
*(Since 1.3.0)* Multiple variables can be specified in pairs. |
| 45 |
|
| 46 |
default: |
| 47 |
type: str |
| 48 |
since: 0.45.0 |
| 49 |
description: | |
| 50 |
The value to return if the variable was not found. |
| 51 |
A warning is issued if the variable is not defined and this kwarg is not set. |
| 52 |
|
| 53 |
- name: get_configtool_variable |
| 54 |
since: 0.44.0 |
| 55 |
deprecated: 0.56.0 |
| 56 |
returns: str |
| 57 |
description: | |
| 58 |
Gets the command line argument from the config tool (with `--` prepended), or, |
| 59 |
if invoked on a non config-tool dependency, error out. |
| 60 |
|
| 61 |
posargs: |
| 62 |
var_name: |
| 63 |
type: str |
| 64 |
description: Name of the variable to query |
| 65 |
|
| 66 |
- name: type_name |
| 67 |
returns: str |
| 68 |
description: | |
| 69 |
Returns a string describing the type of the |
| 70 |
dependency, the most common values are `internal` for deps created |
| 71 |
with [[declare_dependency]] and `pkgconfig` for system dependencies |
| 72 |
obtained with Pkg-config. |
| 73 |
|
| 74 |
- name: version |
| 75 |
returns: str |
| 76 |
description: | |
| 77 |
the version number as a string, |
| 78 |
for example `1.2.8`. |
| 79 |
`unknown` if the dependency provider doesn't support determining the |
| 80 |
version. |
| 81 |
|
| 82 |
- name: include_type |
| 83 |
returns: str |
| 84 |
since: 0.52.0 |
| 85 |
description: Returns the value set by the `include_type` kwarg. |
| 86 |
|
| 87 |
- name: as_system |
| 88 |
returns: dep |
| 89 |
since: 0.52.0 |
| 90 |
description: | |
| 91 |
Returns a copy of the dependency object, which has changed the value of `include_type` |
| 92 |
to `value`. The `value` argument is optional and |
| 93 |
defaults to `'system'`. |
| 94 |
|
| 95 |
optargs: |
| 96 |
value: |
| 97 |
type: str |
| 98 |
description: The new value. See [[dependency]] for supported values. |
| 99 |
|
| 100 |
- name: as_link_whole |
| 101 |
returns: dep |
| 102 |
since: 0.56.0 |
| 103 |
description: | |
| 104 |
Only dependencies created with [[declare_dependency]], |
| 105 |
returns a copy of the dependency object with all |
| 106 |
link_with arguments changed to link_whole. This is useful for example for |
| 107 |
fallback dependency from a subproject built with `default_library=static`. |
| 108 |
Note that all `link_with` objects must be static libraries otherwise an error |
| 109 |
will be raised when trying to `link_whole` a shared library. |
| 110 |
|
| 111 |
- name: partial_dependency |
| 112 |
returns: dep |
| 113 |
since: 0.46.0 |
| 114 |
description: | |
| 115 |
Returns a new dependency object with the same name, version, found status, |
| 116 |
type name, and methods as the object that called it. This new |
| 117 |
object will only inherit other attributes from its parent as |
| 118 |
controlled by keyword arguments. |
| 119 |
|
| 120 |
If the parent has any dependencies, those will be applied to the new |
| 121 |
partial dependency with the same rules. So, given: |
| 122 |
|
| 123 |
```meson |
| 124 |
dep1 = declare_dependency(compile_args : '-Werror=foo', link_with : 'libfoo') |
| 125 |
dep2 = declare_dependency(compile_args : '-Werror=bar', dependencies : dep1) |
| 126 |
dep3 = dep2.partial_dependency(compile_args : true) |
| 127 |
``` |
| 128 |
|
| 129 |
dep3 will add `['-Werror=foo', '-Werror=bar']` to the compiler args |
| 130 |
of any target it is added to, but libfoo will not be added to the |
| 131 |
link_args. |
| 132 |
|
| 133 |
The following arguments will add the following attributes: |
| 134 |
|
| 135 |
- compile_args: any arguments passed to the compiler |
| 136 |
- link_args: any arguments passed to the linker |
| 137 |
- links: anything passed via link_with or link_whole |
| 138 |
- includes: any include_directories |
| 139 |
- sources: any compiled or static sources the dependency has |
| 140 |
|
| 141 |
warnings: |
| 142 |
- A bug present until 0.50.1 results in the above behavior |
| 143 |
not working correctly. |
| 144 |
|
| 145 |
kwargs: |
| 146 |
compile_args: |
| 147 |
type: bool |
| 148 |
default: false |
| 149 |
description: Whether to include compile_args |
| 150 |
|
| 151 |
link_args: |
| 152 |
type: bool |
| 153 |
default: false |
| 154 |
description: Whether to include link_args |
| 155 |
|
| 156 |
links: |
| 157 |
type: bool |
| 158 |
default: false |
| 159 |
description: Whether to include links |
| 160 |
|
| 161 |
includes: |
| 162 |
type: bool |
| 163 |
default: false |
| 164 |
description: Whether to include includes |
| 165 |
|
| 166 |
sources: |
| 167 |
type: bool |
| 168 |
default: false |
| 169 |
description: Whether to include sources |
| 170 |
|
| 171 |
- name: get_variable |
| 172 |
returns: str |
| 173 |
since: 0.51.0 |
| 174 |
description: | |
| 175 |
A generic variable getter method, which replaces the |
| 176 |
`get_*type*_variable` methods. This allows one to get the variable |
| 177 |
from a dependency without knowing specifically how that dependency |
| 178 |
was found. If `default_value` is set and the value cannot be gotten |
| 179 |
from the object then `default_value` is returned, if it is not set |
| 180 |
then an error is raised. |
| 181 |
|
| 182 |
warnings: |
| 183 |
- Before 1.3.0, specifying multiple pkgconfig_define pairs would silently |
| 184 |
malform the results. Only the first variable would be redefined, but |
| 185 |
its value would contain both the second variable name, as well as its |
| 186 |
value. |
| 187 |
|
| 188 |
optargs: |
| 189 |
varname: |
| 190 |
type: str |
| 191 |
since: 0.58.0 |
| 192 |
description: | |
| 193 |
This argument is used as a default value |
| 194 |
for `cmake`, `pkgconfig`, `configtool`, `internal` and `system` keyword |
| 195 |
arguments. It is useful in the common case where `pkgconfig` and `internal` |
| 196 |
use the same variable name, in which case it's easier to write `dep.get_variable('foo')` |
| 197 |
instead of `dep.get_variable(pkgconfig: 'foo', internal: 'foo')`. |
| 198 |
|
| 199 |
kwargs: |
| 200 |
cmake: |
| 201 |
type: str |
| 202 |
description: The CMake variable name |
| 203 |
|
| 204 |
pkgconfig: |
| 205 |
type: str |
| 206 |
description: The pkgconfig variable name |
| 207 |
|
| 208 |
configtool: |
| 209 |
type: str |
| 210 |
description: The configtool variable name |
| 211 |
|
| 212 |
internal: |
| 213 |
type: str |
| 214 |
since: 0.54.0 |
| 215 |
description: The internal variable name |
| 216 |
|
| 217 |
system: |
| 218 |
type: str |
| 219 |
since: 1.6.0 |
| 220 |
description: The system variable name |
| 221 |
|
| 222 |
default_value: |
| 223 |
type: str |
| 224 |
description: The default value to return when the variable does not exist |
| 225 |
|
| 226 |
pkgconfig_define: |
| 227 |
type: list[str] |
| 228 |
description: See [[dep.get_pkgconfig_variable]] |
| 229 |
|
| 230 |
- name: as_static |
| 231 |
returns: dep |
| 232 |
since: 1.6.0 |
| 233 |
description: | |
| 234 |
Only for dependencies created with [[declare_dependency]], |
| 235 |
returns a copy of the dependency object that prefer the `static` version |
| 236 |
of [[both_libraries]]. |
| 237 |
kwargs: |
| 238 |
recursive: |
| 239 |
type: bool |
| 240 |
description: If true, this is recursively applied to dependencies |
| 241 |
|
| 242 |
- name: as_shared |
| 243 |
returns: dep |
| 244 |
since: 1.6.0 |
| 245 |
description: | |
| 246 |
Only for dependencies created with [[declare_dependency]], |
| 247 |
returns a copy of the dependency object that prefer the `shared` version |
| 248 |
of [[both_libraries]]. |
| 249 |
kwargs: |
| 250 |
recursive: |
| 251 |
type: bool |
| 252 |
description: If true, this is recursively applied to dependencies |
| 253 |
|