The pkg-config tool is widely used to simplify building software with library dependencies. It provides command line options for compiling and linking applications to a library.
Set up the environment
Set up the environment before using the pkg-config tool. To do this, use one of the following options:
-
Intel(R) oneAPI Base Toolkit setvars.sh script
-
oneVPL vars.sh script.
For example, you may use on of the following for a Linux install to the standard /opt/intel/oneapi locations:
- source /opt/intel/oneapi/setvars.sh
- source /opt/intel/oneapi/vpl/latest/env/vars.sh
Compile a program using pkg-config
For example, to compile a test program test.cpp with oneVPL, you could provide the full path to search for include files and libraries, or you could provide a simple line like this:
g++ test.cpp `pkg-config --cflags --libs vpl`
--cflags provides the include path to the API directory:
pkg-config --cflags vpl
The result:
-I/opt/intel/oneapi/vpl/2021.4.0/lib/pkgconfig/../..//include -I/opt/intel/oneapi/vpl/2021.4.0/lib/pkgconfig/../..//include/vpl
--libs provides the oneVPL library name and the search path to find it:
pkg-config --libs vpl
The result:
-L/opt/intel/oneapi/vpl/2021.4.0/lib/pkgconfig/../..//lib -lvpl
The pkg-config tool helps avoid large hard-coded paths and makes compilation more portable.
"