aboutsummaryrefslogtreecommitdiff
path: root/docs/yaml/objects/dep.yaml
blob: d847690f0dd501044ded3f49bd75e44d7792e727 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: dep
long_name: Dependency object
description: Abstract representation of a dependency

methods:
  - name: found
    returns: bool
    description: Returns whether the dependency was found.

  - name: name
    since: 0.48.0
    returns: str
    description: |
      Returns the name of the dependency that was searched.
      Returns `'internal'` for dependencies created with
      [[declare_dependency]].

  - name: get_pkgconfig_variable
    since: 0.36.0
    deprecated: 0.56.0
    returns: str
    description: |
      Gets the pkg-config variable specified,
      or, if invoked on a non pkg-config
      dependency, error out.

    posargs:
      var_name:
        type: str
        description: Name of the variable to query

    kwargs:
      define_variable:
        type: list[str]
        since: 0.44.0
        description: |
          You can also redefine a
          variable by passing a list to this kwarg
          that can affect the retrieved variable: `['prefix', '/'])`.

      default:
        type: str
        since: 0.45.0
        description: |
          The value to return if the variable was not found.
          A warning is issued if the variable is not defined and this kwarg is not set.

  - name: get_configtool_variable
    since: 0.44.0
    deprecated: 0.56.0
    returns: str
    description: |
      Gets the command line argument from the config tool (with `--` prepended), or,
      if invoked on a non config-tool dependency, error out.

    posargs:
      var_name:
        type: str
        description: Name of the variable to query

  - name: type_name
    returns: str
    description: |
      Returns a string describing the type of the
      dependency, the most common values are `internal` for deps created
      with [[declare_dependency]] and `pkgconfig` for system dependencies
      obtained with Pkg-config.

  - name: version
    returns: str
    description: |
      the version number as a string,
      for example `1.2.8`.
      `unknown` if the dependency provider doesn't support determining the
      version.

  - name: include_type
    returns: str
    since: 0.52.0
    description: Returns the value set by the `include_type` kwarg.

  - name: as_system
    returns: dep
    since: 0.52.0
    description: |
      Returns a copy of the dependency object, which has changed the value of `include_type`
      to `value`. The `value` argument is optional and
      defaults to `'preserve'`.

    optargs:
      value:
        type: str
        description: The new value. See [[dependency]] for supported values.

  - name: as_link_whole
    returns: dep
    since: 0.56.0
    description: |
      Only dependencies created with [[declare_dependency]],
      returns a copy of the dependency object with all
      link_with arguments changed to link_whole. This is useful for example for
      fallback dependency from a subproject built with `default_library=static`.
      Note that all `link_with` objects must be static libraries otherwise an error
      will be raised when trying to `link_whole` a shared library.

  - name: partial_dependency
    returns: dep
    since: 0.46.0
    description: |
      Returns a new dependency object with the same name, version, found status,
      type name, and methods as the object that called it. This new
      object will only inherit other attributes from its parent as
      controlled by keyword arguments.

      If the parent has any dependencies, those will be applied to the new
      partial dependency with the same rules. So, given:

      ```meson
      dep1 = declare_dependency(compile_args : '-Werror=foo', link_with : 'libfoo')
      dep2 = declare_dependency(compile_args : '-Werror=bar', dependencies : dep1)
      dep3 = dep2.partial_dependency(compile_args : true)
      ```

      dep3 will add `['-Werror=foo', '-Werror=bar']` to the compiler args
      of any target it is added to, but libfoo will not be added to the
      link_args.

      The following arguments will add the following attributes:

      - compile_args: any arguments passed to the compiler
      - link_args: any arguments passed to the linker
      - links: anything passed via link_with or link_whole
      - includes: any include_directories
      - sources: any compiled or static sources the dependency has

    warnings:
      - A bug present until 0.50.1 results in the above behavior
        not working correctly.

    kwargs:
      compile_args:
        type: bool
        default: false
        description: Whether to include compile_args

      link_args:
        type: bool
        default: false
        description: Whether to include link_args

      links:
        type: bool
        default: false
        description: Whether to include links

      includes:
        type: bool
        default: false
        description: Whether to include includes

      sources:
        type: bool
        default: false
        description: Whether to include sources

  - name: get_variable
    returns: str
    since: 0.51.0
    description: |
      A generic variable getter method, which replaces the
      `get_*type*_variable` methods. This allows one to get the variable
      from a dependency without knowing specifically how that dependency
      was found. If `default_value` is set and the value cannot be gotten
      from the object then `default_value` is returned, if it is not set
      then an error is raised.

    optargs:
      varname:
        type: str
        since: 0.58.0
        description: |
          This argument is used as a default value
          for `cmake`, `pkgconfig`, `configtool` and `internal` keyword
          arguments. It is useful in the common case where `pkgconfig` and `internal`
          use the same variable name, in which case it's easier to write `dep.get_variable('foo')`
          instead of `dep.get_variable(pkgconfig: 'foo', internal: 'foo')`.

    kwargs:
      cmake:
        type: str
        description: The CMake variable name

      pkgconfig:
        type: str
        description: The pkgconfig variable name

      configtool:
        type: str
        description: The configtool variable name

      internal:
        type: str
        since: 0.54.0
        description: The internal variable name

      default_value:
        type: str
        description: The default value to return when the variable does not exist

      pkgconfig_define:
        type: list[str]
        description: See [[dep.get_pkgconfig_variable]]