checker: add pkgconfig to comptime if (#10692)

This commit is contained in:
Louis Schmieder 2021-07-09 17:17:04 +02:00 committed by GitHub
parent aa5b609d95
commit eb96ad11d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 14 deletions

View file

@ -4017,6 +4017,18 @@ If no flags are passed it will add `--cflags` and `--libs`, both lines below do
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.
To check the existance of a pkg-config use `$pkgconfig('pkg')` as a compile time if condition to
check if a pkg-config exists. If it exists the branch will be created. Use `$else` or `$else $if`
to handle other cases.
```v ignore
$if $pkgconfig('mysqlclient') {
#pkgconfig mysqlclient
} $else $if $pkgconfig('mariadb') {
#pkgconfig mariadb
}
```
### Including C code
You can also include C code directly in your V module.