tools.rst (3557B)
1 Waf Tools 2 ========= 3 4 Special python modules called Waf **tools** provide functions and classes to help 5 using compilers, libraries or programs. The typical usage from a user script is:: 6 7 def function(ctx): 8 # ... 9 ctx.load('toolname') 10 11 Where the function is usually: 12 13 * options: add command-line options used by the tool 14 * configure: modify ``conf.env``, raise a configuration error if a prerequisite is not met 15 16 The tools will usually enhance the application by adding: 17 18 * new commands deriving from :py:class:`waflib.Context.Context` 19 * new task classes deriving from :py:class:`waflib.Task.Task` 20 * new methods to :py:class:`waflib.Configure.ConfigurationContext` and :py:class:`waflib.Build.BuildContext` through :py:func:`waflib.Configure.conf` 21 * new task generator methods to :py:class:`waflib.TaskGen.task_gen` through :py:func:`waflib.TaskGen.taskgen_method`, :py:func:`waflib.TaskGen.after` 22 23 As a general rule, existing methods or classes are hardly ever replaced. 24 25 C/C++ compiler detection 26 ------------------------ 27 28 The following Waf tools are used for loading specific C or C++ compilers. They may 29 be used directly, for example:: 30 31 def options(opt): 32 opt.load('compiler_c') 33 def configure(conf): 34 conf.load('compiler_c') 35 36 .. toctree:: 37 38 tools/clang 39 tools/clangxx 40 tools/compiler_c 41 tools/compiler_cxx 42 tools/ar 43 tools/gcc 44 tools/gxx 45 tools/icc 46 tools/icpc 47 tools/suncc 48 tools/suncxx 49 tools/xlc 50 tools/xlcxx 51 tools/msvc 52 tools/winres 53 tools/irixcc 54 55 C/C++ support 56 ------------- 57 58 The following modules contain the functions and classes required for building C and C++ applications. They 59 are almost always loaded by other Waf tools. Among these, the most important from a user point of view 60 is :py:mod:`waflib.Tools.c_config` which provides the :py:func:`waflib.Tools.c_config.check` and 61 :py:func:`waflib.Tools.c_config.check_cfg` functions. 62 63 .. toctree:: 64 65 tools/ccroot 66 tools/c 67 tools/cxx 68 tools/c_config 69 tools/c_osx 70 tools/c_preproc 71 tools/c_tests 72 tools/c_aliases 73 74 Assembly 75 -------- 76 77 The following tools provide support for assembly. The module :py:mod:`waflib.Tools.asm` is loaded automatically by :py:mod:`waflib.Tools.nasm` or :py:mod:`waflib.Tools.gas`. 78 79 .. toctree:: 80 81 tools/gas 82 tools/nasm 83 tools/asm 84 85 D language and compilers 86 ------------------------ 87 88 The first three tools in the following list may be used for detecting D compilers. The remaining contain the support functions and classes. 89 90 .. toctree:: 91 92 tools/compiler_d 93 tools/dmd 94 tools/ldc2 95 tools/gdc 96 tools/d_config 97 tools/d 98 tools/d_scan 99 100 Fortran support 101 --------------- 102 103 The first four tools in the following list are used for detecting fortran compilers. The three remaining contain the routines for compiling fortran applications. 104 105 .. toctree:: 106 107 tools/compiler_fc 108 tools/g95 109 tools/gfortran 110 tools/ifort 111 tools/fc 112 tools/fc_config 113 tools/fc_scan 114 115 C/C++-related applications 116 -------------------------- 117 118 The next tools provide support for code generators used in C and C++ projects. 119 120 .. toctree:: 121 122 tools/bison 123 tools/flex 124 tools/dbus 125 tools/vala 126 tools/glib2 127 tools/qt5 128 tools/perl 129 tools/python 130 tools/ruby 131 132 Other compilers and tools 133 ------------------------- 134 135 .. _extras: https://gitlab.com/ita1024/waf/tree/master/waflib/extras 136 137 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. 138 139 .. toctree:: 140 141 tools/waf_unit_test 142 tools/tex 143 tools/javaw 144 tools/cs 145 tools/gnu_dirs 146 tools/intltool 147 tools/lua 148 tools/md5_tstamp 149 tools/nobuild 150