Classes and methods shared by tools providing support for C-like language such as C/C++/D/Assembly/Go (this support module is almost never used alone).
Mapping for features to waflib.ConfigSet.ConfigSet variables. See waflib.Tools.ccroot.propagate_uselib_vars().
Task generator method
Create the compilation task: c, cxx, asm, etc. The output node is created automatically (object file with a typical .o extension). The task is appended to the list compiled_tasks which is then used by waflib.Tools.ccroot.apply_link()
Parameters: |
|
---|---|
Returns: | The task created |
Return type: |
Task generator method
Task generator method provided to convert a list of string/nodes into a list of includes folders.
The paths are assumed to be relative to the task generator path, except if they begin by # in which case they are searched from the top-level directory (bld.srcnode). The folders are simply assumed to be existing.
The node objects in the list are returned in the output list. The strings are converted into node objects if possible. The node is searched from the source directory, and if a match is found, the equivalent build directory is created and added to the returned list too. When a folder cannot be found, it is ignored.
Parameters: | inlst (space-delimited string or a list of string/nodes) – list of folders |
---|---|
Return type: | list of waflib.Node.Node |
Returns: | list of include folders as nodes |
Task generator method
Task generator method that processes the attribute includes:
tg = bld(features='includes', includes='.')
The folders only need to be relative to the current directory, the equivalent build directory is added automatically (for headers created in the build directory). This enable using a build directory or not (top == out).
This method will add a list of nodes read by waflib.Tools.ccroot.to_incnodes() in tg.env.INCPATHS, and the list of include paths in tg.env.INCLUDES.
Feature : | c, cxx, d, go, asm, fc, includes |
---|
Bases: waflib.Task.Task
Base class for all link tasks. A task generator is supposed to have at most one link task bound in the attribute link_task. See waflib.Tools.ccroot.apply_link().
Default installation path for the link task outputs, or None to disable
Default installation mode for the link task outputs
Bases: waflib.Tools.ccroot.link_task
Base for static link tasks, which use ar most of the time. The target is always removed before being written.
Task generator method
Collect the tasks stored in compiled_tasks (created by waflib.Tools.ccroot.create_compiled_task()), and use the outputs for a new instance of waflib.Tools.ccroot.link_task. The class to use is the first link task matching a name from the attribute features, for example:
def build(bld):
tg = bld(features='cxx cxxprogram cprogram', source='main.c', target='app')
will create the task tg.link_task as a new instance of waflib.Tools.cxx.cxxprogram
Feature : | c, cxx, d, go, fc, asm |
---|
Task generator method
Processes the use keyword recursively. This method is kind of private and only meant to be used from process_use
Task generator method
Process the use attribute which contains a list of task generator names:
def build(bld):
bld.shlib(source='a.c', target='lib1')
bld.program(source='main.c', target='app', use='lib1')
See waflib.Tools.ccroot.use_rec().
Feature : | c, cxx, d, use, fc |
---|
Task generator method
Returns: | the uselib variables associated to the features attribute (see waflib.Tools.ccroot.USELIB_VARS) |
---|---|
Return type: | list of string |
Task generator method
Process uselib variables for adding flags. For example, the following target:
def build(bld):
bld.env.AFLAGS_aaa = ['bar']
from waflib.Tools.ccroot import USELIB_VARS
USELIB_VARS['aaa'] = set('AFLAGS')
tg = bld(features='aaa', aflags='test')
The aflags attribute will be processed and this method will set:
tg.env.AFLAGS = ['bar', 'test']
Feature : | c, cxx, d, fc, javac, cs, uselib |
---|
Task generator method
Handle dlls and their import libs on Windows-like systems.
A .dll.a file called import library is generated. It must be installed as it is required for linking the library.
Feature : | cshlib, cxxshlib, fcshlib |
---|
Task generator method
Enforce version numbering on shared libraries. The valid version numbers must have at most two dots:
def build(bld):
bld.shlib(source='a.c', target='foo', vnum='14.15.16')
In this example, libfoo.so is installed as libfoo.so.1.2.3, and the following symbolic links are created:
Feature : | cshlib, cxxshlib, dshlib, fcshlib, vnum |
---|
Bases: waflib.Task.Task
Create the symbolic links for a versioned shared library. Instances are created by waflib.Tools.ccroot.apply_vnum()
Bases: waflib.Tools.ccroot.link_task
Task used for reading a system library and adding the dependency on it
Bases: waflib.Tools.ccroot.stlink_task
Task used for reading a system library and adding the dependency on it
Configuration Method bound to waflib.Configure.ConfigurationContext
Read a system shared library, enabling its use as a local library. Will trigger a rebuild if the file changes:
def build(bld):
bld.read_shlib('m')
bld.program(source='main.c', use='m')
Configuration Method bound to waflib.Configure.ConfigurationContext
Read a system static library, enabling a use as a local library. Will trigger a rebuild if the file changes.
Task generator method
Find the location of a foreign library. Used by waflib.Tools.ccroot.read_shlib and waflib.Tools.ccroot.read_stlib.
Feature : | fake_lib |
---|
Decorator: attach new configuration functions to waflib.Build.BuildContext and waflib.Configure.ConfigurationContext. The methods bound will accept a parameter named ‘mandatory’ to disable the configuration errors:
def configure(conf):
conf.find_program('abc', mandatory=False)
Parameters: | f (function) – method to bind |
---|
Decorator: register a method as a task generator method. The function must accept a task generator as first parameter:
from waflib.TaskGen import taskgen_method
@taskgen_method
def mymethod(self):
pass
Parameters: | func (function) – task generator method to add |
---|---|
Return type: | function |
Decorator: register a task generator method that will be executed when the object attribute ‘feature’ contains the corresponding key(s):
from waflib.Task import feature
@feature('myfeature')
def myfunction(self):
print('that is my feature!')
def build(bld):
bld(features='myfeature')
Parameters: | k (list of string) – feature names |
---|
Decorator: register a task generator method which will be executed before the functions of given name(s):
from waflib.TaskGen import feature, before
@feature('myfeature')
@before_method('fun2')
def fun1(self):
print('feature 1!')
@feature('myfeature')
def fun2(self):
print('feature 2!')
def build(bld):
bld(features='myfeature')
Parameters: | k (list of string) – method names |
---|
Decorator: register a task generator method which will be executed after the functions of given name(s):
from waflib.TaskGen import feature, after
@feature('myfeature')
@after_method('fun2')
def fun1(self):
print('feature 1!')
@feature('myfeature')
def fun2(self):
print('feature 2!')
def build(bld):
bld(features='myfeature')
Parameters: | k (list of string) – method names |
---|
Wrap logging.warn
Decorator: register a task generator method which will be invoked during the processing of source files for the extension given:
from waflib import Task
class mytask(Task):
run_str = 'cp ${SRC} ${TGT}'
@extension('.moo')
def create_maa_file(self, node):
self.create_task('mytask', node, node.change_ext('.maa'))
def build(bld):
bld(source='foo.moo')
Wrap logging.errors, display the origin of the message when ‘-vv’ is set
Wrap logging.debug, the output is filtered for performance reasons
Features defined in this module: