doc/tutorial/source/getting-started.rst
changeset 11544 cfaf2d65b33c
parent 11396 02c95df86484
child 11670 61dae169dc6a
equal deleted inserted replaced
11543:ec5dd7666b77 11544:cfaf2d65b33c
   552   $ ./waf --build-profile=debug
   552   $ ./waf --build-profile=debug
   553 
   553 
   554 There is also an intermediate build profile, ``release``.  ``-d`` is a
   554 There is also an intermediate build profile, ``release``.  ``-d`` is a
   555 synonym for ``--build-profile``.
   555 synonym for ``--build-profile``.
   556 
   556 
       
   557 The build profile controls the use of logging, assertions, and compiler optimization:
       
   558 
       
   559 +--------------------+---------------------------------+-----------------------------------------------------------------+
       
   560 | Feature            | Build Profile                                                                                     |
       
   561 +                    +---------------------------------+-------------------------------+---------------------------------+
       
   562 |                    | ``debug``                       | ``release``                   | ``optimized``                   |
       
   563 +====================+=================================+===============================+=================================+
       
   564 | Enabled Features   | |  ``NS3_BUILD_PROFILE_DEBUG``  | ``NS3_BUILD_PROFILE_RELEASE`` | ``NS3_BUILD_PROFILE_OPTIMIZED`` |
       
   565 |                    | |  ``NS_LOG...``                |                               |                                 |
       
   566 |                    | |  ``NS_ASSERT...``             |                               |                                 |
       
   567 +--------------------+---------------------------------+-------------------------------+---------------------------------+
       
   568 | Code Wrapper Macro | ``NS_BUILD_DEBUG(code)``        |  ``NS_BUILD_RELEASE(code)``   | ``NS_BUILD_OPTIMIZED(code)``    |
       
   569 +--------------------+---------------------------------+-------------------------------+---------------------------------+
       
   570 | Compiler Flags     | ``-O0 -ggdb -g3``               | ``-O3 -g0``                   | ``-O3 -g``                      |
       
   571 |                    |                                 | ``-fomit-frame-pointer``      | ``-fstrict-overflow``           |
       
   572 |                    |                                 |                               | ``-march=native``               |
       
   573 +--------------------+---------------------------------+-------------------------------+---------------------------------+
       
   574 
       
   575 As you can see, logging and assertions are only available in debug builds.
       
   576 Recommended practice is to develop your scenario in debug mode, then
       
   577 conduct repetitive runs (for statistics or changing parameters) in
       
   578 optimized build profile.
       
   579 
       
   580 If you have code that should only run in specific build profiles,
       
   581 use the indicated Code Wrapper macro:
       
   582 
       
   583 .. sourcecode:: cpp
       
   584 
       
   585   NS_BUILD_DEBUG (std::cout << "Part of an output line..." << std::flush; timer.Start ());
       
   586   DoLongInvolvedComputation ();
       
   587   NS_BUILD_DEBUG (timer.Stop (); std::cout << "Done: " << timer << std::endl;)
       
   588 
   557 By default Waf puts the build artifacts in the ``build`` directory.  
   589 By default Waf puts the build artifacts in the ``build`` directory.  
   558 You can specify a different output directory with the ``--out``
   590 You can specify a different output directory with the ``--out``
   559 option, e.g.
   591 option, e.g.
   560 
   592 
   561 ::
   593 ::
   588   $ ./waf build
   620   $ ./waf build
   589   ...
   621   ...
   590   $ ./waf configure $NS3CONFIG $NS3OPT
   622   $ ./waf configure $NS3CONFIG $NS3OPT
   591   $ ./waf build
   623   $ ./waf build
   592 
   624 
   593 Compilers
   625 Compilers and Flags
   594 =========
   626 ===================
   595 
   627 
   596 In the examples above, Waf uses the GCC C++ compiler, ``g++``, for
   628 In the examples above, Waf uses the GCC C++ compiler, ``g++``, for
   597 building |ns3|. However, it's possible to change the C++ compiler used by Waf
   629 building |ns3|. However, it's possible to change the C++ compiler used by Waf
   598 by defining the ``CXX`` environment variable.
   630 by defining the ``CXX`` environment variable.
   599 For example, to use the Clang C++ compiler, ``clang++``,
   631 For example, to use the Clang C++ compiler, ``clang++``,
   611 
   643 
   612 More info on ``distcc`` and distributed compilation can be found on it's
   644 More info on ``distcc`` and distributed compilation can be found on it's
   613 `project page
   645 `project page
   614 <http://code.google.com/p/distcc/>`_
   646 <http://code.google.com/p/distcc/>`_
   615 under Documentation section.
   647 under Documentation section.
       
   648 
       
   649 To add compiler flags, use the ``CXXFLAGS_EXTRA`` environment variable when
       
   650 you configure |ns3|.
   616 
   651 
   617 Install
   652 Install
   618 =======
   653 =======
   619 
   654 
   620 Waf may be used to install libraries in various places on the system.
   655 Waf may be used to install libraries in various places on the system.