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:
new commands deriving from
waflib.Context.Context
new task classes deriving from
waflib.Task.Task
new methods to
waflib.Configure.ConfigurationContext
andwaflib.Build.BuildContext
throughwaflib.Configure.conf()
new task generator methods to
waflib.TaskGen.task_gen
throughwaflib.TaskGen.taskgen_method()
,waflib.TaskGen.after()
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')
- clang
- clangxx
- compiler_c
- compiler_cxx
- ar
- gcc
- gxx
- icc
- icpc
- suncc
- suncxx
- xlc
- xlcxx
- msvc
after_method()
feature()
conf()
g_msvc_systemlibs
all_msvc_platforms
all_wince_platforms
all_icl_platforms
setup_msvc()
get_msvc_version()
gather_wince_supported_platforms()
target_compiler
gather_wsdk_versions()
gather_msvc_targets()
gather_wince_targets()
gather_winphone_targets()
gather_vswhere_versions()
gather_msvc_versions()
gather_icl_versions()
gather_intel_composer_versions()
detect_msvc()
get_msvc_versions()
find_lt_names_msvc()
libname_msvc()
check_lib_msvc()
check_libs_msvc()
configure()
no_autodetect()
autodetect()
find_msvc()
visual_studio_add_flags()
msvc_common_flags()
apply_flags_msvc()
apply_manifest()
make_winphone_app()
make_windows_app()
- winres
- irixcc
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.
- ccroot
after_method()
before_method()
feature()
taskgen_method()
extension()
conf()
USELIB_VARS
create_compiled_task()
to_incnodes()
apply_incpaths()
link_task
stlink_task
apply_skip_stlib_link_deps()
apply_link()
use_rec()
process_use()
accept_node_to_link()
add_objects_from_tgen()
get_uselib_vars()
propagate_uselib_vars()
apply_implib()
apply_vnum()
vnum
fake_shlib
fake_stlib
read_shlib()
read_stlib()
process_lib()
fake_o
process_objs()
read_object()
set_full_paths_hpux()
- c
- cxx
- c_config
after_method()
feature()
conf()
WAF_CONFIG_H
parse_flags()
validate_cfg()
exec_cfg()
check_cfg()
build_fun()
validate_c()
post_check()
check()
test_exec
test_exec_fun()
check_cxx()
check_cc()
set_define_comment()
get_define_comment()
define()
undefine()
define_cond()
is_defined()
get_define()
have_define()
write_config_header()
get_config_header()
cc_add_flags()
cxx_add_flags()
link_add_flags()
cc_load_tools()
cxx_load_tools()
get_cc_version()
get_xlc_version()
get_suncc_version()
add_as_needed()
cfgtask
multicheck()
check_gcc_o_space()
- c_osx
- c_preproc
PreprocError
POPFILE
recursion_limit
go_absolute
use_trigraphs
g_optrans
re_lines
re_mac
re_fun
re_pragma_once
re_nl
re_cpp
trig_def
chr_esc
NUM
OP
IDENT
STR
CHAR
tok_types
exp_types
re_clexer
accepted
ignored
undefined
skipped
repl()
prec
reduce_nums()
get_num()
get_term()
reduce_eval()
stringize()
paste_tokens()
reduce_tokens()
eval_macro()
extract_macro()
extract_include()
parse_char()
tokenize()
c_parser
scan()
- c_tests
- c_aliases
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.
- compiler_fc
- g95
- gfortran
- ifort
conf()
after_method()
feature()
find_ifort()
ifort_modifier_win32()
ifort_modifier_darwin()
ifort_modifier_platform()
get_ifort_version()
configure()
all_ifort_platforms
gather_ifort_versions()
setup_ifort()
get_ifort_version_win32()
target_compiler
detect_ifort()
get_ifort_versions()
find_ifort_win32()
apply_flags_ifort()
apply_manifest_ifort()
- fc
- fc_config
conf()
feature()
before_method()
fc_flags()
fc_add_flags()
check_fortran()
check_fc()
fortran_modifier_darwin()
fortran_modifier_win32()
fortran_modifier_cygwin()
check_fortran_dummy_main()
is_link_verbose()
check_fortran_verbose_flag()
_match_ignore()
parse_fortran_link()
_parse_flink_line()
check_fortran_clib()
getoutput()
link_main_routines_tg_method()
mangling_schemes()
mangle_name()
check_fortran_mangling()
set_lib_pat()
detect_openmp()
check_gfortran_o_space()
- fc_scan
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.
- waf_unit_test
- tex
feature()
before_method()
bibunitscan()
exts_deps_tex
exts_tex
re_tex
g_bibtex_re
g_glossaries_re
tex
tex.bibtex_fun()
tex.makeindex_fun()
tex.makeglossaries_fun()
tex._
tex.exec_command()
tex.scan_aux()
tex.scan()
tex.check_status()
tex.bibfile()
tex.bibunits()
tex.makeindex()
tex.bibtopic()
tex.makeglossaries()
tex.texinputs()
tex.run()
tex.hash_aux_nodes()
tex.call_latex()
tex.hasrun
tex.generator
tex.env
tex.inputs
tex.outputs
tex.dep_nodes
tex.run_after
tex.hcode
latex
pdflatex
xelatex
dvips
dvipdf
pdf2ps
apply_tex()
configure()
- javaw
- cs
- gnu_dirs
- intltool
- lua
- md5_tstamp
- nobuild