pkg_config

extension_helpers.pkg_config(packages, default_libraries, executable='pkg-config')

Uses pkg-config to update a set of setuptools Extension arguments to include the flags necessary to link against the given packages.

If the pkg-config lookup fails, default_libraries is applied to libraries.

Parameters:
  • packages (list) – The pkg-config packages to look up, as a list of strings.

  • default_libraries (list) – The library names to use if the pkg-config lookup fails, a list of strings.

Returns:

config – A dictionary containing keyword arguments to Extension. These entries include:

  • include_dirs: A list of include directories

  • library_dirs: A list of library directories

  • libraries: A list of libraries

  • define_macros: A list of macro defines

  • undef_macros: A list of macros to undefine

  • extra_compile_args: A list of extra arguments to pass to the compiler

Return type:

dict