tools.rst 3.5 KB

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