Configuration system
A waflib.Configure.ConfigurationContext instance is created when waf configure is called, it is used to:
Name of the configuration log file
Execute the configuration automatically
Bases: waflib.Context.Context
Configure the project.
Waf tools may bind new methods to this class:
from waflib.Configure import conf
@conf
def myhelper(self):
print("myhelper")
def configure(ctx):
ctx.myhelper()
Additional functions to handle configuration errors
Set a new config set for conf.env. If a config set of that name already exists, recall it without modification.
The name is the filename prefix to save to c4che/NAME_cache.py, and it is also used as variants by the build commands. Though related to variants, whatever kind of data may be stored in the config set:
def configure(cfg):
cfg.env.ONE = 1
cfg.setenv('foo')
cfg.env.ONE = 2
def build(bld):
2 == bld.env_of_name('foo').ONE
Parameters: |
|
---|
Getter for the env property
Insert PREFIX, BINDIR and LIBDIR values into env
Parameters: | env (waflib.ConfigSet.ConfigSet) – a ConfigSet, usually conf.env |
---|
Load Waf tools, which will be imported whenever a build is started.
Parameters: |
|
---|
Records the path and a hash of the scripts visited, see waflib.Context.Context.post_recurse()
Parameters: | node (waflib.Node.Node) – script |
---|
Execute configuration tests provided as list of funcitons to run
Parameters: | rules (list of string) – list of configuration method names |
---|
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 |
---|
Import operating system environment values into conf.env dict:
def configure(conf):
conf.add_os_flags('CFLAGS')
Parameters: |
|
---|
Detect if a command is written in pseudo shell like ccache g++ and return a list.
Parameters: | cmd (a string or a list of string) – command |
---|
Raise a Configuration error if the Waf version does not strictly match the given bounds:
conf.check_waf_version(mini='1.8.99', maxi='2.0.0')
Parameters: |
|
---|
Find a file in a list of paths
Parameters: |
|
---|---|
Returns: | the first occurrence filename or ‘’ if filename could not be found |
Search for a program on the operating system
When var is used, you may set os.environ[var] to help find a specific program version, for example:
$ CC='ccache gcc' waf configure
Parameters: |
|
---|
Create a temporary build context to execute a build. A reference to that build context is kept on self.test_bld for debugging purposes, and you should not rely on it too much (read the note on the cache below). The parameters given in the arguments to this function are passed as arguments for a single task generator created in the build. Only three parameters are obligatory:
Parameters: |
|
---|
Though this function returns 0 by default, the build may set an attribute named retval on the build context object to return a particular value. See waflib.Tools.c_config.test_exec_fun() for example.
This function also provides a limited cache. To use it, provide the following option:
def options(opt):
opt.add_option('--confcache', dest='confcache', default=0,
action='count', help='Use a configuration cache')
And execute the configuration with the following command-line:
$ waf configure --confcache