1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: document pkgconfig (#6687)

This commit is contained in:
pancake 2020-10-29 08:02:49 +01:00 committed by GitHub
parent ce7da85166
commit fbd193b27c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2417,6 +2417,25 @@ NB: Each flag must go on its own line (for now)
#flag linux -DIMGUI_IMPL_API=
```
### #pkgconfig
Add `#pkgconfig` directive is used to tell the compiler which modules should be used for compiling
and linking using the pkg-config files provided by the respective dependencies.
As long as backticks can't be used in `#flag` and spawning processes is not desirable for security
and portability reasons, V uses its own pkgconfig library that is compatible with the standard
freedesktop one.
If no flags are passed it will add `--cflags` and `--libs`, both lines below do the same:
```v
#pkgconfig r_core
#pkgconfig --cflags --libs r_core
```
The `.pc` files are looked up into a hardcoded list of default pkg-config paths, the user can add
extra paths by using the `PKG_CONFIG_PATH` environment variable. Multiple modules can be passed.
### Including C code
You can also include C code directly in your V module.