C/C++/D configuration helpers
default name for the config.h file
Code template for checking for functions
Code template for checking for types
Configuration Method bound to waflib.Configure.ConfigurationContext
Parse the flags from the input lines, and add them to the relevant use variables:
def configure(conf):
conf.parse_flags('-O3', uselib_store='FOO')
# conf.env.CXXFLAGS_FOO = ['-O3']
# conf.env.CFLAGS_FOO = ['-O3']
Parameters: |
|
---|
Configuration Method bound to waflib.Configure.ConfigurationContext
Configuration Method bound to waflib.Configure.ConfigurationContext
Search for the program pkg-config if missing, and validate the parameters to pass to waflib.Tools.c_config.exec_cfg().
Parameters: |
|
---|
Configuration Method bound to waflib.Configure.ConfigurationContext
Execute the program pkg-config:
Parameters: |
|
---|
Configuration Method bound to waflib.Configure.ConfigurationContext
Check for configuration flags using a -config-like program (pkg-config, sdl-config, etc). Encapsulate the calls to waflib.Tools.c_config.validate_cfg() and waflib.Tools.c_config.exec_cfg()
A few examples:
def configure(conf):
conf.load('compiler_c')
conf.check_cfg(package='glib-2.0', args='--libs --cflags')
conf.check_cfg(package='glib-2.0', uselib_store='GLIB', atleast_version='2.10.0',
args='--cflags --libs')
conf.check_cfg(package='pango')
conf.check_cfg(package='pango', uselib_store='MYPANGO', args=['--cflags', '--libs'])
conf.check_cfg(package='pango',
args=['pango >= 0.1.0', 'pango < 9.9.9', '--cflags', '--libs'],
msg="Checking for 'pango 0.1.0'")
conf.check_cfg(path='sdl-config', args='--cflags --libs', package='', uselib_store='SDL')
conf.check_cfg(path='mpicc', args='--showme:compile --showme:link',
package='', uselib_store='OPEN_MPI', mandatory=False)
Configuration Method bound to waflib.Configure.ConfigurationContext
pre-check the parameters that will be given to run_c_code
Parameters: |
|
---|
Configuration Method bound to waflib.Configure.ConfigurationContext Set the variables after a test executed in waflib.Tools.c_config.check() was run successfully
Configuration Method bound to waflib.Configure.ConfigurationContext
Perform a configuration test by calling waflib.Tools.c_config.run_c_code(). For the complete list of parameters, see waflib.Tools.c_config.validate_c(). To force a specific compiler, prefer the methods waflib.Tools.c_config.check_cxx() or waflib.Tools.c_config.check_cc()
Bases: waflib.Task.Task
A task for executing a programs after they are built. See waflib.Tools.c_config.test_exec_fun().
Task generator method
The feature test_exec is used to create a task that will to execute the binary created (link task output) during the build. The exit status will be set on the build context, so only one program may have the feature test_exec. This is used by configuration tests:
def configure(conf):
conf.check(execute=True)
Feature : | test_exec |
---|
Configuration Method bound to waflib.Configure.ConfigurationContext
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
Configuration Method bound to waflib.Configure.ConfigurationContext
Same as waflib.Tools.c_config.check() but default to the c++ programming language
Configuration Method bound to waflib.Configure.ConfigurationContext
Same as waflib.Tools.c_config.check() but default to the c programming language
Configuration Method bound to waflib.Configure.ConfigurationContext
Store a single define and its state into conf.env.DEFINES
Parameters: |
|
---|
Configuration Method bound to waflib.Configure.ConfigurationContext
Remove a define from conf.env.DEFINES
Parameters: | key (string) – define name |
---|
Configuration Method bound to waflib.Configure.ConfigurationContext
Conditionally define a name:
def configure(conf):
conf.define_cond('A', True)
# equivalent to:
# if val: conf.define('A', 1)
# else: conf.undefine('A')
Parameters: |
|
---|
Configuration Method bound to waflib.Configure.ConfigurationContext
Parameters: | key (string) – define name |
---|---|
Returns: | True if the define is set |
Return type: | bool |
Configuration Method bound to waflib.Configure.ConfigurationContext
Parameters: | key (string) – define name |
---|---|
Returns: | the value of a previously stored define or None if it is not set |
Configuration Method bound to waflib.Configure.ConfigurationContext
Parameters: | key (string) – define name |
---|---|
Returns: | the input key prefixed by HAVE_ and substitute any invalid characters. |
Return type: | string |
Configuration Method bound to waflib.Configure.ConfigurationContext
Write a configuration header containing defines and includes:
def configure(cnf):
cnf.define('A', 1)
cnf.write_config_header('config.h')
Parameters: |
|
---|
Configuration Method bound to waflib.Configure.ConfigurationContext
Create the contents of a config.h file from the defines and includes set in conf.env.define_key / conf.env.include_key. No include guards are added.
Parameters: |
|
---|---|
Returns: | the contents of a config.h file |
Return type: | string |
Configuration Method bound to waflib.Configure.ConfigurationContext
Read the CFLAGS/CPPFLAGS from os.environ and add to conf.env.CFLAGS
Configuration Method bound to waflib.Configure.ConfigurationContext
Read the CXXFLAGS/CPPFLAGS and add to conf.env.CXXFLAGS
Configuration Method bound to waflib.Configure.ConfigurationContext
Read the LINKFLAGS/LDFLAGS and add to conf.env.LDFLAGS
Configuration Method bound to waflib.Configure.ConfigurationContext
Load the c tool
Configuration Method bound to waflib.Configure.ConfigurationContext
Load the cxx tool
Configuration Method bound to waflib.Configure.ConfigurationContext
Run the preprocessor to determine the compiler version
The variables CC_VERSION, DEST_OS, DEST_BINFMT and DEST_CPU will be set in conf.env
Configuration Method bound to waflib.Configure.ConfigurationContext Get the compiler version
Configuration Method bound to waflib.Configure.ConfigurationContext
Add --as-needed to the LINKFLAGS
Bases: waflib.Task.TaskBase
A task that executes configuration tests make sure that the checks write to conf.env in a thread-safe manner
for the moment it only executes conf.check
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 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 |
---|
Configuration Method bound to waflib.Configure.ConfigurationContext
Use tuples to perform parallel configuration tests
Features defined in this module: