32d8025a6d07820eea9661b7267c4bc4bbfeaf0d
[senf.git] / senfscons / Mainpage.dox
1 // Copyright (C) 2007
2 // Fraunhofer Institute for Open Communication Systems (FOKUS) 
3 // Competence Center NETwork research (NET), St. Augustin, GERMANY 
4 //     Stefan Bund <g0dil@berlios.de>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
21 namespace senfscons {
22
23 /** \mainpage The Senf Build Environment
24
25     The Senf Build Environment is based on the <a href="http://www.scons.org">SCons</a> software
26     construction tool. SCons is a <a href="http://www.python.org">python</a> based replacement for
27     \c make. SENFScons consists of several SCons builders as well as some global configuration and
28     build utilities. SEBFScons tightly integrates the <a
29     href="http://www.boost.org/libs/test/doc/index.html">Boost.Test</a> unit testing framework. It
30     also incorporates a very flexible infrastructure to build software documentation using <a
31     href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</a>. This infrastructure uses quite a bit
32     of pre- and postprocessing (which is integrated with the provided Doxygen builder) to fix some
33     doxygen problems and generate a (IMHO) more readable layout.
34
35     \section layout The Project Layout
36
37     A Project using the SENFSCons infrastructure will always use a consistent directory layout. The
38     top-level directory will contain one subdirectory for every module. The main target will often
39     be considered to be just another module using the facilities provided by library modules.
40
41     The top-level project directory must contain the SENFSCons module in 'senfscons'.
42
43     The top-level \c SConstruct file will set up the global project configuration (which libraries
44     are used etc) and will then automatically load all module \c SConscript files.
45
46     Documentation is generated per module. This simplifies reusing modules in other projects. The
47     framework however semi-automatically creates the necessary cross-reference information to
48     cross-link the different module documentations. The unit-tests as well are run on a per-module
49     basis.
50
51     \section Standard Build Configuration
52
53     When the \c SConsctruct and \c SConscript files are build using the default SENFSCons helpers,
54     by default all libraries and binaries are built. Some additional targets are
55
56     <dl><dt><tt>scons all_tests</tt></dt><dd>Build all unit tests</dd>
57
58     <dt><tt>scons all_docs</tt></dt><dd>Build documentation of all modules</dd>
59
60     <dt><tt>scons all</tt></dt><dd>Build all targets including binaries, libraries, documentation,
61     tests and possible further targets </dd>
62
63     <dt><tt>scons -u doc</tt></dt><dd>Run from within a module directory will build the
64     documentation of that module</dd>
65
66     <dt><tt>scons -u test</tt></dt><dd>Run from within a module directory will build and run the
67     unit test of that module</dd></dl>
68
69     To clean any of the targets use the SCons \c -c parameter.
70
71     The build environment can be configured \e locally using \ref sconfig in the project root
72     directory.
73
74     \see
75         \ref sconstruct \n
76         \ref sconscript \n
77         \ref sconfig  \n
78         \ref builder
79  */
80
81 /** \page sconstruct The Top-Level 'SConstruct' File
82
83     The top-level \c SConstruct file sets up the build, configures used libraries and parameters and
84     invokes the module \c SConscript files. To simplify the configuration, the SENFScons python
85     package is provided. This package has helper utilities to simplify standard tasks.
86
87     In \c senfscons/SConstruct.template you may find an example SConstruct file. Copy this to the
88     project root (under the name \c SConstruct) to start a new project. You can then modify and
89     configure it to your wishes.
90
91     The general structure of the \c SConstruct file is
92     \li make the \c senfscons directory accessible
93     \li tell the SENFScons infrastructure, which frameworks you intend to use and let SENFScons
94         built a construction environment for you
95     \li configure the construction environment
96     \li load module sconscript file
97     \li specify global build targets
98
99     The first part, <i>making the \c senfscons directory accessible</i> will always stay the
100     same. See the template file for how this is done.
101
102     <i>Simplifying the use of more complex frameworks</i> is one of the most important things why
103     SENFScons exists. If you only use very simple libraries, the configuration is quite
104     simple. However for more complex frameworks the configuration can get quite complicated. This is
105     simplified using the SENFScons framework statements. They all reside in the \c SENFSCons package
106     and have a prefix of \c Use. See \ref use.
107
108     After all frameworks are configured, you can use SEFNScons.MakeEnvironment() to create a
109     correctly configured construction environment.
110
111     To <i>configure the construction environment</i> you can set Variables in the construction
112     environment. See the SCons manpage for a list of supported variables. Some additional variables
113     are available with the new builders introduced with SENFSCons. Those are documented with the
114     builder module documentation.
115
116     <i>Loading the module \c SConscript files</i> will normally always be performed the same way
117     using \c glob.glob() to automatically include any subdirectory module.
118
119     You may then <i>specify global build targets</i>. You can use standard SCons targets or use all
120     the target helpers provided with SENFSCons. Two standard helpers should always be included:
121     SENFSCons.StandardTargets() and SENFSCons.GlobalTargets(). You can find more target helpers at
122     \ref target
123
124     The SConstruct file is an ordinary python file. It is loaded by SCons prior to building the
125     software. Just remember, you can use all of python and all of SCons here. SENFScons just
126     provides some additional helpers to make things simpler and more concise.
127
128     \see
129         \ref use \n
130         \ref target
131  */
132
133 /** \page sconscript The Module 'SConscript' Files
134
135     Every module (that is subdirectory) is built by that modules \c SConscript file. In \c
136     SConscript.template you can find a template of such a file.
137
138     Every \c SConscript file starts by importing the construction environment. The \c SConscript
139     file is an ordinary \c SConscript file as used by SCons. You may use any of the SCons facilities
140     to define targets. However, you will mostly use the \ref target.
141
142     Every \c SConscript file should call \c SENFSCons.StandardTargets() to initialize the standard
143     targets of every module.
144
145     \see
146         \ref target
147  */
148
149 /** \page sconfig The 'SConfig' File
150
151     To configure the build environment to the local environment, a \c SConfig file may be created in
152     the projects root directory. The supported parameters are
153
154     <dl>
155         <dt>\c CXX</dt>
156             <dd>C++ compiler to use</dd>
157         <dt>\c EXTRA_DEFINES</dt>
158             <dd>preprocessor symbols to be defined locally</dd>
159         <dt>\c EXTRA_LIBS</dt>
160             <dd>additional libraries needed for a local build</dd>
161     </dl>
162
163     Additionally, the \ref use define additional configuration variables which may be set here.
164  */
165
166 }
167
168 \f
169 // Local Variables:
170 // mode: c++
171 // fill-column: 100
172 // c-file-style: "senf"
173 // indent-tabs-mode: nil
174 // ispell-local-dictionary: "american"
175 // mode: flyspell
176 // mode: auto-fill
177 // End: