doc: document pkgconfig (#6687)

pull/6695/head
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
1 changed files with 19 additions and 0 deletions

View File

@ -2417,6 +2417,25 @@ NB: Each flag must go on its own line (for now)
#flag linux -DIMGUI_IMPL_API= #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 ### Including C code
You can also include C code directly in your V module. You can also include C code directly in your V module.