vala: Fix typos and cover dependencies without pkg-config file in docs

pull/1779/merge
Guillaume Poirier-Morency 8 years ago committed by Jussi Pakkanen
parent a7fee9bd48
commit 05c431c013
  1. 16
      docs/markdown/Vala.md

@ -36,21 +36,31 @@ foo_dep = dependency('foo') # 'foo.vapi' will be resolved in './vapi/foo.vapi'
executable('app', 'app.vala', dependencies: [glib_dep, gobject_dep, foo_dep])
```
In this case, make sure that the VAPI name correspond to the pkg-config file.
In this case, make sure that the VAPI name corresponds to the pkg-config file.
If no pkg-config file is provided, you must use `find_library`. Using`declare_dependency` is cleaner because it does not require passing both dependency objects to the target.
```meson
foo_lib = meson.get_compiler('vala').find_library('foo') # assuming libfoo.so is installed
foo_lib = meson.get_compiler('c').find_library('foo') # assuming libfoo.so is installed
foo_vapi = meson.get_compiler('vala').find_library('foo', dirs: join_paths(meson.current_source_dir(), 'vapi')
foo_dep = declare_dependency(dependencies: [foo_lib, foo_vapi])
executable('app', 'app.vala', dependencies: [glib_dep, gobject_dep, foo_dep])
```
## VAPI without pkg-config file
Some Vala bindings do not need a corresponding pkg-config file and `dependency` is unsuitable for resolving them. It's necessary to use `find_library` in this case.
```meson
posix_dep = meson.get_compiler('vala').find_library('posix')
executable('app', 'app.vala', dependencies: [glib_dep, gobject_dep, posix_dep])
```
## Custom output names
If a library target is used, Meson automatically output the C header and the VAPI. They can be renamed by setting the `vala_header` and `vala_vapi` arguments respectively. In this case, the second and third elements of the `install_dir` array indicate the destination with `true` to indicate default directories (i.e. `include` and `share/vala/vapi`).
If a library target is used, Meson automatically outputs the C header and the VAPI. They can be renamed by setting the `vala_header` and `vala_vapi` arguments respectively. In this case, the second and third elements of the `install_dir` array indicate the destination with `true` to indicate default directories (i.e. `include` and `share/vala/vapi`).
```meson
foo_lib = library('foo', 'foo.vala',

Loading…
Cancel
Save