Waf Tools

Special python modules called Waf tools provide functions and classes to help using compilers, libraries or programs. The typical usage from a user script is:

def function(ctx):
        # ...
        ctx.load('toolname')

Where the function is usually:

  • options: add command-line options used by the tool

  • configure: modify conf.env, raise a configuration error if a prerequisite is not met

The tools will usually enhance the application by adding:

As a general rule, existing methods or classes are hardly ever replaced.

C/C++ compiler detection

The following Waf tools are used for loading specific C or C++ compilers. They may be used directly, for example:

def options(opt):
        opt.load('compiler_c')
def configure(conf):
        conf.load('compiler_c')

C/C++ support

The following modules contain the functions and classes required for building C and C++ applications. They are almost always loaded by other Waf tools. Among these, the most important from a user point of view is waflib.Tools.c_config which provides the waflib.Tools.c_config.check() and waflib.Tools.c_config.check_cfg() functions.

Assembly

The following tools provide support for assembly. The module waflib.Tools.asm is loaded automatically by waflib.Tools.nasm or waflib.Tools.gas.

D language and compilers

The first three tools in the following list may be used for detecting D compilers. The remaining contain the support functions and classes.

Fortran support

The first four tools in the following list are used for detecting fortran compilers. The three remaining contain the routines for compiling fortran applications.

Other compilers and tools

The following tools provide support for specific compilers or configurations. More tools are present in the extras folder, although they are not documented and as stable as the default tools.