Dependency#

class Dependency#

A dependency is used in targets in the dependency field.

static(dependency)#

A dependency on the static artifact of a target.

Parameters:
  • dependency – The target name.

Return type:

Dependency

dynamic(dependency)#

A dependency on the dynamic artifact of a target.

Parameters:
  • dependency – The target name.

Return type:

Dependency

pkgconfig(dependency, version_req, *opts)#

A dependency on a system library which can be retrieved from pkg-config.

Parameters:
  • dependency – The name of the library in pkg-config.

  • version_req – Optionally add a version requirement.

  • opts – Extra options for pkg-config, passed as Symbols.

Return type:

Dependency

Valid options are:
  • :static: be more aggressive when computing dependency graph (for static linking).

pkgconfig_direct(file)#

Evaluate pkg-config from a file.

Parameters:
  • file – The pkg-config file.

Return type:

Dependency

system_lib(name)#

Link to a system library. This is equivalent to adding "-lname" to the linker flags of the target.

Parameters:
  • name – The name of the system library.

Return type:

Dependency

framework(name)#

Link to a system framework. This is equivalent to adding "-framework", "name" to the linker flags othe target.

Parameters:
  • name – The name of the system framework.

Return type:

Dependency

flags(flags)#

Create a dependency from flags.

Parameters:
  • flags – The flags to pass to the dependant.

Return type:

Dependency

Example

flags({
  cflags: ["-DA", "-DB"],
  headers: ["include"],
  linker_flags: ["-lz", "-lcairo"],
})

file_dep(file)#

A file dependency. The target will be rebuilt if the file has changed.

Parameters:
  • file – The path to the file.

Return type:

Dependency